From: Andreas Schneider Date: Thu, 11 Oct 2018 12:43:24 +0000 (+0200) Subject: s3:modules: Use GnuTLS SHA256 in vfs_acl_common X-Git-Tag: tdb-1.4.1~265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bbb9f7bdf05e92498e01fb1ffacc770432d6709;p=thirdparty%2Fsamba.git s3:modules: Use GnuTLS SHA256 in vfs_acl_common Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 5cc75ca99c0..315dc2bd761 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -28,9 +28,11 @@ #include "../libcli/security/security.h" #include "../librpc/gen_ndr/ndr_security.h" #include "../lib/util/bitmap.h" -#include "lib/crypto/sha256.h" #include "passdb/lookup_sid.h" +#include +#include + static NTSTATUS create_acl_blob(const struct security_descriptor *psd, DATA_BLOB *pblob, uint16_t hash_type, @@ -81,13 +83,17 @@ bool init_acl_common_config(vfs_handle_struct *handle, static NTSTATUS hash_blob_sha256(DATA_BLOB blob, uint8_t *hash) { - SHA256_CTX tctx; + int rc; - memset(hash, '\0', XATTR_SD_HASH_SIZE); + ZERO_ARRAY_LEN(hash, XATTR_SD_HASH_SIZE); - samba_SHA256_Init(&tctx); - samba_SHA256_Update(&tctx, blob.data, blob.length); - samba_SHA256_Final(hash, &tctx); + rc = gnutls_hash_fast(GNUTLS_DIG_SHA256, + blob.data, + blob.length, + hash); + if (rc < 0) { + return NT_STATUS_INTERNAL_ERROR; + } return NT_STATUS_OK; }