Skip to content

Commit

Permalink
digest: add 'xof' and 'algid-absent' parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
gotthardp committed Dec 15, 2024
1 parent 0dc39e5 commit eeb1bfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tpm2-provider-digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ tpm2_digest_gettable_params(void *provctx)
static const OSSL_PARAM known_gettable_params[] = {
OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_BLOCK_SIZE, NULL),
OSSL_PARAM_size_t(OSSL_DIGEST_PARAM_SIZE, NULL),
OSSL_PARAM_int(OSSL_DIGEST_PARAM_XOF, NULL),
OSSL_PARAM_int(OSSL_DIGEST_PARAM_ALGID_ABSENT, NULL),
OSSL_PARAM_END
};
return known_gettable_params;
Expand All @@ -349,6 +351,15 @@ tpm2_digest_get_params_int(OSSL_PARAM params[], size_t block, size_t size)
if (p != NULL && !OSSL_PARAM_set_size_t(p, size))
return 0;

/* OSSL_DIGEST_PARAM_XOFLEN is never supported */
p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_XOF);
if (p != NULL && !OSSL_PARAM_set_int(p, 0))
return 0;

p = OSSL_PARAM_locate(params, OSSL_DIGEST_PARAM_ALGID_ABSENT);
if (p != NULL && !OSSL_PARAM_set_int(p, 0))
return 0;

return 1;
}

Expand Down
1 change: 1 addition & 0 deletions src/tpm2-provider-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ static const hash_names_t hashes[] = {
{ "SHA512", TPM2_ALG_SHA512 },
{ "SHA-512", TPM2_ALG_SHA512 },
{ "SHA2-512", TPM2_ALG_SHA512 },
{ "SM3", TPM2_ALG_SM3_256 },
{ NULL, TPM2_ALG_ERROR }
};

Expand Down

0 comments on commit eeb1bfc

Please sign in to comment.