37 lines
1.1 KiB
Diff
37 lines
1.1 KiB
Diff
From 26a8b6535159e3f7fb4a6204373b195f09e3bc20 Mon Sep 17 00:00:00 2001
|
|
From: Andreas Schneider <asn@cryptomilk.org>
|
|
Date: Tue, 11 Feb 2020 11:52:33 +0100
|
|
Subject: [PATCH] CVE-2020-1730: Fix a possible segfault when zeroing AES-CTR
|
|
key
|
|
|
|
Fixes T213
|
|
|
|
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
|
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
|
---
|
|
src/libcrypto.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/libcrypto.c b/src/libcrypto.c
|
|
index b24a18f..2d692cd 100644
|
|
--- a/src/libcrypto.c
|
|
+++ b/src/libcrypto.c
|
|
@@ -638,8 +638,12 @@ static void aes_ctr_encrypt(struct ssh_cipher_struct *cipher, void *in, void *ou
|
|
}
|
|
|
|
static void aes_ctr_cleanup(struct ssh_cipher_struct *cipher){
|
|
- explicit_bzero(cipher->aes_key, sizeof(*cipher->aes_key));
|
|
- SAFE_FREE(cipher->aes_key);
|
|
+ if (cipher != NULL) {
|
|
+ if (cipher->aes_key != NULL) {
|
|
+ explicit_bzero(cipher->aes_key, sizeof(*cipher->aes_key));
|
|
+ }
|
|
+ SAFE_FREE(cipher->aes_key);
|
|
+ }
|
|
}
|
|
|
|
#endif /* HAVE_OPENSSL_EVP_AES_CTR */
|
|
--
|
|
1.8.3.1
|
|
|