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 Add ossl_aria symbols 2021-03-18 17:52:37 +10:00
asn1_dsa.h Add ossl_encode symbols 2021-03-18 17:52:37 +10:00
asn1.h Copyright year updates 2023-09-28 14:23:29 +01:00
asn1err.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
async.h Update copyright year 2021-02-18 15:05:17 +00:00
asyncerr.h Update copyright year 2021-06-17 13:24:59 +01:00
bioerr.h BIO_dgram support for BIO_sendmmsg/BIO_recvmmsg 2022-09-01 18:03:10 +10:00
bn_conf.h.in Update copyright year 2021-02-18 15:05:17 +00:00
bn_dh.h Update copyright year 2021-03-11 13:27:36 +00:00
bn_srp.h Update copyright year 2021-04-08 13:04:41 +01:00
bn.h Copyright year updates 2023-09-07 09:59:15 +01:00
bnerr.h RSA keygen update: Raise an error if no prime candidate q is found. 2022-06-13 10:56:31 +02:00
buffererr.h Update copyright year 2021-06-17 13:24:59 +01:00
chacha.h riscv: Provide a vector implementation of CHACHA20 cipher. 2023-10-26 15:55:50 +01:00
cmll_platform.h Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
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 CMS sign digest 2022-04-02 10:42:16 -04:00
comperr.h Update copyright year 2021-06-17 13:24:59 +01:00
conferr.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
context.h Copyright year updates 2023-09-28 14:23:29 +01:00
crmferr.h Update copyright year 2021-06-17 13:24:59 +01:00
cryptlib.h Fix a memleak in the FIPS provider 2021-05-24 09:39:15 +10:00
cryptoerr.h err: add additional errors 2022-01-12 20:10:21 +11:00
cterr.h Update copyright year 2021-06-17 13:24:59 +01:00
ctype.h tolower: refine the tolower code to avoid a memory access 2022-05-23 09:51:28 +10:00
decoder.h Copyright year updates 2023-09-07 09:59:15 +01:00
decodererr.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
des_platform.h Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
dh.h Update copyright year 2022-05-03 13:34:51 +01:00
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 Fix infinite loops in DSA sign code. 2023-03-01 09:20:49 +11:00
dso_conf.h.in Update copyright year 2021-02-18 15:05:17 +00:00
ec.h Implement deterministic ECDSA sign (RFC6979) 2022-11-30 07:31:53 +00:00
ecerr.h Fix potential infinite loops in ECDSA signing. 2023-03-01 09:20:49 +11:00
ecx.h Copyright year updates 2023-09-07 09:59:15 +01:00
encoder.h Remove the _fetch_by_number functions 2022-05-06 10:38:55 +10:00
encodererr.h Update copyright year 2021-06-17 13:24:59 +01:00
engine.h
engineerr.h Update copyright year 2021-06-17 13:24:59 +01:00
err.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
ess.h TS ESS: Move four internal aux function to where they belong in crypto/ts 2021-04-28 14:10:47 +02:00
esserr.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
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 err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
lhash.h Add ossl_lhash symbols 2021-03-18 17:52:38 +10:00
md32_common.h Add ROTATE inline asm support for SM3 2022-06-22 12:46:50 +02:00
modes.h providers: Add SM4 XTS implementation 2022-11-29 16:17:30 +01:00
objects.h Update copyright year 2021-04-08 13:04:41 +01:00
objectserr.h Update copyright year 2021-06-17 13:24:59 +01:00
ocsperr.h Update copyright year 2021-06-17 13:24:59 +01:00
pem.h Fix copyrights 2022-02-03 13:56:38 +01:00
pemerr.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
pkcs7.h Add library context and property query support into the PKCS12 API 2021-04-30 09:15:50 +10:00
pkcs7err.h Update copyright year 2021-06-17 13:24:59 +01:00
pkcs12err.h Allow PKCS12 export to set arbitrary bag attributes 2022-09-23 17:40:02 +01:00
poly1305.h Update copyright year 2021-02-18 15:05:17 +00:00
ppc_arch.h Update copyright year 2022-05-03 13:34:51 +01:00
punycode.h Copyright year updates 2023-09-07 09:59:15 +01:00
rand_pool.h Add ossl_rand symbols 2021-03-18 17:52:37 +10:00
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 errors: update error message (to be squashed) 2021-05-27 13:01:50 +10:00
security_bits.h Fix misc external ossl_ symbols. 2021-03-18 17:52:37 +10:00
sha.h Copyright year updates 2023-09-07 09:59:15 +01:00
siphash.h Fix a TODO(3.0) in the siphash code 2021-03-17 10:16:21 +10:00
siv.h Update copyright year 2021-04-08 13:04:41 +01:00
sm2.h Correctly calculate the length of SM2 plaintext given the ciphertext 2021-08-24 14:22:07 +01:00
sm2err.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
sm4_platform.h riscv: SM4: Provide a Zvksed-based implementation 2023-10-26 15:55:49 +01:00
sm4.h Add ossl_ symbols for sm3 and sm4 2021-03-18 17:52:37 +10:00
sparc_arch.h Split bignum code out of the sparcv9cap.c 2021-07-15 09:33:04 +02:00
sparse_array.h Add ossl_sa symbols 2021-03-18 17:52:37 +10:00
store.h Add method store cache flush and method removal to non-EVP operations 2022-05-05 15:06:12 +02:00
storeerr.h err: rename err_load_xxx_strings_int functions 2021-05-26 13:01:47 +10:00
tserr.h Update copyright year 2021-06-17 13:24:59 +01:00
types.h Copyright year updates 2023-09-07 09:59:15 +01:00
uierr.h Update copyright year 2021-06-17 13:24:59 +01:00
x509.h Fix decoders so that they use the passed in propq. 2023-08-16 18:02:51 +02:00
x509err.h x509_att.c: improve error checking and reporting and coding style 2022-08-24 11:25:04 +02:00
x509v3err.h Update copyright year 2021-06-17 13:24:59 +01:00