Merge pull request #281 from AndrzejKurek/IOTCRYPT-968-zeroize-aes-variables
Zeroize local AES variables before exiting the function
This commit is contained in:
commit
90bc6b8143
1 changed files with 24 additions and 0 deletions
|
@ -918,6 +918,18 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
|
||||||
PUT_UINT32_LE( X2, output, 8 );
|
PUT_UINT32_LE( X2, output, 8 );
|
||||||
PUT_UINT32_LE( X3, output, 12 );
|
PUT_UINT32_LE( X3, output, 12 );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &X0, sizeof( X0 ) );
|
||||||
|
mbedtls_platform_zeroize( &X1, sizeof( X1 ) );
|
||||||
|
mbedtls_platform_zeroize( &X2, sizeof( X2 ) );
|
||||||
|
mbedtls_platform_zeroize( &X3, sizeof( X3 ) );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &Y0, sizeof( Y0 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y1, sizeof( Y1 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y2, sizeof( Y2 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y3, sizeof( Y3 ) );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &RK, sizeof( RK ) );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
#endif /* !MBEDTLS_AES_ENCRYPT_ALT */
|
#endif /* !MBEDTLS_AES_ENCRYPT_ALT */
|
||||||
|
@ -986,6 +998,18 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
|
||||||
PUT_UINT32_LE( X2, output, 8 );
|
PUT_UINT32_LE( X2, output, 8 );
|
||||||
PUT_UINT32_LE( X3, output, 12 );
|
PUT_UINT32_LE( X3, output, 12 );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &X0, sizeof( X0 ) );
|
||||||
|
mbedtls_platform_zeroize( &X1, sizeof( X1 ) );
|
||||||
|
mbedtls_platform_zeroize( &X2, sizeof( X2 ) );
|
||||||
|
mbedtls_platform_zeroize( &X3, sizeof( X3 ) );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &Y0, sizeof( Y0 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y1, sizeof( Y1 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y2, sizeof( Y2 ) );
|
||||||
|
mbedtls_platform_zeroize( &Y3, sizeof( Y3 ) );
|
||||||
|
|
||||||
|
mbedtls_platform_zeroize( &RK, sizeof( RK ) );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
#endif /* !MBEDTLS_AES_DECRYPT_ALT */
|
#endif /* !MBEDTLS_AES_DECRYPT_ALT */
|
||||||
|
|
Loading…
Reference in a new issue