From ef0bee9228a1fc9eeec24b14d956a4140f0a7b37 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 20 Nov 2021 20:34:08 +0200 Subject: [PATCH] aes.cpp: Use secured memory resetting --- rpcs3/Crypto/aes.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rpcs3/Crypto/aes.cpp b/rpcs3/Crypto/aes.cpp index dae680de3e..bc81ede958 100644 --- a/rpcs3/Crypto/aes.cpp +++ b/rpcs3/Crypto/aes.cpp @@ -32,6 +32,8 @@ #include "aes.h" #include "aesni.h" +#include + /* * 32-bit integer manipulation macros (little endian) */ @@ -593,7 +595,8 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key, unsigned int key *RK++ = *SK++; done: - memset( &cty, 0, sizeof( aes_context ) ); + // Wipe the stack buffer clean + std::fill_n(reinterpret_cast(&cty), sizeof(cty), 0); return( 0 ); }