]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Use GnuTLS RC4 for RAP SAM test
authorAndreas Schneider <asn@samba.org>
Wed, 20 Feb 2019 14:52:49 +0000 (15:52 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 26 Jul 2019 01:48:25 +0000 (01:48 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031

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

index 4ca7b793decdf7ea532ee96d8fd4d7698ab83b75..3c13849b398049fac53c128711141b57acf773a7 100644 (file)
 #include "torture/util.h"
 #include "libcli/rap/rap.h"
 #include "torture/rap/proto.h"
-#include "../lib/crypto/crypto.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "torture/rpc/torture_rpc.h"
 
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
+
 #define TEST_RAP_USER "torture_rap_user"
 
 static char *samr_rand_pass(TALLOC_CTX *mem_ctx, int min_len)
@@ -137,6 +139,11 @@ static bool test_oemchangepassword_args(struct torture_context *tctx,
        char *newpass = samr_rand_pass(tctx, 9);
        uint8_t old_pw_hash[16];
        uint8_t new_pw_hash[16];
+       gnutls_cipher_hd_t cipher_hnd = NULL;
+       gnutls_datum_t pw_key = {
+               .data = old_pw_hash,
+               .size = sizeof(old_pw_hash),
+       };
 
        r.in.UserName = username;
 
@@ -144,7 +151,15 @@ static bool test_oemchangepassword_args(struct torture_context *tctx,
        E_deshash(newpass, new_pw_hash);
 
        encode_pw_buffer(r.in.crypt_password, newpass, STR_ASCII);
-       arcfour_crypt(r.in.crypt_password, old_pw_hash, 516);
+
+       gnutls_cipher_init(&cipher_hnd,
+                          GNUTLS_CIPHER_ARCFOUR_128,
+                          &pw_key,
+                          NULL);
+       gnutls_cipher_encrypt(cipher_hnd,
+                             r.in.crypt_password,
+                             516);
+       gnutls_cipher_deinit(cipher_hnd);
        E_old_pw_hash(new_pw_hash, old_pw_hash, r.in.password_hash);
 
        torture_comment(tctx, "Testing rap_NetOEMChangePassword(%s)\n", r.in.UserName);