Lightweight AES Key Wrap implementation as per RFC 3394.
It was written as part of an IEEE 802.1X/MKA (MACsec Key Agreement) implementation, where AES-KW is used for secure key transport.
Designed to be used with tiny-AES-c library – fork enabling runtime selection of key width.
tests/ subdirectory contains a reference test against all the RFC 3394 test vectors.
void AES_KW_init_ctx(struct AES_KW_ctx* ctx,
void (*aes_encrypt_callback)(uint8_t*),
void (*aes_decrypt_callback)(uint8_t*));
uint32_t AES_KW_wrap(const struct AES_KW_ctx* ctx,
const uint8_t *plaintext, uint32_t pt_len,
uint8_t *ciphertext);
uint32_t AES_KW_unwrap(const struct AES_KW_ctx* ctx,
const uint8_t *ciphertext, uint32_t ct_len,
uint8_t *plaintext);- Specifically for
tiny-AES-C: initialize the AES context withAES_init_ctx(). - Initialize the Key Wrap module using
AES_CMAC_init_ctx()– pass the encrypt and decrypt callbacks. - Call
AES_KW_wrap()andAES_KW_wrap()to wrapp or unwrap the key material.
This project was inspired by AES CMAC implementation that uses the same AES library.