mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +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
|
|
@ -44,6 +44,11 @@
|
|||
#include "polarssl/ecdsa.h"
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise a pk_context
|
||||
*/
|
||||
|
|
@ -65,9 +70,8 @@ void pk_free( pk_context *ctx )
|
|||
return;
|
||||
|
||||
ctx->pk_info->ctx_free_func( ctx->pk_ctx );
|
||||
ctx->pk_ctx = NULL;
|
||||
|
||||
ctx->pk_info = NULL;
|
||||
polarssl_zeroize( ctx, sizeof( pk_context ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue