libcli:smb: Zero sensitive memory after use
authorAndreas Schneider <asn@samba.org>
Thu, 11 Oct 2018 12:33:52 +0000 (14:33 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 27 Feb 2019 00:35:19 +0000 (01:35 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/smb/smb2_signing.c

index 614a2b3..18f5911 100644 (file)
@@ -76,6 +76,8 @@ NTSTATUS smb2_signing_sign_pdu(DATA_BLOB signing_key,
                                        vector[i].iov_len);
                }
                aes_cmac_128_final(&ctx, res);
+
+               ZERO_ARRAY(key);
        } else {
                struct HMACSHA256Context m;
                uint8_t digest[SHA256_DIGEST_LENGTH];
@@ -149,6 +151,8 @@ NTSTATUS smb2_signing_check_pdu(DATA_BLOB signing_key,
                                        vector[i].iov_len);
                }
                aes_cmac_128_final(&ctx, res);
+
+               ZERO_ARRAY(key);
        } else {
                struct HMACSHA256Context m;
                uint8_t digest[SHA256_DIGEST_LENGTH];