Blob Blame History Raw
From b99a520661dbfcdd69da38be9ab35ed8a69a0b6d Mon Sep 17 00:00:00 2001
From: Isaac Boukris <iboukris@gmail.com>
Date: Tue, 19 Nov 2019 09:46:18 +0100
Subject: [PATCH 165/187] selftest: test E_P16

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 7044a41a30e43dda34eecb6df3da82ed5d568eec)
---
 libcli/auth/tests/test_gnutls.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libcli/auth/tests/test_gnutls.c b/libcli/auth/tests/test_gnutls.c
index 7847d01a4dc..a2b7cb896d0 100644
--- a/libcli/auth/tests/test_gnutls.c
+++ b/libcli/auth/tests/test_gnutls.c
@@ -250,12 +250,32 @@ static void torture_gnutls_des_crypt56(void **state)
 	assert_memory_equal(decrypt, clear, 8);
 }
 
+static void torture_gnutls_E_P16(void **state)
+{
+	static const uint8_t key[14] = {
+		0x98, 0xFD, 0xCB, 0x3A, 0xF7, 0xB5, 0x1C, 0xF8,
+		0x69, 0x88, 0x96, 0x8E, 0xB5, 0x3A
+	};
+	uint8_t buffer[16] = {
+		0x9C, 0x14, 0xDD, 0xE1, 0x39, 0x23, 0xE0, 0x55,
+		0x3F, 0x49, 0x5B, 0x20, 0xA7, 0x84, 0xC2, 0x34
+	};
+	static const uint8_t crypt_expected[16] = {
+		0x41, 0x4A, 0x7B, 0xEA, 0xAB, 0xBB, 0x95, 0xCE,
+		0x1D, 0xEA, 0xD9, 0xFF, 0xB0, 0xA9, 0xA4, 0x05
+	};
+
+	E_P16(key, buffer);
+	assert_memory_equal(buffer, crypt_expected, 16);
+}
+
 int main(int argc, char *argv[])
 {
 	int rc;
 	const struct CMUnitTest tests[] = {
 		cmocka_unit_test(torture_gnutls_aes_128_cfb),
 		cmocka_unit_test(torture_gnutls_des_crypt56),
+		cmocka_unit_test(torture_gnutls_E_P16),
 	};
 
 	if (argc == 2) {
-- 
2.23.0