mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 22:05:37 +00:00
Allow alternate core implementation of CCM
This commit is contained in:
parent
b65c2be5f1
commit
222e2ff421
|
@ -28,6 +28,10 @@
|
||||||
#define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D /**< Bad input parameters to function. */
|
#define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D /**< Bad input parameters to function. */
|
||||||
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */
|
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CCM_ALT)
|
||||||
|
// Regular implementation
|
||||||
|
//
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,6 +129,18 @@ int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
|
||||||
const unsigned char *input, unsigned char *output,
|
const unsigned char *input, unsigned char *output,
|
||||||
const unsigned char *tag, size_t tag_len );
|
const unsigned char *tag, size_t tag_len );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* !MBEDTLS_CCM_ALT */
|
||||||
|
#include "ccm_alt.h"
|
||||||
|
#endif /* !MBEDTLS_CCM_ALT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
|
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_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_CCM_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
|
||||||
|
|
|
@ -49,6 +49,8 @@
|
||||||
#endif /* MBEDTLS_PLATFORM_C */
|
#endif /* MBEDTLS_PLATFORM_C */
|
||||||
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
|
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_CCM_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;
|
||||||
|
@ -348,6 +350,7 @@ int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !MBEDTLS_CCM_ALT */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
|
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue