mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-25 02:28:11 +00:00
aria: use mbedtls_zeroize()
This commit is contained in:
parent
c76ceb677b
commit
56453937a1
1 changed files with 6 additions and 2 deletions
|
@ -48,6 +48,11 @@
|
||||||
|
|
||||||
#if !defined(MBEDTLS_ARIA_ALT)
|
#if !defined(MBEDTLS_ARIA_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;
|
||||||
|
}
|
||||||
|
|
||||||
// 32-bit integer manipulation macros (little endian)
|
// 32-bit integer manipulation macros (little endian)
|
||||||
|
|
||||||
#ifndef GET_UINT32_LE
|
#ifndef GET_UINT32_LE
|
||||||
|
@ -489,8 +494,7 @@ void mbedtls_aria_free( mbedtls_aria_context *ctx )
|
||||||
if( ctx == NULL )
|
if( ctx == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// compiler can't remove this since this is not a static function
|
mbedtls_zeroize( ctx, sizeof( mbedtls_aria_context ) );
|
||||||
memset( ctx, 0, sizeof( mbedtls_aria_context ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
#if defined(MBEDTLS_CIPHER_MODE_CBC)
|
||||||
|
|
Loading…
Reference in a new issue