nrfxlib API 3.3.99
Loading...
Searching...
No Matches

Elliptic curve Diffie-Hellman algorithm based on the NIST P-256 curve (aka secp256r1). More...

Files

file  ocrypto_ecdh_p256.h
 Elliptic curve Diffie-Hellman algorithm based on the NIST P-256 curve (aka secp256r1).
 

Functions

int ocrypto_ecdh_p256_secret_key_check (const uint8_t sk[32])
 
int ocrypto_ecdh_p256_public_key_check (const uint8_t pk[64])
 
int ocrypto_ecdh_p256_public_key (uint8_t pk[64], const uint8_t sk[32])
 
int ocrypto_ecdh_p256_common_secret (uint8_t r[32], const uint8_t sk[32], const uint8_t pk[64])
 

Incremental ECDH P-256 calculation

This group of functions can be used to incrementally calculate the ECDH P-256 public key and common secret. Each call completes in less than 25ms on a 16MHz Cortex-M0.

Use pattern:

Public Key:

int ocrypto_ecdh_p256_public_key_final(ocrypto_ecdh_p256_ctx *ctx, uint8_t pk[64])
int ocrypto_ecdh_p256_public_key_iterate(ocrypto_ecdh_p256_ctx *ctx)
void ocrypto_ecdh_p256_public_key_init(ocrypto_ecdh_p256_ctx *ctx, const uint8_t sk[32])

Common Secret:

void ocrypto_ecdh_p256_common_secret_init(ocrypto_ecdh_p256_ctx *ctx, const uint8_t sk[32], const uint8_t pk[64])
int ocrypto_ecdh_p256_common_secret_iterate(ocrypto_ecdh_p256_ctx *ctx)
int ocrypto_ecdh_p256_common_secret_final(ocrypto_ecdh_p256_ctx *ctx, uint8_t r[32])
void ocrypto_ecdh_p256_public_key_init (ocrypto_ecdh_p256_ctx *ctx, const uint8_t sk[32])
 
int ocrypto_ecdh_p256_public_key_iterate (ocrypto_ecdh_p256_ctx *ctx)
 
int ocrypto_ecdh_p256_public_key_final (ocrypto_ecdh_p256_ctx *ctx, uint8_t pk[64])
 
void ocrypto_ecdh_p256_common_secret_init (ocrypto_ecdh_p256_ctx *ctx, const uint8_t sk[32], const uint8_t pk[64])
 
int ocrypto_ecdh_p256_common_secret_iterate (ocrypto_ecdh_p256_ctx *ctx)
 
int ocrypto_ecdh_p256_common_secret_final (ocrypto_ecdh_p256_ctx *ctx, uint8_t r[32])
 

Detailed Description

Elliptic curve Diffie-Hellman algorithm based on the NIST P-256 curve (aka secp256r1).

ECDH P-256 is a specific implementation of a key agreement protocol.

See also
NIST - SP 800-56A Rev. 3