mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-05-14 01:36:28 +00:00
595.44.02
This commit is contained in:
@@ -195,88 +195,3 @@ bool libspdm_hmac_sha384_all(const void *data, size_t data_size,
|
||||
|
||||
return lkca_hmac_all("hmac(sha384)", key, key_size, data, data_size, hmac_value);
|
||||
}
|
||||
|
||||
void *libspdm_hmac_sha512_new(void)
|
||||
{
|
||||
return lkca_hash_new("hmac(sha512)");
|
||||
}
|
||||
|
||||
void libspdm_hmac_sha512_free(void *hmac_sha512_ctx)
|
||||
{
|
||||
lkca_hash_free(hmac_sha512_ctx);
|
||||
}
|
||||
|
||||
bool libspdm_hmac_sha512_set_key(void *hmac_sha512_ctx, const uint8_t *key,
|
||||
size_t key_size)
|
||||
{
|
||||
if (hmac_sha512_ctx == NULL)
|
||||
return false;
|
||||
|
||||
return lkca_hmac_set_key(hmac_sha512_ctx, key, key_size);
|
||||
}
|
||||
|
||||
bool libspdm_hmac_sha512_duplicate(const void *hmac_sha512_ctx,
|
||||
void *new_hmac_sha512_ctx)
|
||||
{
|
||||
if (new_hmac_sha512_ctx == NULL || new_hmac_sha512_ctx == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return lkca_hmac_duplicate(new_hmac_sha512_ctx, hmac_sha512_ctx);
|
||||
}
|
||||
|
||||
bool libspdm_hmac_sha512_update(void *hmac_sha512_ctx, const void *data,
|
||||
size_t data_size)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if (hmac_sha512_ctx == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data == NULL && data_size != 0) {
|
||||
return false;
|
||||
}
|
||||
if (data_size > INT_MAX) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = crypto_shash_update(hmac_sha512_ctx, data, data_size);
|
||||
if (ret != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool libspdm_hmac_sha512_final(void *hmac_sha512_ctx, uint8_t *hmac_value)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if (hmac_sha512_ctx == NULL || hmac_value == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = crypto_shash_final(hmac_sha512_ctx, hmac_value);
|
||||
|
||||
if (ret != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool libspdm_hmac_sha512_all(const void *data, size_t data_size,
|
||||
const uint8_t *key, size_t key_size,
|
||||
uint8_t *hmac_value)
|
||||
{
|
||||
if (hmac_value == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (data == NULL && data_size != 0) {
|
||||
return false;
|
||||
}
|
||||
if (data_size > INT_MAX) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return lkca_hmac_all("hmac(sha512)", key, key_size, data, data_size, hmac_value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user