b6b438
From 74f61d6ecf74311a12e8454f2ce12a4b63bbfe90 Mon Sep 17 00:00:00 2001
b6b438
From: Andreas Schneider <asn@samba.org>
b6b438
Date: Wed, 24 Jul 2019 16:01:31 +0200
b6b438
Subject: [PATCH 053/187] s4:torture: Use GnuTLS RC4 in
b6b438
 test_ChangePasswordRandomBytes
b6b438
b6b438
Signed-off-by: Andreas Schneider <asn@samba.org>
b6b438
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
b6b438
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
b6b438
(cherry picked from commit 82a6480611f791a3c26fcf70975e6f8b3b1757ad)
b6b438
---
b6b438
 source4/torture/rpc/samr.c | 16 +++++++++++++++-
b6b438
 1 file changed, 15 insertions(+), 1 deletion(-)
b6b438
b6b438
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
b6b438
index 10377850314..10bdd52fd47 100644
b6b438
--- a/source4/torture/rpc/samr.c
b6b438
+++ b/source4/torture/rpc/samr.c
b6b438
@@ -2796,6 +2796,11 @@ bool test_ChangePasswordRandomBytes(struct dcerpc_pipe *p, struct torture_contex
b6b438
 	NTTIME t;
b6b438
 	struct samr_DomInfo1 *dominfo = NULL;
b6b438
 	struct userPwdChangeFailureInformation *reject = NULL;
b6b438
+	gnutls_cipher_hd_t cipher_hnd = NULL;
b6b438
+	gnutls_datum_t old_nt_key = {
b6b438
+		.data = old_nt_hash,
b6b438
+		.size = sizeof(old_nt_hash),
b6b438
+	};
b6b438
 
b6b438
 	new_random_pass = samr_very_rand_pass(tctx, 128);
b6b438
 
b6b438
@@ -2855,7 +2860,16 @@ bool test_ChangePasswordRandomBytes(struct dcerpc_pipe *p, struct torture_contex
b6b438
 	mdfour(new_nt_hash, new_random_pass.data, new_random_pass.length);
b6b438
 
b6b438
 	set_pw_in_buffer(nt_pass.data, &new_random_pass);
b6b438
-	arcfour_crypt(nt_pass.data, old_nt_hash, 516);
b6b438
+
b6b438
+	gnutls_cipher_init(&cipher_hnd,
b6b438
+			   GNUTLS_CIPHER_ARCFOUR_128,
b6b438
+			   &old_nt_key,
b6b438
+			   NULL);
b6b438
+	gnutls_cipher_encrypt(cipher_hnd,
b6b438
+			      nt_pass.data,
b6b438
+			      516);
b6b438
+	gnutls_cipher_deinit(cipher_hnd);
b6b438
+
b6b438
 	E_old_pw_hash(new_nt_hash, old_nt_hash, nt_verifier.hash);
b6b438
 
b6b438
 	r.in.server = &server;
b6b438
-- 
b6b438
2.23.0
b6b438