mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
vfs: Add helper function hash_blob_sha256 to vfs_acl_common.c
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org>
This commit is contained in:
parent
5a8e04963f
commit
6a5f65b0e9
@ -49,11 +49,28 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
Hash a security descriptor.
|
||||
*******************************************************************/
|
||||
|
||||
static NTSTATUS hash_blob_sha256(DATA_BLOB blob,
|
||||
uint8_t *hash)
|
||||
{
|
||||
SHA256_CTX tctx;
|
||||
|
||||
memset(hash, '\0', XATTR_SD_HASH_SIZE);
|
||||
|
||||
samba_SHA256_Init(&tctx);
|
||||
samba_SHA256_Update(&tctx, blob.data, blob.length);
|
||||
samba_SHA256_Final(hash, &tctx);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Hash a security descriptor.
|
||||
*******************************************************************/
|
||||
|
||||
static NTSTATUS hash_sd_sha256(struct security_descriptor *psd,
|
||||
uint8_t *hash)
|
||||
{
|
||||
DATA_BLOB blob;
|
||||
SHA256_CTX tctx;
|
||||
NTSTATUS status;
|
||||
|
||||
memset(hash, '\0', XATTR_SD_HASH_SIZE);
|
||||
@ -61,12 +78,7 @@ static NTSTATUS hash_sd_sha256(struct security_descriptor *psd,
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
samba_SHA256_Init(&tctx);
|
||||
samba_SHA256_Update(&tctx, blob.data, blob.length);
|
||||
samba_SHA256_Final(hash, &tctx);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
return hash_blob_sha256(blob, hash);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user