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