Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream-public/pr/865' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
gilles-peskine-arm committed Jan 2, 2018
2 parents 4b660ec + 3a93387 commit 7c483b6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/mbedtls/ccm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#define MBEDTLS_ERR_CCM_BAD_INPUT -0x000D /**< Bad input parameters to function. */
#define MBEDTLS_ERR_CCM_AUTH_FAILED -0x000F /**< Authenticated decryption failed. */

#if !defined(MBEDTLS_CCM_ALT)
// Regular implementation
//

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -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 *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)
/**
* \brief Checkup routine
Expand Down
1 change: 1 addition & 0 deletions include/mbedtls/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
//#define MBEDTLS_ARC4_ALT
//#define MBEDTLS_BLOWFISH_ALT
//#define MBEDTLS_CAMELLIA_ALT
//#define MBEDTLS_CCM_ALT
//#define MBEDTLS_DES_ALT
//#define MBEDTLS_XTEA_ALT
//#define MBEDTLS_MD2_ALT
Expand Down
3 changes: 3 additions & 0 deletions library/ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#endif /* MBEDTLS_PLATFORM_C */
#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */

#if !defined(MBEDTLS_CCM_ALT)

/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0;
Expand Down Expand Up @@ -348,6 +350,7 @@ int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
return( 0 );
}

#endif /* !MBEDTLS_CCM_ALT */

#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
/*
Expand Down
3 changes: 3 additions & 0 deletions library/version_features.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ static const char *features[] = {
#if defined(MBEDTLS_CAMELLIA_ALT)
"MBEDTLS_CAMELLIA_ALT",
#endif /* MBEDTLS_CAMELLIA_ALT */
#if defined(MBEDTLS_CCM_ALT)
"MBEDTLS_CCM_ALT",
#endif /* MBEDTLS_CCM_ALT */
#if defined(MBEDTLS_DES_ALT)
"MBEDTLS_DES_ALT",
#endif /* MBEDTLS_DES_ALT */
Expand Down

0 comments on commit 7c483b6

Please sign in to comment.