Rework pkey_dh_keygen()
authortb <tb@openbsd.org>
Thu, 28 Dec 2023 22:06:41 +0000 (22:06 +0000)
committertb <tb@openbsd.org>
Thu, 28 Dec 2023 22:06:41 +0000 (22:06 +0000)
commit3b26100e012949c92e0c84e97cfc7448dc0f7a54
treedc043b3c96c0c71d50564ac9eeacfd6330b0095b
parent4600b3a1e352f770575ee1aafe139f8dde806800
Rework pkey_dh_keygen()

Single exit, fix error checking and hold on to the DH by keeping a
reference. In other words, switch from EVP_PKEY_assign() to using
EVP_PKEY_set1_DH() and free unconditionally in the error path.

ok jsing
lib/libcrypto/dh/dh_pmeth.c