1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Added CMAC as proper low-level module and changed error returns

This commit is contained in:
Robert Cragie
2015-12-14 17:13:29 +00:00
committed by Simon Butcher
parent 8324818e0a
commit 84a4c67741
4 changed files with 15 additions and 3 deletions

View File

@ -69,6 +69,10 @@
#include "mbedtls/cipher.h"
#endif
#if defined(MBEDTLS_CMAC_C)
#include "mbedtls/cmac.h"
#endif
#if defined(MBEDTLS_CTR_DRBG_C)
#include "mbedtls/ctr_drbg.h"
#endif
@ -578,6 +582,13 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
mbedtls_snprintf( buf, buflen, "CCM - Authenticated decryption failed" );
#endif /* MBEDTLS_CCM_C */
#if defined(MBEDTLS_CMAC_C)
if( use_ret == -(MBEDTLS_ERR_CMAC_BAD_INPUT) )
mbedtls_snprintf( buf, buflen, "CMAC - Bad input parameters to function" );
if( use_ret == -(MBEDTLS_ERR_CMAC_VERIFY_FAILED) )
mbedtls_snprintf( buf, buflen, "CMAC - Verification failed" );
#endif /* MBEDTLS_CMAC_C */
#if defined(MBEDTLS_CTR_DRBG_C)
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" );