s4:torture: Use GnuTLS RC4 in rpc forest_trust test
authorAndreas Schneider <asn@samba.org>
Thu, 21 Feb 2019 10:06:23 +0000 (11:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 27 Jun 2019 14:11:39 +0000 (14:11 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun 27 14:11:39 UTC 2019 on sn-devel-184

source4/torture/rpc/forest_trust.c

index 215aa436c8d8238d3508c2c1e2a389da6117ab55..118f0d27c53efeb6a45e81df26013a2bb639795b 100644 (file)
@@ -30,7 +30,9 @@
 #include "libcli/auth/libcli_auth.h"
 #include "torture/rpc/torture_rpc.h"
 #include "param/param.h"
-#include "../lib/crypto/crypto.h"
+
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
 
 #define TEST_DOM "torturedom"
 #define TEST_DOM_DNS "torturedom.samba.example.com"
@@ -687,6 +689,8 @@ static bool test_setup_trust(struct torture_context *tctx,
        DATA_BLOB session_key;
        struct lsa_TrustDomainInfoAuthInfoInternal authinfo;
        NTSTATUS status;
+       gnutls_cipher_hd_t cipher_hnd = NULL;
+       gnutls_datum_t _session_key;
 
        if (!check_name(p, tctx, netbios_name)) {
                return false;
@@ -709,8 +713,19 @@ static bool test_setup_trust(struct torture_context *tctx,
        }
        authinfo.auth_blob.size = auth_blob->length;
 
-       arcfour_crypt_blob(authinfo.auth_blob.data, authinfo.auth_blob.size,
-                          &session_key);
+       _session_key = (gnutls_datum_t) {
+               .data = session_key.data,
+               .size = session_key.length,
+       };
+
+       gnutls_cipher_init(&cipher_hnd,
+                          GNUTLS_CIPHER_ARCFOUR_128,
+                          &_session_key,
+                          NULL);
+       gnutls_cipher_encrypt(cipher_hnd,
+                             authinfo.auth_blob.data,
+                             authinfo.auth_blob.size);
+       gnutls_cipher_deinit(cipher_hnd);
 
        if (!test_create_trust_and_set_info(p, tctx, netbios_name,
                                            dns_name, sid, &authinfo)) {