Skip to content

Commit 93e0f64

Browse files
author
Ron Eldor
committed
Use mbedtls_platform_zeroize
Rplace calls to `mbedtls_zeroize()` to `mbedtls_platform_zeroize()`.
1 parent 8cc8481 commit 93e0f64

File tree

1 file changed

+2
-7
lines changed
  • features/cryptocell/FEATURE_CRYPTOCELL310

1 file changed

+2
-7
lines changed

features/cryptocell/FEATURE_CRYPTOCELL310/ccm_alt.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,17 @@
2222
#if defined(MBEDTLS_CCM_ALT)
2323
#include <string.h>
2424
#include "mbedtls/platform.h"
25+
#include "mbedtls/platform_util.h"
2526
#include "mbedtls/aes.h"
2627

27-
/* Implementation that should never be optimized out by the compiler */
28-
static void mbedtls_zeroize( void *v, size_t n ) {
29-
volatile unsigned char *p = (unsigned char*)v;
30-
while( n-- ) *p++ = 0;
31-
}
32-
3328
void mbedtls_ccm_init( mbedtls_ccm_context *ctx )
3429
{
3530
memset( ctx, 0, sizeof( mbedtls_ccm_context ) );
3631
}
3732

3833
void mbedtls_ccm_free( mbedtls_ccm_context *ctx )
3934
{
40-
mbedtls_zeroize( ctx, sizeof( mbedtls_ccm_context ) );
35+
mbedtls_platform_zeroize( ctx, sizeof( mbedtls_ccm_context ) );
4136
}
4237

4338
int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,

0 commit comments

Comments
 (0)