1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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 <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Andreas Schneider 2019-07-01 16:54:15 +02:00 committed by Andreas Schneider
parent 36f021f74d
commit 6fe2193b17

View File

@ -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: