From 6fe2193b17ac2d57c559d3b936b37238d06d6be8 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 1 Jul 2019 16:54:15 +0200 Subject: s3:profile: Use SHA1 for hashing in profiling functions. This can use SHA NI instructions if the CPU supports it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14031 Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- source3/profile/profile.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source3/profile') diff --git a/source3/profile/profile.c b/source3/profile/profile.c index df0ba5b0af3..90a30f01f58 100644 --- a/source3/profile/profile.c +++ b/source3/profile/profile.c @@ -124,7 +124,7 @@ static void reqprofile_message(struct messaging_context *msg_ctx, ******************************************************************/ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) { - unsigned char tmp[16] = {}; + uint8_t digest[gnutls_hash_get_len(GNUTLS_DIG_SHA1)]; gnutls_hash_hd_t hash_hnd = NULL; char *db_name; bool ok = false; @@ -154,7 +154,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) reqprofile_message); } - rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5); + rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_SHA1); if (rc < 0) { goto out; } @@ -210,15 +210,14 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly) goto out; } - gnutls_hash_deinit(hash_hnd, tmp); + gnutls_hash_deinit(hash_hnd, digest); profile_p = &smbprofile_state.stats.global; - profile_p->magic = BVAL(tmp, 0); + profile_p->magic = BVAL(digest, 0); if (profile_p->magic == 0) { - profile_p->magic = BVAL(tmp, 8); + profile_p->magic = BVAL(digest, 8); } - ZERO_ARRAY(tmp); ok = true; out: -- cgit v1.2.1