summaryrefslogtreecommitdiff
path: root/source3/profile
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2019-07-01 16:54:15 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-07-09 12:16:10 +0000
commit6fe2193b17ac2d57c559d3b936b37238d06d6be8 (patch)
treea3280a50dc41f521b485a2d032973a8d53ea9214 /source3/profile
parent36f021f74d9739a9c73b95fc7d6f821bbf7cafdd (diff)
downloadsamba-6fe2193b17ac2d57c559d3b936b37238d06d6be8.tar.gz
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>
Diffstat (limited to 'source3/profile')
-rw-r--r--source3/profile/profile.c11
1 files changed, 5 insertions, 6 deletions
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: