diff options
author | Andreas Schneider <asn@samba.org> | 2018-10-11 14:43:24 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-04-30 23:18:27 +0000 |
commit | 9bbb9f7bdf05e92498e01fb1ffacc770432d6709 (patch) | |
tree | 9ce2c61941e8431a804b34d0205f5a2c2e8a15d7 /source3/modules | |
parent | 712e464fb71e90dbee0560a0c15210b1606fcab6 (diff) | |
download | samba-9bbb9f7bdf05e92498e01fb1ffacc770432d6709.tar.gz |
s3:modules: Use GnuTLS SHA256 in vfs_acl_common
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_acl_common.c | 18 |
1 files changed, 12 insertions, 6 deletions
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 <gnutls/gnutls.h> +#include <gnutls/crypto.h> + 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; } |