|
|
b6b438 |
From 5568783eefaeae47e883f1896dbe12a1bffb374b Mon Sep 17 00:00:00 2001
|
|
|
b6b438 |
From: Isaac Boukris <iboukris@gmail.com>
|
|
|
b6b438 |
Date: Tue, 19 Nov 2019 18:26:13 +0100
|
|
|
b6b438 |
Subject: [PATCH 167/187] selftest: test E_P24 and SMBOWFencrypt
|
|
|
b6b438 |
|
|
|
b6b438 |
Signed-off-by: Isaac Boukris <iboukris@samba.org>
|
|
|
b6b438 |
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
|
|
|
b6b438 |
(cherry picked from commit dfad082596a53a7c6225da427447922fd4b7f0e2)
|
|
|
b6b438 |
---
|
|
|
b6b438 |
libcli/auth/tests/test_gnutls.c | 44 +++++++++++++++++++++++++++++++++
|
|
|
b6b438 |
1 file changed, 44 insertions(+)
|
|
|
b6b438 |
|
|
|
b6b438 |
diff --git a/libcli/auth/tests/test_gnutls.c b/libcli/auth/tests/test_gnutls.c
|
|
|
b6b438 |
index bef4b5d3cc2..3f6efa62424 100644
|
|
|
b6b438 |
--- a/libcli/auth/tests/test_gnutls.c
|
|
|
b6b438 |
+++ b/libcli/auth/tests/test_gnutls.c
|
|
|
b6b438 |
@@ -269,6 +269,48 @@ static void torture_gnutls_E_P16(void **state)
|
|
|
b6b438 |
assert_memory_equal(buffer, crypt_expected, 16);
|
|
|
b6b438 |
}
|
|
|
b6b438 |
|
|
|
b6b438 |
+static void torture_gnutls_E_P24(void **state)
|
|
|
b6b438 |
+{
|
|
|
b6b438 |
+ static const uint8_t key[21] = {
|
|
|
b6b438 |
+ 0xFB, 0x67, 0x99, 0xA4, 0x83, 0xF3, 0xD4, 0xED,
|
|
|
b6b438 |
+ 0x98, 0xFD, 0xCB, 0x3A, 0xF7, 0xB5, 0x1C, 0xF8,
|
|
|
b6b438 |
+ 0x69, 0x88, 0x96, 0x8E, 0x3A
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+ const uint8_t c8[8] = {
|
|
|
b6b438 |
+ 0x44, 0xFB, 0xAC, 0xFB, 0x83, 0xB6, 0x75, 0x2A
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+ static const uint8_t crypt_expected[24] = {
|
|
|
b6b438 |
+ 0x1A, 0x5E, 0x11, 0xA1, 0x59, 0xA9, 0x6B, 0x4E,
|
|
|
b6b438 |
+ 0x12, 0x5D, 0x81, 0x75, 0xA6, 0x62, 0x15, 0x6D,
|
|
|
b6b438 |
+ 0x5D, 0x20, 0x25, 0xC1, 0xA3, 0x92, 0xB3, 0x28
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ uint8_t crypt[24];
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ E_P24(key, c8, crypt);
|
|
|
b6b438 |
+ assert_memory_equal(crypt, crypt_expected, 24);
|
|
|
b6b438 |
+}
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+static void torture_gnutls_SMBOWFencrypt(void **state)
|
|
|
b6b438 |
+{
|
|
|
b6b438 |
+ static const uint8_t password[16] = {
|
|
|
b6b438 |
+ 'M', 'y', 'p', 'a', 's', 's', 'w', 'o',
|
|
|
b6b438 |
+ 'r', 'd', 'i', 's', '1', '1', '1', '1'
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+ const uint8_t c8[8] = {
|
|
|
b6b438 |
+ 0x79, 0x88, 0x5A, 0x3D, 0xD3, 0x40, 0x1E, 0x69
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+ static const uint8_t crypt_expected[24] = {
|
|
|
b6b438 |
+ 0x3F, 0xE3, 0x53, 0x75, 0x81, 0xB4, 0xF0, 0xE7,
|
|
|
b6b438 |
+ 0x0C, 0xDE, 0xCD, 0xAE, 0x39, 0x1F, 0x14, 0xB4,
|
|
|
b6b438 |
+ 0xA4, 0x2B, 0x3E, 0x39, 0x16, 0xFD, 0x1D, 0x62
|
|
|
b6b438 |
+ };
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ uint8_t crypt[24];
|
|
|
b6b438 |
+
|
|
|
b6b438 |
+ SMBOWFencrypt(password, c8, crypt);
|
|
|
b6b438 |
+ assert_memory_equal(crypt, crypt_expected, 24);
|
|
|
b6b438 |
+}
|
|
|
b6b438 |
static void torture_gnutls_sam_rid_crypt(void **state)
|
|
|
b6b438 |
{
|
|
|
b6b438 |
static const uint8_t clear[16] = {
|
|
|
b6b438 |
@@ -298,6 +340,8 @@ int main(int argc, char *argv[])
|
|
|
b6b438 |
cmocka_unit_test(torture_gnutls_aes_128_cfb),
|
|
|
b6b438 |
cmocka_unit_test(torture_gnutls_des_crypt56),
|
|
|
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_sam_rid_crypt),
|
|
|
b6b438 |
};
|
|
|
b6b438 |
|
|
|
b6b438 |
--
|
|
|
b6b438 |
2.23.0
|
|
|
b6b438 |
|