diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-01-21 12:43:00 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-02-04 12:19:29 +0100 |
commit | 6a5f65b0e971f068ebae5b2f93a6dfccfaa93b26 (patch) | |
tree | 1fc28b39ea4a1aac7075a7fe013503a829e0cf53 | |
parent | 5a8e04963f611b21570b9bdfc3b74e18254df2d1 (diff) | |
download | samba-6a5f65b0e971f068ebae5b2f93a6dfccfaa93b26.tar.gz samba-6a5f65b0e971f068ebae5b2f93a6dfccfaa93b26.tar.bz2 samba-6a5f65b0e971f068ebae5b2f93a6dfccfaa93b26.zip |
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>
-rw-r--r-- | source3/modules/vfs_acl_common.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index 4e3aa72d37..e1555c7d9e 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -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); } /******************************************************************* |