]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4_torture: Use GnuTLS RC4 in test_ChangePasswordUser2
authorAndreas Schneider <asn@samba.org>
Wed, 24 Jul 2019 14:24:18 +0000 (16:24 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Jul 2019 01:48:25 +0000 (01:48 +0000)
This uses STR_ASCII as string encodings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/rpc/samr.c

index 5bf758e2fb27f7888b0d720057854cd3a4568078..7f1da86d19aed051f9d03ef3604986c9f3baef27 100644 (file)
@@ -2267,6 +2267,16 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
        struct lsa_String domain_name;
        NTSTATUS status;
 
+       gnutls_cipher_hd_t cipher_hnd = NULL;
+       gnutls_datum_t old_lm_key = {
+               .data = old_lm_hash,
+               .size = sizeof(old_lm_hash),
+       };
+       gnutls_datum_t old_nt_key = {
+               .data = old_nt_hash,
+               .size = sizeof(old_nt_hash),
+       };
+
        domain_name.string = "";
        dom_pw_info.in.domain_name = &domain_name;
        dom_pw_info.out.info = &info;
@@ -2298,7 +2308,16 @@ static bool test_ChangePasswordUser2(struct dcerpc_pipe *p, struct torture_conte
        E_deshash(newpass, new_lm_hash);
 
        encode_pw_buffer(lm_pass.data, newpass, STR_ASCII|STR_TERMINATE);
-       arcfour_crypt(lm_pass.data, old_lm_hash, 516);
+
+       gnutls_cipher_init(&cipher_hnd,
+                          GNUTLS_CIPHER_ARCFOUR_128,
+                          &old_lm_key,
+                          NULL);
+       gnutls_cipher_encrypt(cipher_hnd,
+                             lm_pass.data,
+                             516);
+       gnutls_cipher_deinit(cipher_hnd);
+
        E_old_pw_hash(new_nt_hash, old_lm_hash, lm_verifier.hash);
 
        status = init_samr_CryptPassword(newpass,