RSA: wipe more stack buffers
MGF mask and PSS salt are not highly sensitive, but wipe them anyway
for good hygiene.
diff --git a/library/rsa.c b/library/rsa.c
index 09477cb..8d7e9e6 100644
--- a/library/rsa.c
+++ b/library/rsa.c
@@ -492,6 +492,8 @@
dlen -= use_len;
}
+
+ polarssl_zeroize( mask, sizeof( mask ) );
}
#endif /* POLARSSL_PKCS1_V21 */
@@ -1011,6 +1013,7 @@
if( ( ret = md_init_ctx( &md_ctx, md_info ) ) != 0 )
{
md_free( &md_ctx );
+ /* No need to zeroize salt: we didn't use it. */
return( ret );
}
@@ -1021,6 +1024,7 @@
md_update( &md_ctx, hash, hashlen );
md_update( &md_ctx, salt, slen );
md_finish( &md_ctx, p );
+ polarssl_zeroize( salt, sizeof( salt ) );
// Compensate for boundary condition when applying mask
//