b6b438
From b7700aa619a69f652b350b89a5a67a989658a474 Mon Sep 17 00:00:00 2001
b6b438
From: Andreas Schneider <asn@samba.org>
b6b438
Date: Wed, 24 Jul 2019 16:00:32 +0200
b6b438
Subject: [PATCH 049/187] s4:torture: Use GnuTLS RC4 in
b6b438
 test_ChangePasswordUser2_ntstatus
b6b438
b6b438
Signed-off-by: Andreas Schneider <asn@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
(cherry picked from commit a476a2e3322a550e2857cb5a66096fa3e46416d3)
b6b438
---
b6b438
 source4/torture/rpc/samr.c | 20 +++++++++++++++-----
b6b438
 1 file changed, 15 insertions(+), 5 deletions(-)
b6b438
b6b438
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
b6b438
index 7f1da86d19a..307b0b03594 100644
b6b438
--- a/source4/torture/rpc/samr.c
b6b438
+++ b/source4/torture/rpc/samr.c
b6b438
@@ -2272,10 +2272,6 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
b6b438
 		.data = old_lm_hash,
b6b438
 		.size = sizeof(old_lm_hash),
b6b438
 	};
b6b438
-	gnutls_datum_t old_nt_key = {
b6b438
-		.data = old_nt_hash,
b6b438
-		.size = sizeof(old_nt_hash),
b6b438
-	};
b6b438
 
b6b438
 	domain_name.string = "";
b6b438
 	dom_pw_info.in.domain_name = &domain_name;
b6b438
@@ -2370,6 +2366,11 @@ static bool test_ChangePasswordUser2_ntstatus(struct dcerpc_pipe *p, struct tort
b6b438
 	uint8_t old_lm_hash[16], new_lm_hash[16];
b6b438
 	DATA_BLOB old_nt_hash_blob
b6b438
 		= data_blob_const(old_nt_hash, sizeof(old_nt_hash));
b6b438
+	gnutls_cipher_hd_t cipher_hnd = NULL;
b6b438
+	gnutls_datum_t old_lm_key = {
b6b438
+		.data = old_lm_hash,
b6b438
+		.size = sizeof(old_lm_hash),
b6b438
+	};
b6b438
 
b6b438
 	struct samr_GetDomPwInfo dom_pw_info;
b6b438
 	struct samr_PwInfo info;
b6b438
@@ -2406,7 +2407,16 @@ static bool test_ChangePasswordUser2_ntstatus(struct dcerpc_pipe *p, struct tort
b6b438
 	E_deshash(newpass, new_lm_hash);
b6b438
 
b6b438
 	encode_pw_buffer(lm_pass.data, newpass, STR_ASCII|STR_TERMINATE);
b6b438
-	arcfour_crypt(lm_pass.data, old_lm_hash, 516);
b6b438
+
b6b438
+	gnutls_cipher_init(&cipher_hnd,
b6b438
+			   GNUTLS_CIPHER_ARCFOUR_128,
b6b438
+			   &old_lm_key,
b6b438
+			   NULL);
b6b438
+	gnutls_cipher_encrypt(cipher_hnd,
b6b438
+			      lm_pass.data,
b6b438
+			      516);
b6b438
+	gnutls_cipher_deinit(cipher_hnd);
b6b438
+
b6b438
 	E_old_pw_hash(new_nt_hash, old_lm_hash, lm_verifier.hash);
b6b438
 
b6b438
 	crypt_status = init_samr_CryptPassword(newpass,
b6b438
-- 
b6b438
2.23.0
b6b438