#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,
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;
}