ECJPAKE.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file ECJPAKE.h
34  *
35  * @brief TI Driver for Elliptic Curve Password Authenticated Key Exchange
36  * by Juggling.
37  *
38  * @anchor ti_drivers_ECJPAKE_Overview
39  * # Overview #
40  * Elliptic Curve Password Authenticated Key Exchange by Juggling (EC-JPAKE)
41  * is a key agreement scheme that establishes a secure channel over an insecure
42  * network. It only requires sharing a password offline and does not require
43  * public key infrastructure or trusted third parties such as certificate
44  * authorities.
45  *
46  * At the end of the EC-JPAKE scheme, both parties derive a shared secret
47  * from which a session key is derived.
48  *
49  * The scheme is symmetric. Both parties perform the exact same operations
50  * to end up with the shared secret.
51  *
52  * # Steps involved #
53  * Since the scheme is symmetric, the steps involved will be illustrated
54  * using Alice and Bob as relevant parties.
55  *
56  * -# Alice and Bob decide on some pre-shared secret, the password, and
57  * negotiate this through some offline means such as during commissioning.
58  *
59  * -# Alice generates private keys x1, x2, v1, and v2 uniformly at random from [1, n - 1],
60  * where n is the order of the curve.
61  * -# Alice generates public keys X1 = x1 * G, X2 = x2 * G, V1 = v1 * G, and V2 = v2 * G.
62  * -# Alice generates Zero-Knowledge Proofs (ZKPs) for (X1, x1) and (X2, x2).
63  * The required hash is computed by concatenating G, V, the public key
64  * the ZKP authenticates, and the UserID of the authenticator and hashing
65  * the new bitstring. The exact order and formatting of all parameters and
66  * any extra information such as length words must be agreed upon by both
67  * parties to yield the same result.
68  * -# Alice sends X1, X2, V1, V2, r1, r2, and her UserID to Bob.
69  *
70  * -# Bob generates private keys x3, x4, v3, and v4 uniformly at random from [1, n - 1],
71  * where n is the order of the curve.
72  * -# Bob generates public keys X3 = x3 * G, X4 = x4 * G, V3 = v3 * G, and V4 = v4 * G.
73  * -# Bob generates Zero-Knowledge Proofs (ZKPs) for (X3, x3) and (X4, x4).
74  * -# Bob sends X3, X4, V3, V4, r3, r4, and his UserID to Bob.
75  *
76  * -# Alice and Bob verify the other parties ZKPs and break off the scheme if they
77  * do not check out.
78  *
79  * -# Alice computes the new generator point G2 = (X1 + X3 + X4).
80  * -# Alice computes the combined private key x5 = x2 * s, where s is the pre-shared
81  * secret.
82  * -# Alice computes the combined public key X5 = x5 * G2.
83  * -# Alice computes a ZKP for (X5, x5) using G2 as the generator point of the ZKP.
84  * -# Alice sends X5, V5, r5, and her UserID to Bob.
85  *
86  * -# Bob computes the new generator point G3 = (X3 + X1 + X2).
87  * -# Bob computes the combined private key x6 = x4 * s, where s is the pre-shared
88  * secret.
89  * -# Bob computes the combined public key X6 = x6 * G3.
90  * -# Bob computes a ZKP for (X6, x6) using G3 as the generator point of the ZKP.
91  * -# Bob sends X6, V6, r6, and his UserID to Alice.
92  *
93  * -# Alice and Bob verify the other parties ZKPs and break off the scheme if they
94  * do not check out. This involves computing the other parties generator point.
95  *
96  * -# Alice computes shared secret K = (X6 - (X4 * x5)) * x2.
97  *
98  * -# Bob computes shared secret K = (X5 - (X2 * x6)) * x4.
99  *
100  * -# Alice and Bob each run K through a mutually agreed upon key derivation
101  * function to compute the symmetric session key.
102  *
103  * @anchor ti_drivers_ECJPAKE_Usage
104  * # Usage #
105  *
106  * ## Before starting an ECJPAKE operation #
107  *
108  * Before starting an ECJPAKE operation, the application must do the following:
109  * -# Call ECJPAKE_init() to initialize the driver
110  * -# Call ECJPAKE_Params_init() to initialize the ECJPAKE_Params to default values.
111  * -# Modify the ECJPAKE_Params as desired
112  * -# Call ECJPAKE_open() to open an instance of the driver
113  *
114  * ## Round one #
115  * -# Initialize the following private key CryptoKeys.
116  * Seed them with keying material uniformly drawn from [1, n - 1]
117  * - myPrivateKey1
118  * - myPrivateKey2
119  * - myPrivateV1
120  * - myPrivateV2
121  * -# Initialize the following blank public key CryptoKeys:
122  * - myPublicKey1
123  * - myPublicKey2
124  * - myPublicV1
125  * - myPublicV2
126  * - theirPublicKey1
127  * - theirPublicKey2
128  * - theirPublicV1
129  * - theirPublicV2
130  * -# Call ECJPAKE_roundOneGenerateKeys() to generate all round one keys as needed.
131  * -# Generate the hashes for the ZKPs using previously agreed upon formatting.
132  * Use the default generator point of the curve in the first round.
133  * -# Generate your two ZKPs by calling ECJPAKE_generateZKP() once per ZKP.
134  * -# Exchange public keys, UserIDs, and ZKP signatures. Write the received keying
135  * material into the relevant buffers or load them into key stores as specified
136  * by the CryptoKeys initialised earlier.
137  * -# Verify the other party's ZKPs after computing their ZKP hash by calling
138  * ECJPAKE_verifyZKP() once per ZKP.
139  * -# You can now let all V keys, myPrivateKey1, and all ZKP signatures go out of scope
140  * and re-use their memory.
141  *
142  * ## Round two #
143  * -# Initialize the following private key CryptoKeys.
144  * Seed myPrivateV with keying material uniformly drawn from [1, n - 1].
145  * Initialise the preSharedSecret with the common keying material previously
146  * shared between you and the other party.
147  * - preSharedSecret
148  * - myCombinedPrivateKey
149  * -# Initialize the following blank public key CryptoKeys:
150  * - theirNewGenerator
151  * - myNewGenerator
152  * - myCombinedPublicKey
153  * - myPublicV
154  * -# Call ECJPAKE_roundTwoGenerateKeys() to generate the remaining round two keys.
155  * -# Generate the hash for your ZKP use myNewGenerator as your generator point.
156  * -# Exchange public keys, UserIDs, and ZKP signatures. Write the received keying
157  * material into the relevant buffers or load them into key stores as specified
158  * by the CryptoKeys initialised earlier.
159  * -# Verify the other party's ZKP after computing their ZKP hash b calling
160  * ECJPAKE_verifyZKP(). Use theirNewGenerator as the generator point for this
161  * ZKP.
162  * -# You can now let all keys and keying material but myCombinedPrivateKey,
163  * theirCombinedPublicKey, theirPublicKey2, and myPrivateKey2 go out of scope.
164  *
165  * ## Computing the shared secret #
166  * -# Initialize the following blank public key CryptoKey:
167  * - sharedSecret
168  * -# Call ECJPAKE_computeSharedSecret().
169  * -# Run sharedSecret through a key derivation function to compute the shared
170  * symmetric session key.
171  *
172  * ## Key Formatting
173  * The ECJPAKE API expects the private and public keys to be formatted in octet
174  * string format. The details of octet string formatting can be found in
175  * SEC 1: Elliptic Curve Cryptography.
176  *
177  * Private keys and V's are formatted as big-endian integers of the same length
178  * as the curve length.
179  *
180  * Public keys, public V's, generator points, and shared secrets are points on
181  * an elliptic curve. These points can be expressed in several ways.
182  * This API uses points expressed in uncompressed affine coordinates by default.
183  * The octet string format requires a formatting byte in the first byte of the
184  * public key. When using uncompressed affine coordinates, this is the value
185  * 0x04.
186  * The point itself is stored as a concatenated array of X followed by Y.
187  * X and Y are big-endian. Some implementations do not require or yield
188  * the Y coordinate for ECJPAKE on certain curves. It is recommended that the full
189  * keying material buffer of twice the curve param length is used to facilitate
190  * code-reuse. Implementations that do not use the Y coordinate will zero-out
191  * the Y-coordinate whenever they write a point to the CryptoKey.
192  *
193  * This API accepts and returns the keying material of public keys according
194  * to the following table:
195  *
196  * | Curve Type | Keying Material Array | Array Length |
197  * |--------------------|-----------------------|----------------------------|
198  * | Short Weierstrass | [0x04, X, Y] | 1 + 2 * Curve Param Length |
199  * | Montgomery | [0x04, X, Y] | 1 + 2 * Curve Param Length |
200  * | Edwards | [0x04, X, Y] | 1 + 2 * Curve Param Length |
201  *
202  * The r component of the ZKP signature, hash, and preSharedSecret also all
203  * use the octet string format. They are interpreted as big-endian integers.
204  *
205  * @anchor ti_drivers_ECJPAKE_Synopsis
206  * ## Synopsis
207  *
208  * @anchor ti_drivers_ECJPAKE_Synopsis_Code
209  * @code
210  * // Import ECJPAKE Driver definitions
211  * #include <ti/drivers/ECJPAKE.h>
212  *
213  * ECJPAKE_init();
214  *
215  * // Since we are using default ECJPAKE_Params, we just pass in NULL for that parameter.
216  * ecjpakeHandle = ECJPAKE_open(0, NULL);
217 
218  * ECJPAKE_Handle handle = ECJPAKE_open(0, &params);
219  *
220  * ECJPAKE_OperationRoundOneGenerateKeys operationRoundOneGenerateKeys;
221  * ECJPAKE_OperationRoundTwoGenerateKeys operationRoundTwoGenerateKeys;
222  * ECJPAKE_OperationGenerateZKP operationGenerateZKP;
223  * ECJPAKE_OperationVerifyZKP operationVerifyZKP;
224  * ECJPAKE_OperationComputeSharedSecret operationComputeSharedSecret;
225  *
226  * // Generate my round one keys
227  * ECJPAKE_OperationRoundOneGenerateKeys_init(&operationRoundOneGenerateKeys);
228  * operationRoundOneGenerateKeys.curve = &ECCParams_NISTP256;
229  * operationRoundOneGenerateKeys.myPrivateKey1 = &myPrivateCryptoKey1;
230  * operationRoundOneGenerateKeys.myPrivateKey2 = &myPrivateCryptoKey2;
231  * operationRoundOneGenerateKeys.myPublicKey1 = &myPublicCryptoKey1;
232  * operationRoundOneGenerateKeys.myPublicKey2 = &myPublicCryptoKey2;
233  * operationRoundOneGenerateKeys.myPrivateV1 = &myPrivateCryptoV1;
234  * operationRoundOneGenerateKeys.myPrivateV2 = &myPrivateCryptoV2;
235  * operationRoundOneGenerateKeys.myPublicV1 = &myPublicCryptoV1;
236  * operationRoundOneGenerateKeys.myPublicV2 = &myPublicCryptoV2;
237  *
238  * result = ECJPAKE_roundOneGenerateKeys(handle, &operationRoundOneGenerateKeys);
239  *
240  * // Generate hashes here
241  *
242  * // generate my round one ZKPs
243  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
244  * operationGenerateZKP.curve = &ECCParams_NISTP256;
245  * operationGenerateZKP.myPrivateKey = &myPrivateCryptoKey1;
246  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV1;
247  * operationGenerateZKP.hash = myHash1;
248  * operationGenerateZKP.r = myR1;
249  *
250  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
251  *
252  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
253  * operationGenerateZKP.curve = &ECCParams_NISTP256;
254  * operationGenerateZKP.myPrivateKey = &myPrivateCryptoKey2;
255  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV2;
256  * operationGenerateZKP.hash = myHash2;
257  * operationGenerateZKP.r = myR2;
258  *
259  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
260  *
261  * // Do ZKP and key transmission here
262  *
263  * // Verify their round one ZKPs
264  * // Generate their hashes here
265  *
266  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
267  * operationVerifyZKP.curve = &ECCParams_NISTP256;
268  * operationVerifyZKP.theirGenerator = NULL;
269  * operationVerifyZKP.theirPublicKey = &theirPublicCryptoKey1;
270  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV1;
271  * operationVerifyZKP.hash = theirHash1;
272  * operationVerifyZKP.r = theirR1;
273  *
274  * result = ECJPAKE_verifyZKP(handle, &operationVerifyZKP);
275  *
276  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
277  * operationVerifyZKP.curve = &ECCParams_NISTP256;
278  * operationVerifyZKP.theirGenerator = NULL;
279  * operationVerifyZKP.theirPublicKey = &theirPublicCryptoKey2;
280  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV2;
281  * operationVerifyZKP.hash = theirHash2;
282  * operationVerifyZKP.r = theirR2;
283  *
284  * result = ECJPAKE_verifyZKP(handle,&operationVerifyZKP);
285  *
286  * // Round two starts now
287  *
288  * // Generate my round two keys
289  * ECJPAKE_OperationRoundTwoGenerateKeys_init(&operationRoundTwoGenerateKeys);
290  * operationRoundTwoGenerateKeys.curve = &ECCParams_NISTP256;
291  * operationRoundTwoGenerateKeys.myPrivateKey2 = &myPrivateCryptoKey2;
292  * operationRoundTwoGenerateKeys.myPublicKey1 = &myPublicCryptoKey1;
293  * operationRoundTwoGenerateKeys.myPublicKey2 = &myPublicCryptoKey2;
294  * operationRoundTwoGenerateKeys.theirPublicKey1 = &theirPublicCryptoKey1;
295  * operationRoundTwoGenerateKeys.theirPublicKey2 = &theirPublicCryptoKey2;
296  * operationRoundTwoGenerateKeys.preSharedSecret = &preSharedSecretCryptoKey;
297  * operationRoundTwoGenerateKeys.theirNewGenerator = &theirGeneratorKey;
298  * operationRoundTwoGenerateKeys.myNewGenerator = &myGeneratorKey;
299  * operationRoundTwoGenerateKeys.myCombinedPrivateKey = &myCombinedPrivateKey;
300  * operationRoundTwoGenerateKeys.myCombinedPublicKey = &myCombinedPublicKey;
301  * operationRoundTwoGenerateKeys.myPrivateV = &myPrivateCryptoV3;
302  * operationRoundTwoGenerateKeys.myPublicV = &myPublicCryptoV3;
303  *
304  * result = ECJPAKE_roundTwoGenerateKeys(handle, &operationRoundTwoGenerateKeys);
305  *
306  * // Generate my round two ZKP
307  * // Generate the round two hash here
308  *
309  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
310  * operationGenerateZKP.curve = &ECCParams_NISTP256;
311  * operationGenerateZKP.myPrivateKey = &myCombinedPrivateKey;
312  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV3;
313  * operationGenerateZKP.hash = myHash3;
314  * operationGenerateZKP.r = myR3;
315  *
316  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
317  *
318  * // Exchange keys and ZKPs again
319  *
320  * // Verify their second round ZKP
321  * // Generate their round two hash here
322  *
323  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
324  * operationVerifyZKP.curve = &ECCParams_NISTP256;
325  * operationVerifyZKP.theirGenerator = &theirGeneratorKey;
326  * operationVerifyZKP.theirPublicKey = &theirCombinedPublicKey;
327  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV3;
328  * operationVerifyZKP.hash = theirHash3;
329  * operationVerifyZKP.r = theirR3;
330  *
331  * result = ECJPAKE_verifyZKP(handle, &operationVerifyZKP);
332  *
333  * // Generate shared secret
334  * ECJPAKE_OperationComputeSharedSecret_init(&operationComputeSharedSecret);
335  * operationComputeSharedSecret.curve = &ECCParams_NISTP256;
336  * operationComputeSharedSecret.myCombinedPrivateKey = &myCombinedPrivateKey;
337  * operationComputeSharedSecret.theirCombinedPublicKey = &theirCombinedPublicKey;
338  * operationComputeSharedSecret.theirPublicKey2 = &theirPublicCryptoKey2;
339  * operationComputeSharedSecret.myPrivateKey2 = &myPrivateCryptoKey2;
340  * operationComputeSharedSecret.sharedSecret = &sharedSecretCryptoKey;
341  *
342  * result = ECJPAKE_computeSharedSecret(handle, &operationComputeSharedSecret);
343  *
344  * // Close the driver
345  * ECJPAKE_close(handle);
346  * @endcode
347  *
348  * @anchor ti_drivers_ECJPAKE_Examples
349  * # Examples #
350  *
351  * ## Basic ECJPAKE exchange #
352  *
353  * @code
354  *
355  * #define NISTP256_CURVE_LENGTH_BYTES 32
356  * #define OCTET_STRING_OFFSET 1
357  * #define NISTP256_PRIVATE_KEY_LENGTH_BYTES NISTP256_CURVE_LENGTH_BYTES
358  * #define NISTP256_PUBLIC_KEY_LENGTH_BYTES (NISTP256_CURVE_LENGTH_BYTES * 2 + OCTET_STRING_OFFSET)
359  *
360  * // My fixed keying material
361  * uint8_t myPrivateKeyMaterial1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
362  * uint8_t myPrivateKeyMaterial2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
363  * uint8_t myPrivateVMaterial1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
364  * uint8_t myPrivateVMaterial2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
365  * uint8_t myPrivateVMaterial3[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
366  * uint8_t myHash1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
367  * uint8_t myHash2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
368  * uint8_t myHash3[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
369  * // My derived keying material
370  * uint8_t myR1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
371  * uint8_t myR2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
372  * uint8_t myR3[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
373  * uint8_t myPublicKeyMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
374  * uint8_t myPublicKeyMaterial2[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
375  * uint8_t myPublicVMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
376  * uint8_t myPublicVMaterial2[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
377  * uint8_t myPublicVMaterial3[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
378  * uint8_t myCombinedPublicKeyMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
379  * uint8_t myCombinedPrivateKeyMaterial1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
380  * uint8_t myGenerator[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
381  *
382  * // Their fixed keying material
383  * uint8_t theirHash1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
384  * uint8_t theirHash2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
385  * uint8_t theirHash3[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
386  *
387  * // Their derived keying material
388  * uint8_t theirR1[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
389  * uint8_t theirR2[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
390  * uint8_t theirR3[NISTP256_PRIVATE_KEY_LENGTH_BYTES];
391  * uint8_t theirPublicKeyMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
392  * uint8_t theirPublicKeyMaterial2[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
393  * uint8_t theirPublicVMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
394  * uint8_t theirPublicVMaterial2[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
395  * uint8_t theirPublicVMaterial3[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
396  * uint8_t theirCombinedPublicKeyMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
397  * uint8_t theirGenerator[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
398  *
399  * // Shared secrets
400  * uint8_t preSharedSecretKeyingMaterial[NISTP256_PRIVATE_KEY_LENGTH_BYTES] = "This is our password";
401  * uint8_t sharedSecretKeyingMaterial1[NISTP256_PUBLIC_KEY_LENGTH_BYTES];
402  *
403  * // Pre-Shared Secret Key
404  * CryptoKey preSharedSecretCryptoKey;
405  *
406  * // Final shared secret keys
407  * CryptoKey sharedSecretCryptoKey;
408  *
409  * // My's keys
410  * CryptoKey myPrivateCryptoKey1;
411  * CryptoKey myPrivateCryptoKey2;
412  * CryptoKey myPrivateCryptoV1;
413  * CryptoKey myPrivateCryptoV2;
414  * CryptoKey myPrivateCryptoV3;
415  * CryptoKey myCombinedPrivateKey;
416  *
417  * CryptoKey myPublicCryptoKey1;
418  * CryptoKey myPublicCryptoKey2;
419  * CryptoKey myPublicCryptoV1;
420  * CryptoKey myPublicCryptoV2;
421  * CryptoKey myPublicCryptoV3;
422  * CryptoKey myCombinedPublicKey;
423  * CryptoKey myGeneratorKey;
424  *
425  * // Their's Keys
426  * CryptoKey theirPublicCryptoKey1;
427  * CryptoKey theirPublicCryptoKey2;
428  * CryptoKey theirPublicCryptoV1;
429  * CryptoKey theirPublicCryptoV2;
430  * CryptoKey theirPublicCryptoV3;
431  * CryptoKey theirCombinedPublicKey;
432  * CryptoKey theirGeneratorKey;
433  *
434  * // NISTP256 generator
435  * CryptoKeyPlaintext_initKey(NULL, ECCParams_NISTP256.generatorX, sizeof(ECCParams_NISTP256.length * 2));
436  *
437  * // Pre-shared secret
438  * CryptoKeyPlaintext_initKey(&preSharedSecretCryptoKey, preSharedSecretKeyingMaterial, sizeof(preSharedSecretKeyingMaterial));
439  *
440  * // Final shared secret key
441  * CryptoKeyPlaintext_initKey(&sharedSecretCryptoKey, sharedSecretKeyingMaterial1, sizeof(sharedSecretKeyingMaterial1));
442  * CryptoKeyPlaintext_initKey(&sharedSecretCryptoKey2, sharedSecretKeyingMaterial2, sizeof(sharedSecretKeyingMaterial2));
443  *
444  *
445  * // My keys
446  *
447  * // This example assumes that the private keying material buffers already
448  * // contains random bytes. Otherwise, we need to use a TRNG or DRBG to fill
449  * // them after initialising the CryptoKeys.
450  * CryptoKeyPlaintext_initKey(&myPrivateCryptoKey1, myPrivateKeyMaterial1, sizeof(myPrivateKeyMaterial1));
451  * CryptoKeyPlaintext_initKey(&myPrivateCryptoKey2, myPrivateKeyMaterial2, sizeof(myPrivateKeyMaterial2));
452  * CryptoKeyPlaintext_initKey(&myPrivateCryptoV1, myPrivateVMaterial1, sizeof(myPrivateVMaterial1));
453  * CryptoKeyPlaintext_initKey(&myPrivateCryptoV2, myPrivateVMaterial2, sizeof(myPrivateVMaterial2));
454  * CryptoKeyPlaintext_initKey(&myPrivateCryptoV3, myPrivateVMaterial3, sizeof(myPrivateVMaterial3));
455  *
456  * CryptoKeyPlaintext_initBlankKey(&myPublicCryptoKey1, myPublicKeyMaterial1, sizeof(myPublicKeyMaterial1));
457  * CryptoKeyPlaintext_initBlankKey(&myPublicCryptoKey2, myPublicKeyMaterial2, sizeof(myPublicKeyMaterial2));
458  * CryptoKeyPlaintext_initBlankKey(&myPublicCryptoV1, myPublicVMaterial1, sizeof(myPublicVMaterial1));
459  * CryptoKeyPlaintext_initBlankKey(&myPublicCryptoV2, myPublicVMaterial2, sizeof(myPublicVMaterial2));
460  * CryptoKeyPlaintext_initBlankKey(&myPublicCryptoV3, myPublicVMaterial3, sizeof(myPublicVMaterial3));
461  * CryptoKeyPlaintext_initBlankKey(&myCombinedPrivateKey, myCombinedPrivateKeyMaterial1, sizeof(myCombinedPrivateKeyMaterial1));
462  * CryptoKeyPlaintext_initBlankKey(&myCombinedPublicKey, myCombinedPublicKeyMaterial1, sizeof(myCombinedPublicKeyMaterial1));
463  * CryptoKeyPlaintext_initBlankKey(&myGeneratorKey, myGenerator, sizeof(myGenerator));
464  *
465  * // Their keys
466  * CryptoKeyPlaintext_initBlankKey(&theirPublicCryptoKey1, theirPublicKeyMaterial1, sizeof(theirPublicKeyMaterial1));
467  * CryptoKeyPlaintext_initBlankKey(&theirPublicCryptoKey2, theirPublicKeyMaterial2, sizeof(theirPublicKeyMaterial2));
468  * CryptoKeyPlaintext_initBlankKey(&theirPublicCryptoV1, theirPublicVMaterial1, sizeof(theirPublicVMaterial1));
469  * CryptoKeyPlaintext_initBlankKey(&theirPublicCryptoV2, theirPublicVMaterial2, sizeof(theirPublicVMaterial2));
470  * CryptoKeyPlaintext_initBlankKey(&theirPublicCryptoV3, theirPublicVMaterial3, sizeof(theirPublicVMaterial3));
471  * CryptoKeyPlaintext_initBlankKey(&theirCombinedPublicKey, theirCombinedPublicKeyMaterial1, sizeof(theirCombinedPublicKeyMaterial1));
472  * CryptoKeyPlaintext_initBlankKey(&theirGeneratorKey, theirGenerator, sizeof(theirGenerator));
473  *
474  * // Initial driver setup
475  * ECJPAKE_Params params;
476  * ECJPAKE_Params_init(&params);
477  *
478  *
479  * ECJPAKE_Handle handle = ECJPAKE_open(0, &params);
480  *
481  * ECJPAKE_OperationRoundOneGenerateKeys operationRoundOneGenerateKeys;
482  * ECJPAKE_OperationRoundTwoGenerateKeys operationRoundTwoGenerateKeys;
483  * ECJPAKE_OperationGenerateZKP operationGenerateZKP;
484  * ECJPAKE_OperationVerifyZKP operationVerifyZKP;
485  * ECJPAKE_OperationComputeSharedSecret operationComputeSharedSecret;
486  *
487  * // Generate my round one keys
488  * ECJPAKE_OperationRoundOneGenerateKeys_init(&operationRoundOneGenerateKeys);
489  * operationRoundOneGenerateKeys.curve = &ECCParams_NISTP256;
490  * operationRoundOneGenerateKeys.myPrivateKey1 = &myPrivateCryptoKey1;
491  * operationRoundOneGenerateKeys.myPrivateKey2 = &myPrivateCryptoKey2;
492  * operationRoundOneGenerateKeys.myPublicKey1 = &myPublicCryptoKey1;
493  * operationRoundOneGenerateKeys.myPublicKey2 = &myPublicCryptoKey2;
494  * operationRoundOneGenerateKeys.myPrivateV1 = &myPrivateCryptoV1;
495  * operationRoundOneGenerateKeys.myPrivateV2 = &myPrivateCryptoV2;
496  * operationRoundOneGenerateKeys.myPublicV1 = &myPublicCryptoV1;
497  * operationRoundOneGenerateKeys.myPublicV2 = &myPublicCryptoV2;
498  *
499  * int_fast16_t result = ECJPAKE_roundOneGenerateKeys(handle, &operationRoundOneGenerateKeys);
500  *
501  * if (result != ECJPAKE_STATUS_SUCCESS) {
502  * while(1);
503  * }
504  *
505  * // Generate hashes here
506  *
507  * // generate my round one ZKPs
508  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
509  * operationGenerateZKP.curve = &ECCParams_NISTP256;
510  * operationGenerateZKP.myPrivateKey = &myPrivateCryptoKey1;
511  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV1;
512  * operationGenerateZKP.hash = myHash1;
513  * operationGenerateZKP.r = myR1;
514  *
515  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
516  *
517  * if (result != ECJPAKE_STATUS_SUCCESS) {
518  * while(1);
519  * }
520  *
521  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
522  * operationGenerateZKP.curve = &ECCParams_NISTP256;
523  * operationGenerateZKP.myPrivateKey = &myPrivateCryptoKey2;
524  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV2;
525  * operationGenerateZKP.hash = myHash2;
526  * operationGenerateZKP.r = myR2;
527  *
528  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
529  *
530  * if (result != ECJPAKE_STATUS_SUCCESS) {
531  * while(1);
532  * }
533  *
534  * // Do ZKP and key transmission here
535  *
536  * // Verify their round one ZKPs
537  * // Generate their hashes here
538  *
539  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
540  * operationVerifyZKP.curve = &ECCParams_NISTP256;
541  * operationVerifyZKP.theirGenerator = NULL;
542  * operationVerifyZKP.theirPublicKey = &theirPublicCryptoKey1;
543  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV1;
544  * operationVerifyZKP.hash = theirHash1;
545  * operationVerifyZKP.r = theirR1;
546  *
547  * result = ECJPAKE_verifyZKP(handle, &operationVerifyZKP);
548  *
549  * if (result != ECJPAKE_STATUS_SUCCESS) {
550  * while(1);
551  * }
552  *
553  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
554  * operationVerifyZKP.curve = &ECCParams_NISTP256;
555  * operationVerifyZKP.theirGenerator = NULL;
556  * operationVerifyZKP.theirPublicKey = &theirPublicCryptoKey2;
557  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV2;
558  * operationVerifyZKP.hash = theirHash2;
559  * operationVerifyZKP.r = theirR2;
560  *
561  * result = ECJPAKE_verifyZKP(handle,&operationVerifyZKP);
562  *
563  * if (result != ECJPAKE_STATUS_SUCCESS) {
564  * while(1);
565  * }
566  *
567  * // Round two starts now
568  *
569  * // Generate my round two keys
570  * ECJPAKE_OperationRoundTwoGenerateKeys_init(&operationRoundTwoGenerateKeys);
571  * operationRoundTwoGenerateKeys.curve = &ECCParams_NISTP256;
572  * operationRoundTwoGenerateKeys.myPrivateKey2 = &myPrivateCryptoKey2;
573  * operationRoundTwoGenerateKeys.myPublicKey1 = &myPublicCryptoKey1;
574  * operationRoundTwoGenerateKeys.myPublicKey2 = &myPublicCryptoKey2;
575  * operationRoundTwoGenerateKeys.theirPublicKey1 = &theirPublicCryptoKey1;
576  * operationRoundTwoGenerateKeys.theirPublicKey2 = &theirPublicCryptoKey2;
577  * operationRoundTwoGenerateKeys.preSharedSecret = &preSharedSecretCryptoKey;
578  * operationRoundTwoGenerateKeys.theirNewGenerator = &theirGeneratorKey;
579  * operationRoundTwoGenerateKeys.myNewGenerator = &myGeneratorKey;
580  * operationRoundTwoGenerateKeys.myCombinedPrivateKey = &myCombinedPrivateKey;
581  * operationRoundTwoGenerateKeys.myCombinedPublicKey = &myCombinedPublicKey;
582  * operationRoundTwoGenerateKeys.myPrivateV = &myPrivateCryptoV3;
583  * operationRoundTwoGenerateKeys.myPublicV = &myPublicCryptoV3;
584  *
585  * result = ECJPAKE_roundTwoGenerateKeys(handle, &operationRoundTwoGenerateKeys);
586  *
587  * // Generate my round two ZKP
588  * // Generate the round two hash here
589  *
590  * ECJPAKE_OperationGenerateZKP_init(&operationGenerateZKP);
591  * operationGenerateZKP.curve = &ECCParams_NISTP256;
592  * operationGenerateZKP.myPrivateKey = &myCombinedPrivateKey;
593  * operationGenerateZKP.myPrivateV = &myPrivateCryptoV3;
594  * operationGenerateZKP.hash = myHash3;
595  * operationGenerateZKP.r = myR3;
596  *
597  * result = ECJPAKE_generateZKP(handle, &operationGenerateZKP);
598  *
599  * if (result != ECJPAKE_STATUS_SUCCESS) {
600  * while(1);
601  * }
602  *
603  * // Exchange keys and ZKPs again
604  *
605  * // Verify their second round ZKP
606  * // Generate their round two hash here
607  *
608  * ECJPAKE_OperationVerifyZKP_init(&operationVerifyZKP);
609  * operationVerifyZKP.curve = &ECCParams_NISTP256;
610  * operationVerifyZKP.theirGenerator = &theirGeneratorKey;
611  * operationVerifyZKP.theirPublicKey = &theirCombinedPublicKey;
612  * operationVerifyZKP.theirPublicV = &theirPublicCryptoV3;
613  * operationVerifyZKP.hash = theirHash3;
614  * operationVerifyZKP.r = theirR3;
615  *
616  * result = ECJPAKE_verifyZKP(handle, &operationVerifyZKP);
617  *
618  * if (result != ECJPAKE_STATUS_SUCCESS) {
619  * while(1);
620  * }
621  *
622  *
623  * // Generate shared secret
624  * ECJPAKE_OperationComputeSharedSecret_init(&operationComputeSharedSecret);
625  * operationComputeSharedSecret.curve = &ECCParams_NISTP256;
626  * operationComputeSharedSecret.myCombinedPrivateKey = &myCombinedPrivateKey;
627  * operationComputeSharedSecret.theirCombinedPublicKey = &theirCombinedPublicKey;
628  * operationComputeSharedSecret.theirPublicKey2 = &theirPublicCryptoKey2;
629  * operationComputeSharedSecret.myPrivateKey2 = &myPrivateCryptoKey2;
630  * operationComputeSharedSecret.sharedSecret = &sharedSecretCryptoKey;
631  *
632  * result = ECJPAKE_computeSharedSecret(handle, &operationComputeSharedSecret);
633  *
634  * if (result != ECJPAKE_STATUS_SUCCESS) {
635  * while(1);
636  * }
637  *
638  * // Run sharedSecretCryptoKey through a key derivation function and
639  * // confirm to the other party that we have derived the same key
640  *
641  *
642  * @endcode
643  *
644  *
645  */
646 
647 
648 #ifndef ti_drivers_ECJPAKE__include
649 #define ti_drivers_ECJPAKE__include
650 
651 #include <stdbool.h>
652 #include <stddef.h>
653 #include <stdint.h>
654 
657 
658 #ifdef __cplusplus
659 extern "C" {
660 #endif
661 
674 #define ECJPAKE_STATUS_RESERVED (-32)
675 
682 #define ECJPAKE_STATUS_SUCCESS (0)
683 
690 #define ECJPAKE_STATUS_ERROR (-1)
691 
700 #define ECJPAKE_STATUS_RESOURCE_UNAVAILABLE (-2)
701 
707 #define ECJPAKE_STATUS_INVALID_PUBLIC_KEY (-3)
708 
715 #define ECJPAKE_STATUS_PUBLIC_KEY_NOT_ON_CURVE (-4)
716 
724 #define ECJPAKE_STATUS_PUBLIC_KEY_LARGER_THAN_PRIME (-5)
725 
732 #define ECJPAKE_STATUS_POINT_AT_INFINITY (-6)
733 
740 #define ECJPAKE_STATUS_INVALID_PRIVATE_KEY (-7)
741 
748 #define ECJPAKE_STATUS_INVALID_PRIVATE_V (-8)
749 
753 #define ECJPAKE_STATUS_CANCELED (-9)
754 
766 typedef struct {
768  void *object;
769 
771  void const *hwAttrs;
773 
778 
800 typedef enum {
816 
820 typedef struct {
875 
879 typedef struct {
892  const uint8_t *hash;
896  uint8_t *r;
900 
904 typedef struct {
924  const uint8_t *hash;
927  const uint8_t *r;
931 
935 typedef struct {
1003 
1007 typedef struct {
1031 
1032 
1036 typedef union {
1043 
1047 typedef enum {
1054 
1073 typedef void (*ECJPAKE_CallbackFxn) (ECJPAKE_Handle handle,
1074  int_fast16_t returnStatus,
1075  ECJPAKE_Operation operation,
1076  ECJPAKE_OperationType operationType);
1077 
1086 typedef struct {
1089  uint32_t timeout;
1092  void *custom;
1095 } ECJPAKE_Params;
1096 
1105 void ECJPAKE_init(void);
1106 
1116 
1126 
1136 
1146 
1147 
1157 
1167 void ECJPAKE_close(ECJPAKE_Handle handle);
1168 
1186 ECJPAKE_Handle ECJPAKE_open(uint_least8_t index, ECJPAKE_Params *params);
1187 
1200 void ECJPAKE_Params_init(ECJPAKE_Params *params);
1201 
1227 int_fast16_t ECJPAKE_roundOneGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundOneGenerateKeys *operation);
1228 
1261 int_fast16_t ECJPAKE_generateZKP(ECJPAKE_Handle handle, ECJPAKE_OperationGenerateZKP *operation);
1262 
1286 int_fast16_t ECJPAKE_verifyZKP(ECJPAKE_Handle handle, ECJPAKE_OperationVerifyZKP *operation);
1287 
1311 int_fast16_t ECJPAKE_roundTwoGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundTwoGenerateKeys *operation);
1312 
1338 int_fast16_t ECJPAKE_computeSharedSecret(ECJPAKE_Handle handle, ECJPAKE_OperationComputeSharedSecret *operation);
1339 
1353 int_fast16_t ECJPAKE_cancelOperation(ECJPAKE_Handle handle);
1354 
1378 ECJPAKE_Handle ECJPAKE_construct(ECJPAKE_Config *config, const ECJPAKE_Params *params);
1379 
1380 #ifdef __cplusplus
1381 }
1382 #endif
1383 
1384 #endif /* ti_drivers_ECJPAKE__include */
Struct containing the parameters required to generate a ZKP.
Definition: ECJPAKE.h:879
const CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:939
CryptoKey * myPublicKey2
Definition: ECJPAKE.h:837
The CryptoKey type is an opaque representation of a cryptographic key.
const uint8_t * hash
Definition: ECJPAKE.h:892
CryptoKey * myPrivateKey1
Definition: ECJPAKE.h:824
int_fast16_t ECJPAKE_computeSharedSecret(ECJPAKE_Handle handle, ECJPAKE_OperationComputeSharedSecret *operation)
Computes the shared secret.
ECJPAKE_OperationType
Enum for the operation types supported by the driver.
Definition: ECJPAKE.h:1047
CryptoKey * myPublicV2
Definition: ECJPAKE.h:865
void * object
Definition: ECJPAKE.h:768
void ECJPAKE_OperationVerifyZKP_init(ECJPAKE_OperationVerifyZKP *operation)
Function to initialize an ECJPAKE_OperationVerifyZKP struct to its defaults.
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:905
const CryptoKey * myCombinedPrivateKey
Definition: ECJPAKE.h:1011
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:821
ECJPAKE_ReturnBehavior returnBehavior
Definition: ECJPAKE.h:1087
void ECJPAKE_close(ECJPAKE_Handle handle)
Function to close an ECJPAKE peripheral specified by the ECJPAKE handle.
ECJPAKE_OperationComputeSharedSecret * computeSharedSecret
Definition: ECJPAKE.h:1041
const CryptoKey * theirGenerator
Definition: ECJPAKE.h:908
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:936
void ECJPAKE_OperationRoundOneGenerateKeys_init(ECJPAKE_OperationRoundOneGenerateKeys *operation)
Function to initialize an ECJPAKE_OperationRoundOneGenerateKeys struct to its defaults.
ECJPAKE_OperationRoundOneGenerateKeys * generateRoundOneKeys
Definition: ECJPAKE.h:1037
int_fast16_t ECJPAKE_roundTwoGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundTwoGenerateKeys *operation)
Generates all public and private keying material for the first round of the EC-JPAKE scheme...
const CryptoKey * theirCombinedPublicKey
Definition: ECJPAKE.h:1015
void ECJPAKE_OperationRoundTwoGenerateKeys_init(ECJPAKE_OperationRoundTwoGenerateKeys *operation)
Function to initialize an ECJPAKE_OperationRoundTwoGenerateKeys struct to its defaults.
int_fast16_t ECJPAKE_cancelOperation(ECJPAKE_Handle handle)
Cancels an ongoing ECJPAKE operation.
CryptoKey datastructure.
Definition: CryptoKey.h:209
Struct containing the parameters required to generate the second round keys.
Definition: ECJPAKE.h:935
Struct containing the parameters required to compute the shared secret.
Definition: ECJPAKE.h:1007
void(* ECJPAKE_CallbackFxn)(ECJPAKE_Handle handle, int_fast16_t returnStatus, ECJPAKE_Operation operation, ECJPAKE_OperationType operationType)
The definition of a callback function used by the ECJPAKE driver when used in ECJPAKE_RETURN_BEHAVIOR...
Definition: ECJPAKE.h:1073
int_fast16_t ECJPAKE_verifyZKP(ECJPAKE_Handle handle, ECJPAKE_OperationVerifyZKP *operation)
Verifies a Schnorr Zero-Knowledge Proof (ZKP) signature.
void ECJPAKE_init(void)
This function initializes the ECJPAKE module.
void * custom
Definition: ECJPAKE.h:1092
CryptoKey * myPublicV1
Definition: ECJPAKE.h:856
const CryptoKey * myPublicKey2
Definition: ECJPAKE.h:946
const CryptoKey * myPublicKey1
Definition: ECJPAKE.h:943
const CryptoKey * myPrivateKey
Definition: ECJPAKE.h:883
ECJPAKE Parameters.
Definition: ECJPAKE.h:1086
CryptoKey * myCombinedPublicKey
Definition: ECJPAKE.h:983
Struct containing the parameters required to generate the first round of keys.
Definition: ECJPAKE.h:820
Definition: ECJPAKE.h:811
CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:828
int_fast16_t ECJPAKE_generateZKP(ECJPAKE_Handle handle, ECJPAKE_OperationGenerateZKP *operation)
Generates the r component of a Schnorr Zero-Knowledge Proof (ZKP) signature.
ECJPAKE_CallbackFxn callbackFxn
Definition: ECJPAKE.h:1088
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:880
const CryptoKey * preSharedSecret
Definition: ECJPAKE.h:955
CryptoKey * myNewGenerator
Definition: ECJPAKE.h:971
const CryptoKey * theirPublicKey1
Definition: ECJPAKE.h:949
ECJPAKE Global configuration.
Definition: ECJPAKE.h:766
CryptoKey * myPublicKey1
Definition: ECJPAKE.h:832
ECJPAKE_Handle ECJPAKE_construct(ECJPAKE_Config *config, const ECJPAKE_Params *params)
Constructs a new ECJPAKE object.
const CryptoKey * myPrivateV
Definition: ECJPAKE.h:887
CryptoKey * theirNewGenerator
Definition: ECJPAKE.h:964
const uint8_t * r
Definition: ECJPAKE.h:927
const CryptoKey * theirPublicKey2
Definition: ECJPAKE.h:1018
void const * hwAttrs
Definition: ECJPAKE.h:771
Definition: ECJPAKE.h:1050
CryptoKey * myPrivateV
Definition: ECJPAKE.h:986
CryptoKey * myCombinedPrivateKey
Definition: ECJPAKE.h:978
Definition: ECJPAKE.h:801
const uint8_t * hash
Definition: ECJPAKE.h:924
void ECJPAKE_Params_init(ECJPAKE_Params *params)
Function to initialize the ECJPAKE_Params struct to its defaults.
const CryptoKey * theirPublicKey2
Definition: ECJPAKE.h:952
Struct containing the parameters required to verify a ZKP.
Definition: ECJPAKE.h:904
ECJPAKE_OperationRoundTwoGenerateKeys * generateRoundTwoKeys
Definition: ECJPAKE.h:1040
CryptoKey * sharedSecret
Definition: ECJPAKE.h:1027
int_fast16_t ECJPAKE_roundOneGenerateKeys(ECJPAKE_Handle handle, ECJPAKE_OperationRoundOneGenerateKeys *operation)
Generates all public and private keying material for the first round of the EC-JPAKE scheme...
Definition: ECJPAKE.h:807
const CryptoKey * myPrivateKey2
Definition: ECJPAKE.h:1023
ECJPAKE_OperationGenerateZKP * generateZKP
Definition: ECJPAKE.h:1038
Definition: ECJPAKE.h:1049
A structure containing the parameters of an elliptic curve in short Weierstrass form.
Definition: ECCParams.h:120
uint32_t timeout
Definition: ECJPAKE.h:1089
ECJPAKE_ReturnBehavior
The way in which ECJPAKE function calls return after performing an encryption + authentication or dec...
Definition: ECJPAKE.h:800
CryptoKey * myPrivateV2
Definition: ECJPAKE.h:849
CryptoKey * myPrivateV1
Definition: ECJPAKE.h:842
const CryptoKey * theirPublicV
Definition: ECJPAKE.h:921
CryptoKey * myPublicV
Definition: ECJPAKE.h:993
const CryptoKey * theirPublicKey
Definition: ECJPAKE.h:917
ECJPAKE_OperationVerifyZKP * verifyZKP
Definition: ECJPAKE.h:1039
Union containing pointers to all supported operation structs.
Definition: ECJPAKE.h:1036
ECJPAKE_Handle ECJPAKE_open(uint_least8_t index, ECJPAKE_Params *params)
This function opens a given ECJPAKE peripheral.
const ECCParams_CurveParams * curve
Definition: ECJPAKE.h:1008
ECJPAKE_Config * ECJPAKE_Handle
A handle that is returned from an ECJPAKE_open() call.
Definition: ECJPAKE.h:777
void ECJPAKE_OperationGenerateZKP_init(ECJPAKE_OperationGenerateZKP *operation)
Function to initialize an ECJPAKE_OperationGenerateZKP struct to its defaults.
uint8_t * r
Definition: ECJPAKE.h:896
void ECJPAKE_OperationComputeSharedSecret_init(ECJPAKE_OperationComputeSharedSecret *operation)
Function to initialize an ECJPAKE_OperationComputeSharedSecret struct to its defaults.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale