mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 08:16:33 +01:00
Introduce polarssl_zeroize() instead of memset() for zeroization
This commit is contained in:
parent
bbcb1ce703
commit
3461772559
36 changed files with 325 additions and 129 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;
|
||||
}
|
||||
|
||||
void x509write_csr_init( x509write_csr *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof(x509write_csr) );
|
||||
|
|
@ -57,7 +62,7 @@ void x509write_csr_free( x509write_csr *ctx )
|
|||
asn1_free_named_data_list( &ctx->subject );
|
||||
asn1_free_named_data_list( &ctx->extensions );
|
||||
|
||||
memset( ctx, 0, sizeof(x509write_csr) );
|
||||
polarssl_zeroize( ctx, sizeof(x509write_csr) );
|
||||
}
|
||||
|
||||
void x509write_csr_set_md_alg( x509write_csr *ctx, md_type_t md_alg )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue