b6b438
From b21a4ac4a6d92d720e1e04b9eadf50cc59a4ebe5 Mon Sep 17 00:00:00 2001
b6b438
From: Andreas Schneider <asn@samba.org>
b6b438
Date: Wed, 24 Jul 2019 16:24:18 +0200
b6b438
Subject: [PATCH 048/187] s4_torture: Use GnuTLS RC4 in
b6b438
 test_ChangePasswordUser2
b6b438
b6b438
This uses STR_ASCII as string encodings.
b6b438
b6b438
Signed-off-by: Andreas Schneider <asn@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
(cherry picked from commit 9cbdf7b2e5f734e9b5e0e447d54d720d18977950)
b6b438
---
b6b438
 source4/torture/rpc/samr.c | 21 ++++++++++++++++++++-
b6b438
 1 file changed, 20 insertions(+), 1 deletion(-)
b6b438
b6b438
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
b6b438
index 5bf758e2fb2..7f1da86d19a 100644
b6b438
--- a/source4/torture/rpc/samr.c
b6b438
+++ b/source4/torture/rpc/samr.c
b6b438
@@ -2267,6 +2267,16 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
b6b438
 	struct lsa_String domain_name;
b6b438
 	NTSTATUS status;
b6b438
 
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
+	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
 	dom_pw_info.out.info = &info;
b6b438
@@ -2298,7 +2308,16 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
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
 	status = init_samr_CryptPassword(newpass,
b6b438
-- 
b6b438
2.23.0
b6b438