Commit 57863ad7 authored by Brian Murray's avatar Brian Murray Committed by Simon Butcher

selftest supports cmac if only MBEDTLS_DES_C is defined

Other minor typo fixes
parent 9044b029
......@@ -27,6 +27,8 @@
#define MBEDTLS_ERR_CMAC_BAD_INPUT -0x0011 /**< Bad input parameters to function. */
#define MBEDTLS_ERR_CMAC_VERIFY_FAILED -0x0013 /**< Verification failed. */
#define MBEDTLS_ERR_CMAC_ALLOC_FAILED -0x0015 /**< Memory Allocation failed. */
#ifdef __cplusplus
extern "C" {
......@@ -83,7 +85,7 @@ void mbedtls_cmac_free( mbedtls_cmac_context *ctx );
* \param tag buffer for holding the generated tag
* \param tag_len length of the tag to generate in bytes
* Must be 4, 6, 8 if cipher block size is 64
* Must be 4, 6, 8 0, 14 or 16 if cipher block size is 128
* Must be 4, 6, 8 , 10, 12, 14 or 16 if cipher block size is 128
*
* \return 0 if successful
*/
......@@ -100,7 +102,7 @@ int mbedtls_cmac_generate( mbedtls_cmac_context *ctx,
* \param tag buffer holding the tag to verify
* \param tag_len length of the tag to verify in bytes
* Must be 4, 6, 8 if cipher block size is 64
* Must be 4, 6, 8 0, 14 or 16 if cipher block size is 128
* Must be 4, 6, 8 , 10, 12, 14 or 16 if cipher block size is 128
* \return 0 if successful and authenticated
* MBEDTLS_ERR_CMAC_VERIFY_FAILED if tag does not match
*/
......
......@@ -66,7 +66,7 @@
* PBKDF2 1 0x007C-0x007C
* HMAC_DRBG 4 0x0003-0x0009
* CCM 2 0x000D-0x000F
* CMAC 2 0x0011-0x0013
* CMAC 3 0x0011-0x0015
*
* High-level module nr (3 bits - 0x0...-0x7...)
* Name ID Nr of Errors
......
This diff is collapsed.
......@@ -587,6 +587,8 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
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" );
if( use_ret == -(MBEDTLS_ERR_CMAC_ALLOC_FAILED) )
mbedtls_snprintf( buf, buflen, "CMAC - Failed to allocate memory" );
#endif /* MBEDTLS_CMAC_C */
#if defined(MBEDTLS_CTR_DRBG_C)
......
......@@ -278,7 +278,7 @@ int main( int argc, char *argv[] )
suites_tested++;
#endif
#if defined(MBEDTLS_CMAC_C) && defined(MBEDTLS_AES_C)
#if defined(MBEDTLS_CMAC_C) && ( defined(MBEDTLS_AES_C) || defined(MBEDTLS_DES_C) )
if( ( ret = mbedtls_cmac_self_test( v ) ) != 0 )
return( ret );
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment