|
SmartSnippets DA1459x SDK
|
Elliptic Curve Diffie-Hellman key agreement protocol. More...
Files | |
| file | crypto_ecdh.h |
| ECDH API. | |
Data Structures | |
| struct | crypto_ecdh_context_t |
| ECDH context. More... | |
Macros | |
| #define | CRYPTO_ECDH_INIT_CTX(curve_init) { {0}, {{0}, {0}}, {{0}, {0}}, {0}, curve_init, 0 } |
| Initialize ECDH context. More... | |
Enumerations | |
| enum | CRYPTO_ECDH_RET { CRYPTO_ECDH_RET_OK = 0, CRYPTO_ECDH_RET_TO = 1, CRYPTO_ECDH_RET_EE = 2, CRYPTO_ECDH_RET_MP = 3, CRYPTO_ECDH_RET_IP = 4, CRYPTO_ECDH_RET_ER = 5 } |
| ECDH API return codes. More... | |
| enum | crypto_ecdh_context_flags { CRYPTO_ECDH_CTX_d = 0x1, CRYPTO_ECDH_CTX_Ql = 0x2, CRYPTO_ECDH_CTX_Qp = 0x4, CRYPTO_ECDH_CTX_s = 0x8 } |
| ECDH context flags type. More... | |
Functions | |
| CRYPTO_ECDH_RET | crypto_ecdh_compute (crypto_ecdh_context_t *ctx, OS_TICK_TIME timeout) |
| Generate Elliptic Curve Diffie-Hellman (ECDH) key pair. More... | |
| CRYPTO_ECDH_RET | crypto_ecdh_init_context (crypto_ecdh_context_t *ctx, CRYPTO_ECC_CURVE curve_type) |
| Initialize context for use with crypto_ecdh_compute. More... | |
Elliptic Curve Diffie-Hellman key agreement protocol.
| #define CRYPTO_ECDH_INIT_CTX | ( | curve_init | ) | { {0}, {{0}, {0}}, {{0}, {0}}, {0}, curve_init, 0 } |
Initialize ECDH context.
| [in] | curve_init | The curve initilization macro. Details can be found in crypto curves documentation. |
| enum CRYPTO_ECDH_RET |
| CRYPTO_ECDH_RET crypto_ecdh_compute | ( | crypto_ecdh_context_t * | ctx, |
| OS_TICK_TIME | timeout | ||
| ) |
Generate Elliptic Curve Diffie-Hellman (ECDH) key pair.
This function implements the steps defined by the ECDH algorithm, depending on the input context contents. In more detail the steps are:
The resulting shared secret may be passed through a key-derivation function (KDF) to derive a symmetric key.
The following example shows how this function can be used to generate a public key and a shared secret based on the secp256r1 curve (NIST P-256).
The next example shows how to generate a public key and a shared secret, if the peer's public key is available before calling this function. The example is based on Curve25519.
| [in,out] | ctx | The ECDH context where the result will be stored. It must be properly initialized with INIT_ECDH_CTX() and one of the supported curves . |
| [in] | timeout | Time in ticks to wait while trying to acquire hardware resources. |
| CRYPTO_ECDH_RET crypto_ecdh_init_context | ( | crypto_ecdh_context_t * | ctx, |
| CRYPTO_ECC_CURVE | curve_type | ||
| ) |
Initialize context for use with crypto_ecdh_compute.
| [in,out] | ctx | The ECDH context where the result will be stored. It must be properly initialized with INIT_ECDH_CTX() and one of the supported curves . |
| [in] | curve_type | Curve type to be used with the created ecdh context. |
1.8.16