nRF5 SDK v16.0.0
Modules | Data Structures | Macros | Typedefs | Functions
Elliptic Curve Diffie-Hellman (ECDH)

Provides elliptic curve cryptography functions for Diffie-Hellman shared secret exchange. More...

Modules

 Definitions specific to secp160r1 (NIST 160-bit)
 
 Definitions specific to secp160r2 (NIST 160-bit)
 
 Definitions specific to secp192r1 (NIST 192-bit)
 
 Definitions specific to secp224r1 (NIST 224-bit)
 
 Definitions specific to secp256r1 (NIST 256-bit)
 
 Definitions specific to secp384r1 (NIST 384-bit)
 
 Definitions specific to secp521r1 (NIST 521-bit)
 
 Definitions specific to secp160k1 (Koblitz 160-bit)
 
 Definitions specific to secp192k1 (Koblitz 192-bit)
 
 Definitions specific to secp224k1 (Koblitz 224-bit)
 
 Definitions specific to secp256k1 (Koblitz 256-bit)
 
 Definitions specific to bp256r1 (Brainpool 256-bit)
 
 Definitions specific to bp384r1 (Brainpool 384-bit)
 
 Definitions specific to bp512r1 (Brainpool 512-bit)
 
 Definitions specific to Curve25519
 

Data Structures

union  nrf_crypto_ecdh_context_t
 Union holding a context for ECDH computation. More...
 

Macros

#define NRF_CRYPTO_ECDH_SHARED_SECRET_MAX_SIZE   NRF_CRYPTO_ECC_RAW_PRIVATE_KEY_MAX_SIZE
 Maximum size of a shared secret in bytes for all enabled curves.
 

Typedefs

typedef uint8_t nrf_crypto_ecdh_shared_secret_t [NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE]
 Array type of a shared secret for any of the enabled curves.
 

Functions

ret_code_t nrf_crypto_ecdh_compute (nrf_crypto_ecdh_context_t *p_context, nrf_crypto_ecc_private_key_t const *p_private_key, nrf_crypto_ecc_public_key_t const *p_public_key, uint8_t *p_shared_secret, size_t *p_shared_secret_size)
 Computes shared secret using ECC Diffie-Hellman. More...
 

Detailed Description

Provides elliptic curve cryptography functions for Diffie-Hellman shared secret exchange.

Function Documentation

ret_code_t nrf_crypto_ecdh_compute ( nrf_crypto_ecdh_context_t p_context,
nrf_crypto_ecc_private_key_t const *  p_private_key,
nrf_crypto_ecc_public_key_t const *  p_public_key,
uint8_t *  p_shared_secret,
size_t *  p_shared_secret_size 
)

Computes shared secret using ECC Diffie-Hellman.

Parameters
[in]p_contextPointer to temporary structure holding context information. If it is NULL, necessary data will be allocated with NRF_CRYPTO_ALLOC and freed at the end of the function.
[in]p_private_keyPointer to structure holding a private key.
[in]p_public_keyPointer to structure holding a public key received from the other party.
[out]p_shared_secretPointer to buffer where shared secret will be put.
[in,out]p_shared_secret_sizeMaximum number of bytes that p_shared_secret buffer can hold on input and the actual number of bytes used by the data on output. Actual size for selected curve is defined by the preprocessor definitions, e.g. NRF_CRYPTO_ECDH_SECP256R1_SHARED_SECRET_SIZE.

Documentation feedback | Developer Zone | Subscribe | Updated