]> git.ipfire.org Git - thirdparty/openssl.git/commit
Fix bugs in ECDH cofactor FIPS indicator.
authorslontis <shane.lontis@oracle.com>
Thu, 26 Sep 2024 05:18:59 +0000 (15:18 +1000)
committerTomas Mraz <tomas@openssl.org>
Mon, 30 Sep 2024 18:07:22 +0000 (20:07 +0200)
commita9fe6f05e9b23e6d2e5f6100c628396d4c659971
treee3a11c392752da8c4e32b540068661d1bc453c4c
parent12d0f0789a3f518581ecada4f3fba899c0b387db
Fix bugs in ECDH cofactor FIPS indicator.

The code was not detecting that the cofactor was set up correctly
if OSSL_PKEY_PARAM_USE_COFACTOR_ECDH was set, resulting in an incorrect
FIPS indicator error being triggered.

Added a test for all possible combinations of a EVP_PKEY setting
OSSL_PKEY_PARAM_USE_COFACTOR_ECDH and the derive context setting
OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE.

This only affects the B & K curves (which have a cofactor that is not 1).

Bug reported by @abkarcher

Testing this properly, also detected a memory leak of privk when the
FIPS indicator error was triggered (in the case where mode = 0 and
use_cofactor was 1).

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25548)

(cherry picked from commit 2f362e99a1178263c7102474f0190836166f416d)
providers/implementations/exchange/ecdh_exch.c
test/acvp_test.c
test/acvp_test.inc