From a4abcf3ded1670c05d0310f84989338023512dee Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 6 Nov 2018 17:00:59 +0100 Subject: [PATCH] s4:torture: Use GnuTLS MD5 in ntp_signd test Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source4/torture/ntp/ntp_signd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source4/torture/ntp/ntp_signd.c b/source4/torture/ntp/ntp_signd.c index d2a41819fcf..124c9604871 100644 --- a/source4/torture/ntp/ntp_signd.c +++ b/source4/torture/ntp/ntp_signd.c @@ -26,7 +26,6 @@ #include "lib/tsocket/tsocket.h" #include "libcli/util/tstream.h" #include "torture/rpc/torture_rpc.h" -#include "../lib/crypto/crypto.h" #include "libcli/auth/libcli_auth.h" #include "librpc/gen_ndr/ndr_netlogon_c.h" #include "librpc/gen_ndr/ndr_ntp_signd.h" @@ -34,6 +33,9 @@ #include "system/network.h" #include "torture/ntp/proto.h" +#include +#include + #define TEST_MACHINE_NAME "ntpsigndtest" struct signd_client_state { @@ -79,7 +81,7 @@ static bool test_ntp_signd(struct torture_context *tctx, char *unix_address; int sys_errno; - MD5_CTX ctx; + gnutls_hash_hd_t hash_hnd; uint8_t sig[16]; enum ndr_err_code ndr_err; bool ok; @@ -269,11 +271,12 @@ static bool test_ntp_signd(struct torture_context *tctx, "Incorrect RID in reply"); /* Check computed signature */ - MD5Init(&ctx); - MD5Update(&ctx, pwhash->hash, sizeof(pwhash->hash)); - MD5Update(&ctx, sign_req.packet_to_sign.data, - sign_req.packet_to_sign.length); - MD5Final(sig, &ctx); + gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5); + gnutls_hash(hash_hnd, pwhash->hash, sizeof(pwhash->hash)); + gnutls_hash(hash_hnd, + sign_req.packet_to_sign.data, + sign_req.packet_to_sign.length); + gnutls_hash_deinit(hash_hnd, sig); torture_assert_mem_equal(tctx, &signed_reply.signed_packet.data[sign_req.packet_to_sign.length + 4], -- 2.47.3