From ac3f5c9bf1111d1b489335adc30dd8c1af9d7299 Mon Sep 17 00:00:00 2001 From: Petr Gotthard Date: Sun, 29 Oct 2023 21:59:05 +0100 Subject: [PATCH] digest: add 'xof' and 'algid-absent' parameters --- src/tpm2-provider-digest.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tpm2-provider-digest.c b/src/tpm2-provider-digest.c index d99f972..2b9a319 100644 --- a/src/tpm2-provider-digest.c +++ b/src/tpm2-provider-digest.c @@ -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; @@ -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; }