openssl/providers/implementations
Neil Horman 5056133cc7 Avoid setting gen_type to -1 in dsa_gen_set_params
gh_gen_type_common_set_params looks up a dsa contexts gen_type using
name2id, but if it returns error, we inadvertently set gctx->gen_type to
-1, which is an invalid value, which may lead to improper behavior in
future calls, in the event that said future calls preform an operation
of the form;
if (gen_type == <VALID VALUE>) {
        do_stuff
else {
        do_other_stuff
}

Technically it is not correct to continue with the operations on the
gen context after failed parameters setting but this makes it more
predictable.

Fix it by assigning the result of a lookup to a stack variable, and only
update gctx->gen_value if the lookup returns a non-failing value

In leiu of testing this specific case, also add an ossl_assert in dsa_gen
to validate the gen_val input prior to continuing, should other code
points attempt to do the same thing

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22991)
2023-12-14 11:17:48 +01:00
..
asymciphers Copyright year updates 2023-09-07 09:59:15 +01:00
ciphers Fix detection for riscv64/riscv32 2023-12-12 16:08:05 +00:00
digests Fix BLAKE2s reporting the same EVP_MD_get_size() as BLAKE2b (64) 2023-11-15 08:41:06 +01:00
encode_decode Restore the meaning of EVP_PKEY_print_private() 2023-10-04 08:10:55 +02:00
exchange Copyright year updates 2023-09-07 09:59:15 +01:00
include/prov Implement BLAKE2s with the same macro as BLAKE2b 2023-11-08 09:42:13 +01:00
kdfs Accept longer context for TLS 1.2 exporters 2023-10-26 15:47:15 +01:00
kem Copyright year updates 2023-09-07 09:59:15 +01:00
keymgmt Avoid setting gen_type to -1 in dsa_gen_set_params 2023-12-14 11:17:48 +01:00
macs evp-cmac: do not seg-fault when getting mac-size before init 2023-12-01 11:54:51 +01:00
rands rand: fix seeding from a weak entropy source 2023-10-24 11:14:11 +01:00
signature Initialize dstctx->mgf1_md to NULL in rsa_dupctx function 2023-11-30 18:45:15 +01:00
storemgmt Copyright year updates 2023-09-07 09:59:15 +01:00
build.info