![]() |
Contiki-NG
|
Topics | |
| Cryptographically-secure PRNG | |
| In contrast to a normal PRNG, a CSPRNG generates a stream of pseudo-random numbers that is indistinguishable from the uniform distribution to a computationally-bounded adversary who does not know the seed. | |
Files | |
| file | aes-128.c |
| Wrapped AES-128 implementation from Texas Instruments. | |
| file | aes-128.h |
| AES-128. | |
| file | ccm-star.c |
| AES_128-based CCM* implementation. | |
| file | ccm-star.h |
| CCM* header file. | |
| file | ecc-curve.c |
| NIST curves for various key sizes. | |
| file | ecc-curve.h |
| NIST curves for various key sizes. | |
| file | ecc.h |
| Header file of ECC. | |
| file | sha-256.c |
| Software implementation of SHA-256. | |
| file | sha-256.h |
| Platform-independent SHA-256 API. | |
| file | ecc.c |
| Adapter for uECC. | |
| file | module-macros.h |
| Applies settings that are mandatory for uECC. | |
Data Structures | |
| struct | aes_128_driver |
| Structure of AES drivers. More... | |
| struct | ccm_star_driver |
| Structure of CCM* drivers. More... | |
| struct | ecc_curve_t |
| Parameters of an ECC curve in little-endian word order. More... | |
| struct | sha_256_driver |
| Structure of SHA-256 drivers. More... | |
Functions | |
| void | ecc_init (void) |
| Initializes ECC. | |
| process_mutex_t * | ecc_get_mutex (void) |
| Provides a mutex to be locked before proceeding with ecc_enable(). | |
| int | ecc_enable (const ecc_curve_t *curve) |
| Sets up the ECC driver. | |
| struct pt * | ecc_get_protothread (void) |
| Provides the protothread that runs long-running ECC operations. | |
| char | ecc_validate_public_key (const uint8_t *public_key, int *result) |
| Validates a public key. | |
| void | ecc_compress_public_key (const uint8_t *uncompressed_public_key, uint8_t *compressed_public_key) |
| Compresses a public key as per SECG SEC 1. | |
| char | ecc_decompress_public_key (const uint8_t *compressed_public_key, uint8_t *uncompressed_public_key, int *result) |
| Decompresses a public key. | |
| char | ecc_sign (const uint8_t *message_hash, const uint8_t *private_key, uint8_t *signature, int *result) |
| Generates an ECDSA signature for a message. | |
| char | ecc_verify (const uint8_t *signature, const uint8_t *message_hash, const uint8_t *public_key, int *result) |
| Verifies an ECDSA signature of a message. | |
| char | ecc_generate_key_pair (uint8_t *public_key, uint8_t *private_key, int *result) |
| Generates a public/private key pair. | |
| char | ecc_generate_shared_secret (const uint8_t *public_key, const uint8_t *private_key, uint8_t *shared_secret, int *result) |
| Generates a shared secret as per ECDH. | |
| void | ecc_disable (void) |
| Shuts down the ECC driver and unlocks the mutex. | |
| void | sha_256_hmac_init (const uint8_t *key, size_t key_len) |
| Initiates a stepwise HMAC-SHA-256 computation. | |
| void | sha_256_hmac_update (const uint8_t *data, size_t data_len) |
| Proceeds with the computation of an HMAC-SHA-256. | |
| void | sha_256_hkdf_expand (const uint8_t *prk, size_t prk_len, const uint8_t *info, size_t info_len, uint8_t *okm, uint_fast16_t okm_len) |
| Expands a key as per RFC 5869. | |
| void | sha_256_hkdf (const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, const uint8_t *info, size_t info_len, uint8_t *okm, uint_fast16_t okm_len) |
| Performs both extraction and expansion as per RFC 5869. | |
| void | sha_256_hash (const uint8_t *data, size_t len, uint8_t digest[static 32]) |
| Generic implementation of sha_256_driver::hash. | |
| void | sha_256_hmac_finish (uint8_t hmac[static 32]) |
| Finishes the computation of an HMAC-SHA-256. | |
| void | sha_256_hmac (const uint8_t *key, size_t key_len, const uint8_t *data, size_t data_len, uint8_t hmac[static 32]) |
| Computes HMAC-SHA-256 as per RFC 2104. | |
| void | sha_256_hkdf_extract (const uint8_t *salt, size_t salt_len, const uint8_t *ikm, size_t ikm_len, uint8_t prk[static 32]) |
| Extracts a key as per RFC 5869. | |
| void ecc_compress_public_key | ( | const uint8_t * | uncompressed_public_key, |
| uint8_t * | compressed_public_key ) |
| char ecc_decompress_public_key | ( | const uint8_t * | compressed_public_key, |
| uint8_t * | uncompressed_public_key, | ||
| int * | result ) |
| int ecc_enable | ( | const ecc_curve_t * | curve | ) |
Sets up the ECC driver.
| curve | The curve to use in subsequent calls. |
Definition at line 72 of file ecc.c.
References process_mutex_unlock().
| char ecc_generate_key_pair | ( | uint8_t * | public_key, |
| uint8_t * | private_key, | ||
| int * | result ) |
| char ecc_generate_shared_secret | ( | const uint8_t * | public_key, |
| const uint8_t * | private_key, | ||
| uint8_t * | shared_secret, | ||
| int * | result ) |
Generates a shared secret as per ECDH.
NOTE: Callers should derive symmetric keys from the shared secret via a key derivation function.
| public_key | The peer's 2|CURVE|-byte public key. |
| private_key | Our |CURVE|-byte private key. |
| shared_secret | The resultant |CURVE|-byte shared secret. |
| result | 0 on success and else a driver-specific error code. |
| process_mutex_t * ecc_get_mutex | ( | void | ) |
Provides a mutex to be locked before proceeding with ecc_enable().
| struct pt * ecc_get_protothread | ( | void | ) |
| char ecc_sign | ( | const uint8_t * | message_hash, |
| const uint8_t * | private_key, | ||
| uint8_t * | signature, | ||
| int * | result ) |
Generates an ECDSA signature for a message.
| message_hash | The |CURVE|-byte hash over the message. |
| private_key | The |CURVE|-byte private key. |
| signature | The 2|CURVE|-byte signature. |
| result | 0 on success and else a driver-specific error code. |
Definition at line 126 of file ecc.c.
References ecc_curve_t::bytes, PT_BEGIN, and PT_END.
| char ecc_validate_public_key | ( | const uint8_t * | public_key, |
| int * | result ) |
| char ecc_verify | ( | const uint8_t * | signature, |
| const uint8_t * | message_hash, | ||
| const uint8_t * | public_key, | ||
| int * | result ) |
Verifies an ECDSA signature of a message.
| signature | The 2|CURVE|-byte signature. |
| message_hash | The |CURVE|-byte hash over the message. |
| public_key | The 2|CURVE|-byte public key. |
| result | 0 on success and else a driver-specific error code. |
Definition at line 142 of file ecc.c.
References ecc_curve_t::bytes, PT_BEGIN, and PT_END.
| void sha_256_hkdf | ( | const uint8_t * | salt, |
| size_t | salt_len, | ||
| const uint8_t * | ikm, | ||
| size_t | ikm_len, | ||
| const uint8_t * | info, | ||
| size_t | info_len, | ||
| uint8_t * | okm, | ||
| uint_fast16_t | okm_len ) |
Performs both extraction and expansion as per RFC 5869.
| salt | optional salt value |
| salt_len | length of salt in bytes |
| ikm | input keying material |
| ikm_len | length of ikm in bytes |
| info | optional context and application specific information |
| info_len | length of info in bytes |
| okm | output keying material |
| okm_len | length of okm in bytes (<= 255 * SHA_256_DIGEST_LENGTH) |
Definition at line 443 of file sha-256.c.
References sha_256_hkdf_expand().
| void sha_256_hkdf_expand | ( | const uint8_t * | prk, |
| size_t | prk_len, | ||
| const uint8_t * | info, | ||
| size_t | info_len, | ||
| uint8_t * | okm, | ||
| uint_fast16_t | okm_len ) |
Expands a key as per RFC 5869.
| prk | a pseudorandom key of at least SHA_256_DIGEST_LENGTH bytes |
| prk_len | length of prk in bytes |
| info | optional context and application specific information |
| info_len | length of info in bytes |
| okm | output keying material |
| okm_len | length of okm in bytes (<= 255 * SHA_256_DIGEST_LENGTH) |
Definition at line 415 of file sha-256.c.
References sha_256_hmac_init(), and sha_256_hmac_update().
Referenced by sha_256_hkdf().
| void sha_256_hkdf_extract | ( | const uint8_t * | salt, |
| size_t | salt_len, | ||
| const uint8_t * | ikm, | ||
| size_t | ikm_len, | ||
| uint8_t | prk[static 32] ) |
Extracts a key as per RFC 5869.
| salt | optional salt value |
| salt_len | length of salt in bytes |
| ikm | input keying material |
| ikm_len | length of ikm in bytes |
| prk | pointer to where the extracted key shall be stored |
| void sha_256_hmac | ( | const uint8_t * | key, |
| size_t | key_len, | ||
| const uint8_t * | data, | ||
| size_t | data_len, | ||
| uint8_t | hmac[static 32] ) |
Computes HMAC-SHA-256 as per RFC 2104.
| key | the key to authenticate with |
| key_len | length of key in bytes |
| data | the data to authenticate |
| data_len | length of data in bytes |
| hmac | pointer to where the resulting HMAC shall be stored |
| void sha_256_hmac_finish | ( | uint8_t | hmac[static 32] | ) |
Finishes the computation of an HMAC-SHA-256.
| hmac | pointer to where the resulting HMAC shall be stored |
| void sha_256_hmac_init | ( | const uint8_t * | key, |
| size_t | key_len ) |
Initiates a stepwise HMAC-SHA-256 computation.
| key | the key to authenticate with |
| key_len | length of key in bytes |
Definition at line 355 of file sha-256.c.
Referenced by sha_256_hkdf_expand().
| void sha_256_hmac_update | ( | const uint8_t * | data, |
| size_t | data_len ) |
Proceeds with the computation of an HMAC-SHA-256.
| data | further data to authenticate |
| data_len | length of data in bytes |
Definition at line 380 of file sha-256.c.
Referenced by sha_256_hkdf_expand().