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