diff --git a/common/polarssl/libpcrypto.c b/common/polarssl/libpcrypto.c index 6b3058c6..05c2ffe7 100644 --- a/common/polarssl/libpcrypto.c +++ b/common/polarssl/libpcrypto.c @@ -60,9 +60,16 @@ int aes_cmac(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *mac, int length data[length] = 0x80; 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 mbedtls_cipher_context_t 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_update(&ctx, data, datalen); mbedtls_cipher_cmac_finish(&ctx, mac);