mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 13:23:25 -07:00
aes_cmac fix
This commit is contained in:
parent
f4411336c3
commit
4f04819a82
1 changed files with 7 additions and 0 deletions
|
@ -60,9 +60,16 @@ int aes_cmac(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length
|
||||||
data[length] = 0x80;
|
data[length] = 0x80;
|
||||||
int datalen = (length & 0xfffffff0) + 0x10;
|
int datalen = (length & 0xfffffff0) + 0x10;
|
||||||
|
|
||||||
|
|
||||||
|
// int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_length,
|
||||||
|
// const unsigned char *input, size_t in_len,
|
||||||
|
// unsigned char *output )
|
||||||
|
// mbedtls_aes_cmac_prf_128(key, 16, input, length, mac);
|
||||||
|
|
||||||
// NIST 800-38B
|
// NIST 800-38B
|
||||||
mbedtls_cipher_context_t ctx;
|
mbedtls_cipher_context_t ctx;
|
||||||
mbedtls_cipher_init(&ctx);
|
mbedtls_cipher_init(&ctx);
|
||||||
|
mbedtls_cipher_setup(&ctx, mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_ECB));
|
||||||
mbedtls_cipher_cmac_starts(&ctx, key, 128);
|
mbedtls_cipher_cmac_starts(&ctx, key, 128);
|
||||||
mbedtls_cipher_cmac_update(&ctx, data, datalen);
|
mbedtls_cipher_cmac_update(&ctx, data, datalen);
|
||||||
mbedtls_cipher_cmac_finish(&ctx, mac);
|
mbedtls_cipher_cmac_finish(&ctx, mac);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue