openssl/include/crypto
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
..
__DECC_INCLUDE_EPILOGUE.H
__DECC_INCLUDE_PROLOGUE.H
aes_platform.h Optimize AES-CTR for ARM Neoverse V1 and V2. 2023-11-29 18:10:31 +01:00
aria.h
asn1_dsa.h
asn1.h Copyright year updates 2023-09-28 14:23:29 +01:00
asn1err.h
async.h
asyncerr.h
bioerr.h
bn_conf.h.in
bn_dh.h
bn_srp.h
bn.h Copyright year updates 2023-09-07 09:59:15 +01:00
bnerr.h
buffererr.h
chacha.h riscv: Provide a vector implementation of CHACHA20 cipher. 2023-10-26 15:55:50 +01:00
cmll_platform.h
cmperr.h CMP client: fix error response on -csr without private key, also in docs 2023-05-12 10:46:27 +02:00
cmserr.h
comperr.h
conferr.h
context.h Copyright year updates 2023-09-28 14:23:29 +01:00
crmferr.h
cryptlib.h
cryptoerr.h
cterr.h
ctype.h
decoder.h Copyright year updates 2023-09-07 09:59:15 +01:00
decodererr.h
des_platform.h
dh.h
dherr.h Make DH_check_pub_key() and DH_generate_key() safer yet 2023-11-06 07:55:01 +00:00
dsa.h Avoid setting gen_type to -1 in dsa_gen_set_params 2023-12-14 11:17:48 +01:00
dsaerr.h
dso_conf.h.in
ec.h
ecerr.h
ecx.h Copyright year updates 2023-09-07 09:59:15 +01:00
encoder.h
encodererr.h
engine.h
engineerr.h
err.h
ess.h
esserr.h
evp.h Add EVP_DigestSqueeze() API. 2023-11-10 13:27:00 +01:00
evperr.h EVP_PKEY_get_{bits,security_bits,size}(): add missing error queue entry on failure 2023-10-26 16:03:48 +01:00
httperr.h
lhash.h
md32_common.h
modes.h
objects.h
objectserr.h
ocsperr.h
pem.h
pemerr.h
pkcs7.h
pkcs7err.h
pkcs12err.h
poly1305.h
ppc_arch.h
punycode.h Copyright year updates 2023-09-07 09:59:15 +01:00
rand_pool.h
rand.h rand: implement an unbiased random integer from a range 2023-11-01 12:05:28 +01:00
randerr.h rand: add extra error code 2023-09-27 17:22:54 +01:00
riscv_arch.def Update for Zvkb extension. 2023-10-26 15:55:50 +01:00
riscv_arch.h Update for Zvkb extension. 2023-10-26 15:55:50 +01:00
rsa.h Copyright year updates 2023-09-07 09:59:15 +01:00
rsaerr.h
security_bits.h
sha.h Copyright year updates 2023-09-07 09:59:15 +01:00
siphash.h
siv.h
sm2.h
sm2err.h
sm4_platform.h riscv: SM4: Provide a Zvksed-based implementation 2023-10-26 15:55:49 +01:00
sm4.h
sparc_arch.h
sparse_array.h
store.h
storeerr.h
tserr.h
types.h Copyright year updates 2023-09-07 09:59:15 +01:00
uierr.h
x509.h Fix decoders so that they use the passed in propq. 2023-08-16 18:02:51 +02:00
x509err.h
x509v3err.h