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; }
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); status = create_acl_blob(psd, &blob, XATTR_SD_HASH_TYPE_SHA256, hash); 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; }