mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 05:45:49 +01:00
Added CMAC as proper low-level module and changed error returns
This commit is contained in:
parent
8324818e0a
commit
84a4c67741
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#include "cipher.h"
|
#include "cipher.h"
|
||||||
|
|
||||||
#define MBEDTLS_ERR_CMAC_BAD_INPUT -0x000D /**< Bad input parameters to function. */
|
#define MBEDTLS_ERR_CMAC_BAD_INPUT -0x0011 /**< Bad input parameters to function. */
|
||||||
#define MBEDTLS_ERR_CMAC_VERIFY_FAILED -0x000F /**< Verification failed. */
|
#define MBEDTLS_ERR_CMAC_VERIFY_FAILED -0x0013 /**< Verification failed. */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
* PBKDF2 1 0x007C-0x007C
|
* PBKDF2 1 0x007C-0x007C
|
||||||
* HMAC_DRBG 4 0x0003-0x0009
|
* HMAC_DRBG 4 0x0003-0x0009
|
||||||
* CCM 2 0x000D-0x000F
|
* CCM 2 0x000D-0x000F
|
||||||
|
* CMAC 2 0x0011-0x0013
|
||||||
*
|
*
|
||||||
* High-level module nr (3 bits - 0x0...-0x7...)
|
* High-level module nr (3 bits - 0x0...-0x7...)
|
||||||
* Name ID Nr of Errors
|
* Name ID Nr of Errors
|
||||||
|
@ -69,6 +69,10 @@
|
|||||||
#include "mbedtls/cipher.h"
|
#include "mbedtls/cipher.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_CMAC_C)
|
||||||
|
#include "mbedtls/cmac.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||||
#include "mbedtls/ctr_drbg.h"
|
#include "mbedtls/ctr_drbg.h"
|
||||||
#endif
|
#endif
|
||||||
@ -578,6 +582,13 @@ void mbedtls_strerror( int ret, char *buf, size_t buflen )
|
|||||||
mbedtls_snprintf( buf, buflen, "CCM - Authenticated decryption failed" );
|
mbedtls_snprintf( buf, buflen, "CCM - Authenticated decryption failed" );
|
||||||
#endif /* MBEDTLS_CCM_C */
|
#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 defined(MBEDTLS_CTR_DRBG_C)
|
||||||
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )
|
if( use_ret == -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED) )
|
||||||
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" );
|
mbedtls_snprintf( buf, buflen, "CTR_DRBG - The entropy source failed" );
|
||||||
|
@ -33,7 +33,7 @@ my @low_level_modules = ( "AES", "ASN1", "BLOWFISH", "CAMELLIA", "BIGNUM",
|
|||||||
"BASE64", "XTEA", "PBKDF2", "OID",
|
"BASE64", "XTEA", "PBKDF2", "OID",
|
||||||
"PADLOCK", "DES", "NET", "CTR_DRBG", "ENTROPY",
|
"PADLOCK", "DES", "NET", "CTR_DRBG", "ENTROPY",
|
||||||
"HMAC_DRBG", "MD2", "MD4", "MD5", "RIPEMD160",
|
"HMAC_DRBG", "MD2", "MD4", "MD5", "RIPEMD160",
|
||||||
"SHA1", "SHA256", "SHA512", "GCM", "THREADING", "CCM" );
|
"SHA1", "SHA256", "SHA512", "GCM", "THREADING", "CCM", "CMAC" );
|
||||||
my @high_level_modules = ( "PEM", "X509", "DHM", "RSA", "ECP", "MD", "CIPHER", "SSL",
|
my @high_level_modules = ( "PEM", "X509", "DHM", "RSA", "ECP", "MD", "CIPHER", "SSL",
|
||||||
"PK", "PKCS12", "PKCS5" );
|
"PK", "PKCS12", "PKCS5" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user