![]() |
ndn-lite
|
Macros | |
#define | NDN_SECURITY_AES_H_ |
Functions | |
ndn_hmac_backend_t * | ndn_hmac_get_backend (void) |
uint32_t | ndn_hmac_get_key_size (const ndn_hmac_key_t *hmac_key) |
Get hmac key size in unit of byte. More... | |
const uint8_t * | ndn_hmac_get_key_value (const ndn_hmac_key_t *hmac_key) |
Get hmac key bytes. More... | |
int | ndn_hmac_load_key (ndn_hmac_key_t *hmac_key, const uint8_t *key_value, uint32_t key_size) |
Load in-memory key bits into an NDN hmac key. More... | |
int | ndn_hmac_sha256 (const void *payload, uint32_t payload_length, const ndn_hmac_key_t *hmac_key, uint8_t *hmac_result) |
Generate HMAC using sha256 digest algorithm. More... | |
int | ndn_hmac_sign (const uint8_t *input_value, uint32_t input_size, uint8_t *output_value, uint32_t output_max_size, const ndn_hmac_key_t *hmac_key, uint32_t *output_used_size) |
Sign a buffer using HMAC algorithm. More... | |
int | ndn_hmac_verify (const uint8_t *input_value, uint32_t input_size, const uint8_t *sig_value, uint32_t sig_size, const ndn_hmac_key_t *hmac_key) |
Verify a HMAC signature. More... | |
int | ndn_hmac_make_key (ndn_hmac_key_t *hmac_key, uint32_t key_id, const uint8_t *input_value, uint32_t input_size, const uint8_t *personalization, uint32_t personalization_size, const uint8_t *seed_value, uint32_t seed_size, const uint8_t *additional_value, uint32_t additional_size, uint32_t salt_size) |
Generate a HMAC key with specific key size and key id. More... | |
int | ndn_hkdf (const uint8_t *input_value, uint32_t input_size, uint8_t *output_value, uint32_t output_size, const uint8_t *seed_value, uint32_t seed_size) |
Use HMAC-KDF (key derivation function) to generate a secure HMAC key. More... | |
int | ndn_hmacprng (const uint8_t *input_value, uint32_t input_size, uint8_t *output_value, uint32_t output_size, const uint8_t *seed_value, uint32_t seed_size, const uint8_t *additional_value, uint32_t additional_size) |
Use HMAC-PRNG algorithm to generate pseudo-random bytes. More... | |
Variables | |
ndn_hmac_backend_t | ndn_hmac_backend |
#define NDN_SECURITY_AES_H_ |
int ndn_hkdf | ( | const uint8_t * | input_value, |
uint32_t | input_size, | ||
uint8_t * | output_value, | ||
uint32_t | output_size, | ||
const uint8_t * | seed_value, | ||
uint32_t | seed_size | ||
) |
Use HMAC-KDF (key derivation function) to generate a secure HMAC key.
This function requires proper entropy source.
input_value. | Input. Random input that requires KDF. |
input_size. | Input. Random input length in bytes. |
output_value. | Output. Buffer to receive output. |
output_size. | Input. Size of the output buffer. |
seed_value. | Input. Entropy to mix into the prng. |
seed_size. | Input. Entropy length in bytes. |
ndn_hmac_backend_t* ndn_hmac_get_backend | ( | void | ) |
uint32_t ndn_hmac_get_key_size | ( | const ndn_hmac_key_t * | hmac_key | ) |
Get hmac key size in unit of byte.
hmac_key. | Input. NDN hmac key. |
const uint8_t* ndn_hmac_get_key_value | ( | const ndn_hmac_key_t * | hmac_key | ) |
Get hmac key bytes.
hmac_key. | Input. NDN hmac key. |
int ndn_hmac_load_key | ( | ndn_hmac_key_t * | hmac_key, |
const uint8_t * | key_value, | ||
uint32_t | key_size | ||
) |
Load in-memory key bits into an NDN hmac key.
hmac_key. | Output. NDN hmac key. |
key_value. | Input. Key bytes. |
key_size. | Input. The size of the key bytes. |
int ndn_hmac_make_key | ( | ndn_hmac_key_t * | key, |
uint32_t | key_id, | ||
const uint8_t * | input_value, | ||
uint32_t | input_size, | ||
const uint8_t * | personalization, | ||
uint32_t | personalization_size, | ||
const uint8_t * | seed_value, | ||
uint32_t | seed_size, | ||
const uint8_t * | additional_value, | ||
uint32_t | additional_size, | ||
uint32_t | salt_size | ||
) |
Generate a HMAC key with specific key size and key id.
This function requires proper entropy source.
input_value. | Input. Personalization string. |
input_size. | Input. Personalization length in bytes. |
output_value. | Output. Buffer to receive output. |
output_size. | Input. Size of the output buffer. |
seed_value. | Input. Entropy to mix into the prng. |
seed_size. | Input. Entropy length in bytes. |
additional_value. | Input. Additional input to the prng. |
additional_size. | Input. Additional input length in bytes. |
int ndn_hmac_sha256 | ( | const void * | payload, |
uint32_t | payload_length, | ||
const ndn_hmac_key_t * | hmac_key, | ||
uint8_t * | hmac_result | ||
) |
Generate HMAC using sha256 digest algorithm.
int ndn_hmac_sign | ( | const uint8_t * | input_value, |
uint32_t | input_size, | ||
uint8_t * | output_value, | ||
uint32_t | output_max_size, | ||
const ndn_hmac_key_t * | hmac_key, | ||
uint32_t * | output_used_size | ||
) |
Sign a buffer using HMAC algorithm.
The memory buffer to hold the signature should not be smaller than 32 bytes.
input_value. | Input. Buffer prepared to sign. |
input_size. | Input. Size of input buffer. |
output_value. | Output. Signature value. |
output_max_size. | Input. Buffer size of output_value |
key_value. | Input. HMAC key. |
key_size. | Input. Size of HMAC key. |
output_used_size. | Output. Size of used output buffer when signing complete. |
int ndn_hmac_verify | ( | const uint8_t * | input_value, |
uint32_t | input_size, | ||
const uint8_t * | sig_value, | ||
uint32_t | sig_size, | ||
const ndn_hmac_key_t * | hmac_key | ||
) |
Verify a HMAC signature.
input_value. | Input. HMAC-signed buffer. |
input_size. | Input. Size of input buffer. |
sig_value. | Input. HMAC signature value. |
sig_size. | Input. HMAC signature size. Should be 32 bytes. |
key_value. | Input. HMAC key buffer. |
key_size. | Input. size of HMAC key. |
int ndn_hmacprng | ( | const uint8_t * | input_value, |
uint32_t | input_size, | ||
uint8_t * | output_value, | ||
uint32_t | output_size, | ||
const uint8_t * | seed_value, | ||
uint32_t | seed_size, | ||
const uint8_t * | additional_value, | ||
uint32_t | additional_size | ||
) |
Use HMAC-PRNG algorithm to generate pseudo-random bytes.
This function requires proper entropy source.
input_value. | Input. Personalization string. |
input_size. | Input. Personalization length in bytes. |
output_value. | Output. Buffer to receive output. |
output_size. | Input. Size of the output buffer. |
seed_value. | Input. Entropy to mix into the prng, highly recommend larger than 32 bytes. |
seed_size. | Input. Entropy length in bytes, highly recommend larger than 32 bytes. |
additional_value. | Input. Additional input to the prng |
additional_size. | Input. Additional input length in bytes |