diff --git a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c index 5bed8717..6d3eacbd 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/stream_salsa20_ref.c @@ -6,6 +6,7 @@ Public domain. #include "api.h" #include "crypto_core_salsa20.h" +#include "utils.h" #ifndef HAVE_AMD64_ASM @@ -51,6 +52,9 @@ int crypto_stream( crypto_core_salsa20(block,in,kcopy,sigma); for (i = 0;i < clen;++i) c[i] = block[i]; } + sodium_memzero(block, sizeof block); + sodium_memzero(kcopy, sizeof kcopy); + return 0; } diff --git a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c index 47d07e0a..2b44c4a3 100644 --- a/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c +++ b/src/libsodium/crypto_stream/salsa20/ref/xor_salsa20_ref.c @@ -6,6 +6,7 @@ Public domain. #include "api.h" #include "crypto_core_salsa20.h" +#include "utils.h" #ifndef HAVE_AMD64_ASM @@ -54,6 +55,9 @@ int crypto_stream_xor( crypto_core_salsa20(block,in,kcopy,sigma); for (i = 0;i < mlen;++i) c[i] = m[i] ^ block[i]; } + sodium_memzero(block, sizeof block); + sodium_memzero(kcopy, sizeof kcopy); + return 0; }