ECDH.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2022, 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 ECDH.h
34  *
35  * @brief TI Driver for Elliptic Curve Diffie-Hellman key agreement scheme.
36  *
37  * @anchor ti_drivers_ECDH_Overview
38  * # Overview #
39  *
40  * Elliptic Curve Diffie-Hellman (ECDH) is a key agreement scheme between
41  * two parties based on the Diffie-Hellman key exchange protocol.
42  *
43  * It provides a means of generating a shared secret and derived symmetric key
44  * between the two parties over an insecure channel.
45  *
46  * It does not provide authentication. As such, it does not guarantee that the
47  * party you are exchanging keys with is truly the party you wish to establish a
48  * secured channel with.
49  *
50  * The two parties each generate a private key and a public key. The private key
51  * is a random integer in the interval [1, n - 1], where n is the order of a
52  * previously agreed upon curve. The public key is generated
53  * by multiplying the private key by the generator point of a previously agreed
54  * upon elliptic curve such as NISTP256 or Curve 25519. The public key is itself
55  * a point upon the elliptic curve. Each public key is then transmitted to the
56  * other party over a potentially insecure channel. The other party's public key
57  * is then multiplied with the private key, generating a shared secret. This
58  * shared secret is also a point on the curve. However, the entropy in the secret
59  * is not spread evenly throughout the shared secret. In order to generate one or more
60  * shared symmetric keys, the shared secret must be run through a key derivation
61  * function (KDF) that was previously agreed upon. Usually, only the X coordinate
62  * is processed in this way as it contains all the entropy of the shared secret and
63  * some curve implementations only provide the X coordinate. The key derivation function
64  * can take many forms, from simply hashing the X coordinate of the shared secret
65  * with SHA2 and truncating the result to generating multiple symmetric keys with
66  * HKDF, an HMAC based KDF.
67  *
68  * Key derivation functions in the context of symmetric key generation after
69  * elliptic curve based key exchange differ from KDFs used to generate keys from
70  * passwords a user provides in a login. Those KDFs such as bcrypt purposefully
71  * add additional computation to increase a system's resistance against brute
72  * force or dictionary attacks.
73  *
74  * @anchor ti_drivers_ECDH_Usage
75  * # Usage #
76  *
77  * ## Before starting an ECDH operation #
78  *
79  * Before starting an ECDH operation, the application must do the following:
80  * - Call ECDH_init() to initialize the driver
81  * - Call ECDH_Params_init() to initialize the ECDH_Params to default values.
82  * - Modify the ECDH_Params as desired
83  * - Call ECDH_open() to open an instance of the driver
84  *
85  * ## Generating your public-private key pair #
86  * To generate a public-private key pair for an agreed upon curve, the application
87  * must do the following:
88  * - Generate the keying material for the private key. This keying material must
89  * be an integer in the interval [1, n - 1], where n is the order of the curve.
90  * It can be stored in big-endian or little-endian format.
91  * The array should be the same length as the curve parameters of the curve used.
92  * The driver validates private keys against the provided curve by default.
93  * - Initialize the private key CryptoKey. CryptoKeys are opaque data structures and representations
94  * of keying material and its storage. Depending on how the keying material
95  * is stored (RAM or flash, key store), the CryptoKey must be
96  * initialized differently. The ECDH API can handle all types of CryptoKey.
97  * However, not all device-specific implementations support all types of CryptoKey.
98  * Devices without a key store will not support CryptoKeys with keying material
99  * stored in a key store for example.
100  * All devices support plaintext CryptoKeys.
101  * - Initialize a blank CryptoKey for the public key. The CryptoKey will keep track
102  * of where the keying material for the public key should be copied and how
103  * long it is. SEC 1-based big-endian format public keys should have key material twice the length
104  * of the private key plus one. Little-endian format public keys should have key material the
105  * length of the private key for Montgomery curve X-only public keys or have key material twice
106  * the length of the private for other curves
107  * - Initialize the ECDH_OperationGeneratePublicKey struct and then populate it. By
108  * default, big-endian public keys will be generated.
109  * - If using RFC 7748-style public keys, initialize the operation's public key
110  * data format to be ECDH_LITTLE_ENDIAN_KEY.
111  * - Call ECDH_generatePublicKey(). The generated keying material will be copied
112  * according the the CryptoKey passed in as the public key parameter. The CryptoKey
113  * will no longer be considered 'blank' after the operation.
114  *
115  * ## Calculating a shared secret #
116  * After trading public keys with the other party, the application should do the following
117  * to calculate the shared secret:
118  * - Initialize a CryptoKey as public key with the keying material received from the other
119  * party.
120  * - Initialize the private key CryptoKey with the key used to generate your
121  * public key. CryptoKeys are opaque data structures and representations
122  * of keying material and its storage. Depending on how the keying material
123  * is stored (RAM or flash, key store), the CryptoKey must be
124  * initialized differently. The ECDH API can handle all types of CryptoKey.
125  * However, not all device-specific implementations support all types of CryptoKey.
126  * Devices without a key store will not support CryptoKeys with keying material
127  * stored in a key store for example.
128  * All devices support plaintext CryptoKeys.
129  * - Initialize a blank CryptoKey with the same size as the previously initialized
130  * public key.
131  * - Initialize the ECDH_OperationComputeSharedSecret struct and then populate it. By
132  * default, big-endian input keys will be assumed and big-endian shared secrets
133  * will be generated.
134  * - If importing RFC 7748-style public keys, initialize the operation's key material
135  * endianess to be ECDH_LITTLE_ENDIAN_KEY.
136  * - Call ECDH_computeSharedSecret(). The shared secret will be copied to a location
137  * according to the shared secret CryptoKey passed to the function call. The driver
138  * will validate the supplied public key and reject invalid ones.
139  *
140  * ## Creating one or more symmetric keys from the shared secret #
141  * After calculating the shared secret between the application and the other party,
142  * the entropy in the shared secret must be evened out and stretched as needed. There are
143  * uncountable methods and algorithms to stretch an original seed entropy (the share secret)
144  * to generate symmetric keys.
145  * - Run the X coordinate of the resulting entropy through a key derivation function (KDF)
146  *
147  * ## After a key exchange #
148  * After the ECDH key exchange completes, the application should either start another operation
149  * or close the driver by calling ECDH_close()
150  *
151  * ## General usage #
152  * The API expects elliptic curves as defined in ti/drivers/cryptoutils/ecc/ECCParams.h.
153  * Several commonly used curves are provided. Check the device-specific ECDH documentation
154  * for curve type (short Weierstrass, Montgomery, Edwards) support for your device.
155  * ECDH support for a curve type on a device does not imply curve-type support for
156  * other ECC schemes.
157  *
158  * ## Key Formatting
159  * By default, the ECDH API expects the private and public keys to be formatted in
160  * big-endian format. The details of octet string formatting can be found in
161  * SEC 1: Elliptic Curve Cryptography.
162  *
163  * Private keys can be formatted as big-endian or little-endian integers of the same
164  * length as the curve length.
165  *
166  * Public keys and shared secrets are points on an elliptic curve. These points can
167  * be expressed in several ways. The most common one is in affine coordinates as an
168  * X,Y pair.
169  * This API uses points expressed in uncompressed affine coordinates by default.
170  * The big-endian format requires a formatting byte in the first byte of the
171  * public key. When using uncompressed affine coordinates, this is the value
172  * 0x04.
173  * The point itself is stored as a concatenated array of X followed by Y.
174  * X and Y maybe in big-endian or little-endian. Some implementations do not require or
175  * yield the Y coordinate for ECDH on certain curves. It is recommended that the full
176  * keying material buffer of twice the curve param length is used to facilitate
177  * code-reuse. Implementations that do not use the Y coordinate will zero-out
178  * the Y-coordinate whenever they write a point to the CryptoKey.
179  *
180  * If device-supported, Montgomery curves can be stored as their X-only format
181  * based on the RFC-7748 specification. Here, only the X coordinate is packed
182  * in little-endian integers of the same length as the curve length.
183  *
184  * This API accepts and returns the keying material of public keys according
185  * to the following table:
186  *
187  * | Curve Type | Keying Material Array | Array Length |
188  * |--------------------|-----------------------|----------------------------|
189  * | Short Weierstrass | [0x04, X, Y] | 1 + 2 * Curve Param Length |
190  * | Montgomery | [0x04, X, Y] | 1 + 2 * Curve Param Length |
191  * | Montgomery | [X] | Curve Param Length |
192  * | Edwards | [0x04, X, Y] | 1 + 2 * Curve Param Length |
193  *
194  * Note: This driver will automatically prune the private key according to
195  * RFC 7748 for the following curve:
196  * X25519
197  *
198  * @anchor ti_drivers_ECDH_Synopsis
199  * ## Synopsis
200  * @anchor ti_drivers_ECDH_Synopsis_Code
201  * @code
202  * // Import ECDH Driver definitions
203  * #include <ti/drivers/ECDH.h>
204  *
205  * ECDH_init();
206  *
207  * // Since we are using default ECDH_Params, we just pass in NULL for that parameter.
208  * ecdhHandle = ECDH_open(0, NULL);
209  *
210  * // Initialize myPrivateKey and myPublicKey
211  * CryptoKeyPlaintext_initKey(&myPrivateKey, myPrivateKeyingMaterial, sizeof(myPrivateKeyingMaterial));
212  * CryptoKeyPlaintext_initBlankKey(&myPublicKey, myPublicKeyingMaterial, sizeof(myPublicKeyingMaterial));
213  *
214  * ECDH_OperationGeneratePublicKey_init(&operationGeneratePublicKey);
215  * operationGeneratePublicKey.curve = &ECCParams_NISTP256;
216  * operationGeneratePublicKey.myPrivateKey = &myPrivateKey;
217  * operationGeneratePublicKey.myPublicKey = &myPublicKey;
218  *
219  * // Generate the keying material for myPublicKey and store it in myPublicKeyingMaterial
220  * operationResult = ECDH_generatePublicKey(ecdhHandle, &operationGeneratePublicKey);
221  *
222  * // Now send the content of myPublicKeyingMaterial to the other party,
223  * // receive their public key, and copy their public keying material to theirPublicKeyingMaterial
224  *
225  * // Initialize their public CryptoKey and the shared secret CryptoKey
226  * CryptoKeyPlaintext_initKey(&theirPublicKey, theirPublicKeyingMaterial, sizeof(theirPublicKeyingMaterial));
227  * CryptoKeyPlaintext_initBlankKey(&sharedSecret, sharedSecretKeyingMaterial, sizeof(sharedSecretKeyingMaterial));
228  *
229  * // The ECC_NISTP256 struct is provided in ti/drivers/types/EccParams.h and the corresponding device-specific
230  * implementation ECDH_OperationComputeSharedSecret_init(&operationComputeSharedSecret);
231  * operationComputeSharedSecret.curve = &ECCParams_NISTP256;
232  * operationComputeSharedSecret.myPrivateKey = &myPrivateKey;
233  * operationComputeSharedSecret.theirPublicKey = &theirPublicKey;
234  * operationComputeSharedSecret.sharedSecret = &sharedSecret;
235  *
236  * // Compute the shared secret and copy it to sharedSecretKeyingMaterial
237  * operationResult = ECDH_computeSharedSecret(ecdhHandle, &operationComputeSharedSecret);
238  *
239  * // Close the driver
240  * ECDH_close(ecdhHandle);
241  *
242  * @endcode
243  *
244  * ## Synopsis for X25519 X-only key exchange
245  * @anchor ti_drivers_ECDH_X25519_Code
246  * @code
247  * // Import ECDH Driver definitions
248  * #include <ti/drivers/ECDH.h>
249  *
250  * ECDH_init();
251  *
252  * // Since we are using default ECDH_Params, we just pass in NULL for that parameter.
253  * ecdhHandle = ECDH_open(0, NULL);
254  *
255  * // Initialize myPrivateKey and myPublicKey
256  * CryptoKeyPlaintext_initKey(&myPrivateKey, myPrivateKeyingMaterial, sizeof(myPrivateKeyingMaterial));
257  * // Note that the public key size is only 32 bytes
258  * CryptoKeyPlaintext_initBlankKey(&myPublicKey, myPublicKeyingMaterial, sizeof(myPublicKeyingMaterial));
259  *
260  * ECDH_OperationGeneratePublicKey_init(&operationGeneratePublicKey);
261  * operationGeneratePublicKey.curve = &ECCParams_Curve25519;
262  * operationGeneratePublicKey.myPrivateKey = &myPrivateKey;
263  * operationGeneratePublicKey.myPublicKey = &myPublicKey;
264  * // If generating public key in little-endian format, we use the following format:
265  * operationGeneratePublicKey.keyMaterialEndianness = ECDH_LITTLE_ENDIAN_KEY;
266  *
267  * // Generate the keying material for myPublicKey and store it in myPublicKeyingMaterial
268  * operationResult = ECDH_generatePublicKey(ecdhHandle, &operationGeneratePublicKey);
269  *
270  * // Now send the content of myPublicKeyingMaterial to the other party,
271  * // receive their public key, and copy their public keying material to theirPublicKeyingMaterial
272  *
273  * // Initialize their public CryptoKey and the shared secret CryptoKey
274  * CryptoKeyPlaintext_initKey(&theirPublicKey, theirPublicKeyingMaterial, sizeof(theirPublicKeyingMaterial));
275  * CryptoKeyPlaintext_initBlankKey(&sharedSecret, sharedSecretKeyingMaterial, sizeof(sharedSecretKeyingMaterial));
276  *
277  * // The ECC_NISTP256 struct is provided in ti/drivers/types/EccParams.h and the corresponding device-specific
278  * implementation ECDH_OperationComputeSharedSecret_init(&operationComputeSharedSecret);
279  * operationComputeSharedSecret.curve = &ECCParams_Curve25519;
280  * operationComputeSharedSecret.myPrivateKey = &myPrivateKey;
281  * operationComputeSharedSecret.theirPublicKey = &theirPublicKey;
282  * operationComputeSharedSecret.sharedSecret = &sharedSecret;
283  * // If receiving and generating keys in little-endian format, we use the following format:
284  * operationComputeSharedSecret.keyMaterialEndianness = ECDH_LITTLE_ENDIAN_KEY;
285  *
286  * // Compute the shared secret and copy it to sharedSecretKeyingMaterial
287  * operationResult = ECDH_computeSharedSecret(ecdhHandle, &operationComputeSharedSecret);
288  *
289  * // Close the driver
290  * ECDH_close(ecdhHandle);
291  *
292  * @endcode
293  *
294  * @anchor ti_drivers_ECDH_Examples
295  * # Examples #
296  *
297  * ## ECDH exchange with plaintext CryptoKeys #
298  *
299  * @code
300  *
301  * #include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintext.h>
302  * #include <ti/drivers/ECDH.h>
303  *
304  * #define CURVE_LENGTH 32
305  *
306  * ...
307  *
308  * // Our private key is 0x0000000000000000000000000000000000000000000000000000000000000001
309  * // In practice, this value should come from a TRNG, PRNG, PUF, or device-specific pre-seeded key
310  * uint8_t myPrivateKeyingMaterial[CURVE_LENGTH] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311  * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312  * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313  * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
314  * uint8_t myPublicKeyingMaterial[2 * CURVE_LENGTH + 1] = {0};
315  * uint8_t theirPublicKeyingMaterial[2 * CURVE_LENGTH + 1] = {0};
316  * uint8_t sharedSecretKeyingMaterial[2 * CURVE_LENGTH + 1] = {0};
317  * uint8_t symmetricKeyingMaterial[16] = {0};
318  *
319  * CryptoKey myPrivateKey;
320  * CryptoKey myPublicKey;
321  * CryptoKey theirPublicKey;
322  * CryptoKey sharedSecret;
323  * CryptoKey symmetricKey;
324  *
325  * ECDH_Handle ecdhHandle;
326  *
327  * int_fast16_t operationResult;
328  *
329  * ECDH_OperationGeneratePublicKey operationGeneratePublicKey;
330  *
331  * // Since we are using default ECDH_Params, we just pass in NULL for that parameter.
332  * ecdhHandle = ECDH_open(0, NULL);
333  *
334  * if (!ecdhHandle) {
335  * // Handle error
336  * }
337  *
338  * // Initialize myPrivateKey and myPublicKey
339  * CryptoKeyPlaintext_initKey(&myPrivateKey, myPrivateKeyingMaterial, sizeof(myPrivateKeyingMaterial));
340  * CryptoKeyPlaintext_initBlankKey(&myPublicKey, myPublicKeyingMaterial, sizeof(myPublicKeyingMaterial));
341  *
342  * ECDH_OperationGeneratePublicKey_init(&operationGeneratePublicKey);
343  * operationGeneratePublicKey.curve = &ECCParams_NISTP256;
344  * operationGeneratePublicKey.myPrivateKey = &myPrivateKey;
345  * operationGeneratePublicKey.myPublicKey = &myPublicKey;
346  *
347  * // Generate the keying material for myPublicKey and store it in myPublicKeyingMaterial
348  * operationResult = ECDH_generatePublicKey(ecdhHandle, &operationGeneratePublicKey);
349  *
350  * if (operationResult != ECDH_STATUS_SUCCESS) {
351  * // Handle error
352  * }
353  *
354  * // Now send the content of myPublicKeyingMaterial to the other party,
355  * // receive their public key, and copy their public keying material and the
356  * // 0x04 byte to theirPublicKeyingMaterial
357  *
358  * // Initialise their public CryptoKey and the shared secret CryptoKey
359  * CryptoKeyPlaintext_initKey(&theirPublicKey, theirPublicKeyingMaterial, sizeof(theirPublicKeyingMaterial));
360  * CryptoKeyPlaintext_initBlankKey(&sharedSecret, sharedSecretKeyingMaterial, sizeof(sharedSecretKeyingMaterial));
361  *
362  * // The ECC_NISTP256 struct is provided in ti/drivers/types/EccParams.h and the corresponding device-specific
363  * implementation ECDH_OperationComputeSharedSecret_init(&operationComputeSharedSecret);
364  * operationComputeSharedSecret.curve = &ECCParams_NISTP256;
365  * operationComputeSharedSecret.myPrivateKey = &myPrivateKey;
366  * operationComputeSharedSecret.theirPublicKey = &theirPublicKey;
367  * operationComputeSharedSecret.sharedSecret = &sharedSecret;
368  *
369  * // Compute the shared secret and copy it to sharedSecretKeyingMaterial
370  * operationResult = ECDH_computeSharedSecret(ecdhHandle, &operationComputeSharedSecret);
371  *
372  * if (operationResult != ECDH_STATUS_SUCCESS) {
373  * // Handle error
374  * }
375  *
376  * CryptoKeyPlaintext_initBlankKey(&symmetricKey, symmetricKeyingMaterial, sizeof(symmetricKeyingMaterial));
377  *
378  * // Set up a KDF such as HKDF and open the requisite cryptographic primitive driver to implement it
379  * // HKDF and SHA2 were chosen as an example and may not be available directly
380  *
381  * // At this point, you and the other party have both created the content within symmetricKeyingMaterial without
382  * // someone else listening to your communication channel being able to do so
383  *
384  * @endcode
385  *
386  *
387  */
388 
389 #ifndef ti_drivers_ECDH__include
390 #define ti_drivers_ECDH__include
391 
392 #include <stdbool.h>
393 #include <stddef.h>
394 #include <stdint.h>
395 
398 
399 #ifdef __cplusplus
400 extern "C" {
401 #endif
402 
415 #define ECDH_STATUS_RESERVED (-32)
416 
423 #define ECDH_STATUS_SUCCESS (0)
424 
431 #define ECDH_STATUS_ERROR (-1)
432 
441 #define ECDH_STATUS_RESOURCE_UNAVAILABLE (-2)
442 
449 #define ECDH_STATUS_POINT_AT_INFINITY (-3)
450 
457 #define ECDH_STATUS_PRIVATE_KEY_LARGER_EQUAL_ORDER (-4)
458 
465 #define ECDH_STATUS_PRIVATE_KEY_ZERO (-5)
466 
473 #define ECDH_STATUS_PUBLIC_KEY_NOT_ON_CURVE (-6)
474 
482 #define ECDH_STATUS_PUBLIC_KEY_LARGER_THAN_PRIME (-7)
483 
487 #define ECDH_STATUS_CANCELED (-8)
488 
497 #define ECDH_STATUS_INVALID_KEY_SIZE (-9)
498 
510 typedef struct
511 {
513  void *object;
514 
516  void const *hwAttrs;
517 } ECDH_Config;
518 
523 
550 typedef enum
551 {
567 
568 typedef enum
569 {
577 
581 typedef struct
582 {
596 
600 typedef struct
601 {
621 
625 typedef union
626 {
631 
635 typedef enum
636 {
640 
659 typedef void (*ECDH_CallbackFxn)(ECDH_Handle handle,
660  int_fast16_t returnStatus,
661  ECDH_Operation operation,
662  ECDH_OperationType operationType);
663 
672 typedef struct
673 {
676  uint32_t timeout;
677  void *custom;
680 } ECDH_Params;
681 
687 extern const ECDH_Params ECDH_defaultParams;
688 
697 void ECDH_init(void);
698 
712 
730 ECDH_Handle ECDH_open(uint_least8_t index, const ECDH_Params *params);
731 
741 void ECDH_close(ECDH_Handle handle);
742 
752 
762 
788 int_fast16_t ECDH_generatePublicKey(ECDH_Handle handle, ECDH_OperationGeneratePublicKey *operation);
789 
811 int_fast16_t ECDH_computeSharedSecret(ECDH_Handle handle, ECDH_OperationComputeSharedSecret *operation);
812 
826 int_fast16_t ECDH_cancelOperation(ECDH_Handle handle);
827 
851 ECDH_Handle ECDH_construct(ECDH_Config *config, const ECDH_Params *params);
852 
853 #ifdef __cplusplus
854 }
855 #endif
856 
857 #endif /* ti_drivers_ECDH__include */
ECDH_OperationType
Enum for the operation types supported by the driver.
Definition: ECDH.h:635
ADC_Params params
Definition: Driver_Init.h:11
ECC Global configuration.
Definition: ECDH.h:510
The CryptoKey type is an opaque representation of a cryptographic key.
ECDH_Config * ECDH_Handle
A handle that is returned from an ECDH_open() call.
Definition: ECDH.h:522
ECDH_KeyMaterialEndianness keyMaterialEndianness
Definition: ECDH.h:592
ECDH_ReturnBehavior returnBehavior
Definition: ECDH.h:674
void ECDH_OperationGeneratePublicKey_init(ECDH_OperationGeneratePublicKey *operation)
Function to initialize an ECDH_OperationGeneratePublicKey struct to its defaults. ...
ECDH_OperationComputeSharedSecret * computeSharedSecret
Definition: ECDH.h:628
int_fast16_t ECDH_cancelOperation(ECDH_Handle handle)
Cancels an ongoing ECDH operation.
Definition: ECDH.h:562
void * object
Definition: ECDH.h:513
void * custom
Definition: ECDH.h:677
Struct containing the parameters required to compute the shared secret.
Definition: ECDH.h:600
CryptoKey datastructure.
Definition: CryptoKey.h:192
const CryptoKey * theirPublicKey
Definition: ECDH.h:608
ECDH_CallbackFxn callbackFxn
Definition: ECDH.h:675
const ECDH_Params ECDH_defaultParams
Default ECDH_Params structure.
void(* ECDH_CallbackFxn)(ECDH_Handle handle, int_fast16_t returnStatus, ECDH_Operation operation, ECDH_OperationType operationType)
The definition of a callback function used by the ECDH driver when used in ECDH_RETURN_BEHAVIOR_CALLB...
Definition: ECDH.h:659
void ECDH_OperationComputeSharedSecret_init(ECDH_OperationComputeSharedSecret *operation)
Function to initialize an ECDH_OperationComputeSharedSecret struct to its defaults.
ECDH_OperationGeneratePublicKey * generatePublicKey
Definition: ECDH.h:627
int_fast16_t ECDH_generatePublicKey(ECDH_Handle handle, ECDH_OperationGeneratePublicKey *operation)
Generates a public key for use in key agreement.
const CryptoKey * myPrivateKey
Definition: ECDH.h:584
const CryptoKey * myPrivateKey
Definition: ECDH.h:605
ECDH_KeyMaterialEndianness
Definition: ECDH.h:568
const ECCParams_CurveParams * curve
Definition: ECDH.h:602
void ECDH_init(void)
This function initializes the ECC module.
ECC Parameters.
Definition: ECDH.h:672
Definition: ECDH.h:558
ECDH_Handle ECDH_open(uint_least8_t index, const ECDH_Params *params)
This function opens a given ECC peripheral.
Definition: ECDH.h:570
uint32_t timeout
Definition: ECDH.h:676
CryptoKey * sharedSecret
Definition: ECDH.h:611
ECDH_ReturnBehavior
The way in which ECDH function calls return after performing a public key generation or shared secret...
Definition: ECDH.h:550
int_fast16_t ECDH_computeSharedSecret(ECDH_Handle handle, ECDH_OperationComputeSharedSecret *operation)
Computes a shared secret.
ECDH_KeyMaterialEndianness keyMaterialEndianness
Definition: ECDH.h:616
Struct containing the parameters required to generate a public key.
Definition: ECDH.h:581
void ECDH_close(ECDH_Handle handle)
Function to close an ECC peripheral specified by the ECC handle.
const ECCParams_CurveParams * curve
Definition: ECDH.h:583
A structure containing the parameters of an elliptic curve.
Definition: ECCParams.h:140
ECDH_Handle ECDH_construct(ECDH_Config *config, const ECDH_Params *params)
Constructs a new ECDH object.
void ECDH_Params_init(ECDH_Params *params)
Function to initialize the ECDH_Params struct to its defaults.
void const * hwAttrs
Definition: ECDH.h:516
Definition: ECDH.h:573
CryptoKey * myPublicKey
Definition: ECDH.h:587
Union containing pointers to all supported operation structs.
Definition: ECDH.h:625
Definition: ECDH.h:552
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale