SipHash: Fix CTRL API for the digest size.

Adds a mapping from "digestsize" to "size" for setting a param.

Fixes #14370

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14850)
This commit is contained in:
Pauli 2021-04-13 12:11:41 +10:00
parent 4a95b70d1e
commit 34ed733396
2 changed files with 15 additions and 1 deletions

View File

@ -2093,6 +2093,14 @@ static const struct translation_st evp_pkey_ctx_translations[] = {
EVP_PKEY_CTRL_RSA_KEYGEN_PRIMES, "rsa_keygen_primes", NULL,
OSSL_PKEY_PARAM_RSA_PRIMES, OSSL_PARAM_UNSIGNED_INTEGER, NULL },
/*-
* SipHash
* ======
*/
{ SET, -1, -1, EVP_PKEY_OP_TYPE_SIG,
EVP_PKEY_CTRL_SET_DIGEST_SIZE, "digestsize", NULL,
OSSL_MAC_PARAM_SIZE, OSSL_PARAM_UNSIGNED_INTEGER, NULL },
/*-
* TLS1-PRF
* ========

View File

@ -134,6 +134,12 @@ Key = 000102030405060708090A0B0C0D0E0F
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E
Output = 724506EB4C328A95
MAC = SipHash by EVP_PKEY
Ctrl = digestsize:8
Key = 000102030405060708090A0B0C0D0E0F
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E
Output = 724506EB4C328A95
# SIPHASH - default values: 2,4 rounds, explicit 16-byte mac
MAC = SipHash
@ -161,7 +167,7 @@ Result = MAC_INIT_ERROR
# by EVP_PKEY this time
MAC = SipHash by EVP_PKEY
Ctrl = size:13
Ctrl = digestsize:13
Key = 000102030405060708090A0B0C0D0E0F
Result = EVPPKEYCTXCTRL_ERROR