mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Add _init() and _free() for cipher modules
This commit is contained in:
parent
0464dd9357
commit
c7ea99af4f
17 changed files with 375 additions and 61 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue