mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Add _init() and _free() for cipher modules
This commit is contained in:
@ -41,6 +41,11 @@
|
||||
|
||||
#if !defined(POLARSSL_BLOWFISH_ALT)
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (big endian)
|
||||
*/
|
||||
@ -152,6 +157,19 @@ static void blowfish_dec( blowfish_context *ctx, uint32_t *xl, uint32_t *xr )
|
||||
*xr = Xr;
|
||||
}
|
||||
|
||||
void blowfish_init( blowfish_context *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof( blowfish_context ) );
|
||||
}
|
||||
|
||||
void blowfish_free( blowfish_context *ctx )
|
||||
{
|
||||
if( ctx == NULL )
|
||||
return;
|
||||
|
||||
polarssl_zeroize( ctx, sizeof( blowfish_context ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* Blowfish key schedule
|
||||
*/
|
||||
|
Reference in New Issue
Block a user