b6b438
From b074df7982a4783c88b23a4973662e144362eb2e Mon Sep 17 00:00:00 2001
b6b438
From: Isaac Boukris <iboukris@gmail.com>
b6b438
Date: Tue, 19 Nov 2019 18:49:58 +0100
b6b438
Subject: [PATCH 168/187] selftest: test E_old_pw_hash
b6b438
b6b438
Signed-off-by: Isaac Boukris <iboukris@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
(cherry picked from commit 8f042ba532fc645f2389a0a9d3e83d27c070fde4)
b6b438
---
b6b438
 libcli/auth/tests/test_gnutls.c | 22 ++++++++++++++++++++++
b6b438
 1 file changed, 22 insertions(+)
b6b438
b6b438
diff --git a/libcli/auth/tests/test_gnutls.c b/libcli/auth/tests/test_gnutls.c
b6b438
index 3f6efa62424..1e6f8dd5b5b 100644
b6b438
--- a/libcli/auth/tests/test_gnutls.c
b6b438
+++ b/libcli/auth/tests/test_gnutls.c
b6b438
@@ -311,6 +311,27 @@ static void torture_gnutls_SMBOWFencrypt(void **state)
b6b438
 	SMBOWFencrypt(password, c8, crypt);
b6b438
 	assert_memory_equal(crypt, crypt_expected, 24);
b6b438
 }
b6b438
+
b6b438
+static void torture_gnutls_E_old_pw_hash(void **state)
b6b438
+{
b6b438
+	static uint8_t key[14] = {
b6b438
+		0x98, 0xFD, 0xCB, 0x3A, 0xF7, 0xB5, 0x1C, 0xF8,
b6b438
+		0x69, 0x88, 0x96, 0x8E, 0xB5, 0x3A
b6b438
+	};
b6b438
+	uint8_t clear[16] = {
b6b438
+		0x9C, 0x14, 0xDD, 0xE1, 0x39, 0x23, 0xE0, 0x55,
b6b438
+		0x3F, 0x49, 0x5B, 0x20, 0xA7, 0x84, 0xC2, 0x34
b6b438
+	};
b6b438
+	static const uint8_t crypt_expected[16] = {
b6b438
+		0x6A, 0xC7, 0x08, 0xCA, 0x2A, 0xC1, 0xAA, 0x64,
b6b438
+		0x37, 0xEF, 0xBE, 0x58, 0xC2, 0x59, 0x33, 0xEC
b6b438
+	};
b6b438
+	uint8_t crypt[16];
b6b438
+
b6b438
+	E_old_pw_hash(key, clear, crypt);
b6b438
+	assert_memory_equal(crypt, crypt_expected, 16);
b6b438
+}
b6b438
+
b6b438
 static void torture_gnutls_sam_rid_crypt(void **state)
b6b438
 {
b6b438
 	static const uint8_t clear[16] = {
b6b438
@@ -342,6 +363,7 @@ int main(int argc, char *argv[])
b6b438
 		cmocka_unit_test(torture_gnutls_E_P16),
b6b438
 		cmocka_unit_test(torture_gnutls_E_P24),
b6b438
 		cmocka_unit_test(torture_gnutls_SMBOWFencrypt),
b6b438
+		cmocka_unit_test(torture_gnutls_E_old_pw_hash),
b6b438
 		cmocka_unit_test(torture_gnutls_sam_rid_crypt),
b6b438
 	};
b6b438
 
b6b438
-- 
b6b438
2.23.0
b6b438