mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 09:28:24 +00:00
Use polarssl_zeroize() in asn1parse too
This commit is contained in:
parent
a676acf66b
commit
8ef7088bb9
1 changed files with 7 additions and 2 deletions
|
@ -47,6 +47,11 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Implementation that should never be optimized out by the compiler */
|
||||
static void polarssl_zeroize( void *v, size_t n ) {
|
||||
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* ASN.1 DER decoding routines
|
||||
*/
|
||||
|
@ -311,7 +316,7 @@ int asn1_get_alg( unsigned char **p,
|
|||
|
||||
if( *p == end )
|
||||
{
|
||||
memset( params, 0, sizeof(asn1_buf) );
|
||||
polarssl_zeroize( params, sizeof(asn1_buf) );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
@ -356,7 +361,7 @@ void asn1_free_named_data( asn1_named_data *cur )
|
|||
polarssl_free( cur->oid.p );
|
||||
polarssl_free( cur->val.p );
|
||||
|
||||
memset( cur, 0, sizeof( asn1_named_data ) );
|
||||
polarssl_zeroize( cur, sizeof( asn1_named_data ) );
|
||||
}
|
||||
|
||||
void asn1_free_named_data_list( asn1_named_data **head )
|
||||
|
|
Loading…
Reference in a new issue