Allow alternate core implementation of CMAC
This commit is contained in:
parent
b65c2be5f1
commit
6334277320
@ -39,6 +39,8 @@ extern "C" {
|
|||||||
#define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /* longest used by CMAC is 3DES */
|
#define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /* longest used by CMAC is 3DES */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CMAC_ALT)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CMAC context structure - Contains internal state information only
|
* CMAC context structure - Contains internal state information only
|
||||||
*/
|
*/
|
||||||
@ -154,6 +156,18 @@ int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_len,
|
|||||||
unsigned char output[16] );
|
unsigned char output[16] );
|
||||||
#endif /* MBEDTLS_AES_C */
|
#endif /* MBEDTLS_AES_C */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* !MBEDTLS_CMAC_ALT */
|
||||||
|
#include "cmac_alt.h"
|
||||||
|
#endif /* !MBEDTLS_CMAC_ALT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
|
#if defined(MBEDTLS_SELF_TEST) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
|
||||||
/**
|
/**
|
||||||
* \brief Checkup routine
|
* \brief Checkup routine
|
||||||
|
@ -237,6 +237,7 @@
|
|||||||
//#define MBEDTLS_ARC4_ALT
|
//#define MBEDTLS_ARC4_ALT
|
||||||
//#define MBEDTLS_BLOWFISH_ALT
|
//#define MBEDTLS_BLOWFISH_ALT
|
||||||
//#define MBEDTLS_CAMELLIA_ALT
|
//#define MBEDTLS_CAMELLIA_ALT
|
||||||
|
//#define MBEDTLS_CMAC_ALT
|
||||||
//#define MBEDTLS_DES_ALT
|
//#define MBEDTLS_DES_ALT
|
||||||
//#define MBEDTLS_XTEA_ALT
|
//#define MBEDTLS_XTEA_ALT
|
||||||
//#define MBEDTLS_MD2_ALT
|
//#define MBEDTLS_MD2_ALT
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
#endif /* MBEDTLS_PLATFORM_C */
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CMAC_ALT)
|
||||||
|
|
||||||
/* Implementation that should never be optimized out by the compiler */
|
/* Implementation that should never be optimized out by the compiler */
|
||||||
static void mbedtls_zeroize( void *v, size_t n ) {
|
static void mbedtls_zeroize( void *v, size_t n ) {
|
||||||
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
|
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
|
||||||
@ -468,6 +470,8 @@ exit:
|
|||||||
}
|
}
|
||||||
#endif /* MBEDTLS_AES_C */
|
#endif /* MBEDTLS_AES_C */
|
||||||
|
|
||||||
|
#endif /* !MBEDTLS_CMAC_ALT */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST)
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
/*
|
/*
|
||||||
* CMAC test data for SP800-38B
|
* CMAC test data for SP800-38B
|
||||||
|
Loading…
Reference in New Issue
Block a user