summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/recallocarray.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-05-06Fix function wrapping.jsing1-2/+3
2024-05-06Enable lhash regress.jsing1-1/+2
2024-05-06Guard call to contract() from doall_util_fn().jsing1-2/+4
It is not safe to unconditionally call contract() - when called repeatedly it will shrink the bucket array to zero and then attempt to access that allocation on the next call. Use the same guard that is used in lh_delete(). Issue found when investigating haproxy crashes reported by wizard-it on GitHub. ok tb@
2024-05-06Provide initial regress for lhash.jsing2-0/+71
For now, this is very limited and only tests calling lh_doall_arg() multiple times on an empty linked hash. This process currently triggers a SIGSEGV, which will be soon fixed.
2024-05-03Remove disgusting NULL checks in tm_to_{gentime,utctime}()tb1-7/+1
The only caller that could potentially call these with NULL has been fixed. This way an ugly hack that was needed to plug a memory leak can go away and the functions again behave as intended without OpenSSL-style workarounds. ok beck
2024-05-03Intercept a NULL s early in ASN1_TIME_set_string_internal()tb1-1/+6
If s is NULL, the only thing the tm_to_*() functions do is a check that a GeneralizedTime has a four digit year (between 0000 and 9999) and a UTCTime has a year between 1950 and 2050. These checks are already done in ASN1_TIME_parse() itself: the century is 100 times a two-digit value (or 19 in the UTCTime case) plus another two-digit value. ok beck
2024-05-03Simplify type handling in ASN1_TIME_set_string_internal()tb1-5/+4
ASN1_time_parse() takes a mode argument. If mode != 0, there is a check that mode is the same as the time type returned by asn1_time_parse_cbs() otherwise ASN1_time_parse() fails. Therefore the type == mode checks in ASN1_set_string_internal() are redundant and can be removed. ok beck
2024-05-03Simplify tm handling in ASN1_time_parse()tb1-3/+2
The CBS version asn1_time_parse_cbs() handles a NULL tm gracefully, so there is no need to avoid it by passing a pointer to a tm on the stack. ok beck
2024-05-03Align CRL and CSR version printing with certstb2-14/+18
Only print specified 0-based versions and print them with the 1-based human interpretation. Use a colon and error check the BIO_printf() calls. (There's a lot more to clean up in here, but that's for another day). Notably, X509_CRL_print_ex() is missing... I guess that's better than having one with signature and semantics differing from X509_print_ex() und X509_REQ_print_ex(). ok beck
2024-05-02Remove a useless OBJ_obj2nid() call from X509_CRL_print()tb1-2/+1
ok beck (as part of a larger diff)
2024-04-27Tweak start of DESCRIPTION of EC_GROUP_new()tb1-4/+9
Complete precision will lead to complete confusion, however outright lies are also bad.
2024-04-26Document EC_curve_{nid2nist,nist2nid}()tb1-4/+57
2024-04-25Take pem2.h behind the barntb2-73/+1
/* * This header only exists to break a circular dependency between pem and err * Ben 30 Jan 1999. */ 25 years of uselessness is about a quarter century more than enough. discussed with jsing
2024-04-25Add regress coverage for crypto_ct_*_u8()jsing3-1/+111
2024-04-23One empty line is enoughtb1-18/+1
2024-04-22Instead of unhooking libssl/client regress tests, flag them as expectedanton2-4/+6
to fail. ok tb@
2024-04-22remove space at eoljsg1-3/+3
2024-04-21unwrap linetb1-3/+2
2024-04-20Remove more unnecessary GOST codetb2-24/+2
ok jsing
2024-04-19bss_conn: zap trailing whitespacetb1-8/+8
2024-04-18Remove a couple of lies about GOST in CMStb2-8/+8
2024-04-18More GOST removal adjustmentstb1-3/+3
2024-04-18EVP_PKEY_set1_RSA.3 some adjustments after GOST removaltb1-4/+4
2024-04-18Add some more comments explaining shortcomings of the APItb1-2/+9
The case in point is the incompatibility of the very ergonomic X509_ALGOR API with the RC2-derived API massacre that is EVP_CIPHER_asn1_to_param() and its "inverse". ok jsing
2024-04-18Use X509_ALGOR_get0() in ecdh_cms_set_shared_info()tb1-6/+14
This makes things slightly less gross since it involves less reaching into nested ASN.1 structures. But don't get the idea that this means the code is now clean. ok jsing
2024-04-18Test and assign in ecdh_cms_set_shared_info()tb1-9/+7
ok jsing
2024-04-18Turn ecdh_cms_set_shared_info() into single exittb1-7/+9
ok jsing
2024-04-17Remove comments from captain obvious and drop useless prototypestb1-43/+1
2024-04-17SSL_version_str is no moretb1-5/+1
2024-04-17tidy includestb1-3/+2
2024-04-17bn_convert: zap extra blank linetb1-2/+1
2024-04-17Rewrite BN_mpi2bn() using CBS and bn_bin2bn_cbs().jsing1-32/+29
ok tb@
2024-04-17Rewrite BN_lebin2bn() using CBS.jsing1-48/+16
We get an implementation of this for free by having bn_bin2bn_cbs() use CBS_get_u8() instead of CBS_get_last_u8(). ok tb@
2024-04-17Provide constant time operations for uint8_t.jsing1-1/+68
These will be used in upcoming changes. ok tb@
2024-04-17Shuffle EVP_PKEY_CTX setting togethertb1-5/+3
Another stroke of the already very dirty brush eliminates more traces of ADHD and/or crack. ok jsing
2024-04-17ecdh_cms_encrypt(): tweak wrap_algor constructiontb1-15/+23
This manually constructs an X509_ALGOR because the (now internal) legacy interface EVP_CIPHER_param_to_asn1() (which is an unwelcome complication thanks to RC2) is entirely incompatible with X509_ALGOR_set0() since the ASN1_TYPE can't be pulled apart nicely (because the ASN1_TYPE API is incomplete as well). Once we got this far, we get to DER-encode the inner AlgorithmIdentifier and set that blob as the parameters of another one. The same variables are reused of course and needless to say an unchecked X509_ALGOR_set0() would leak this blob on failure. So fix this by switching to the usual error checked X509_ALGOR_set0_by_nid(). ok jsing
2024-04-17ecdh_cms_encrypt: tweak handling of ecdh_nidtb1-4/+3
ok jsing
2024-04-17ecdh_cms_encrypt: handle kdf_md in one gotb1-3/+3
Again the getting and the setting were interrupted by ten lines of completely unrelated code. ok jsing
2024-04-17ecdh_cms_encrypt: simplify setting the KDF typetb1-13/+6
It is much simpler to avoid the key_type variable altogether and inline its use. Also it makes no sense to have 15 unrelated lines between the getting of the kdf type, checking its content, and then actually setting it to EVP_PKEY_ECDH_KDF_X9_63. ok jsing
2024-04-17Use error checked X509_ALGOR_set0_by_nidtb1-5/+5
While setting the parameters to type V_ASN1_UNDEF can't actually fail, it is cleaner to just do the check. Using the by_nid() variant also removes the need for an unchecked nested OBJ_nid2obj() call. ok jsing
2024-04-17ecdh_cms_encrypt: simplify handling of pkeytb1-15/+6
The pkey is only used in one scope. i2o allocates if passed a pointer to NULL, so use that to drop two unnecessary local variables. ok jsing
2024-04-17Transfer ownership before setting unused bitstb1-2/+4
This looks like a use after free, but setting the unused bits to 0 can't actually fail. ok jsing
2024-04-17Turn ecdh_cms_encrypt() into single exittb1-7/+7
Also use ret instead of rv. ok jsing
2024-04-17Fix error check in ecdh_cms_encrypt()tb1-2/+2
ASN1_TYPE_get() returns V_ASN1_* constants. Checking the return for NID_undef instead means that we actually check for V_ASN1_EOC, which makes absolutely no sense here. Clearly V_ASN1_UNDEF was intended. ok jsing
2024-04-17Add regress coverage for BN_lebin2bn().jsing1-3/+17
2024-04-17Avoid NULL dereference in EVP_PKEY_paramgen()tb1-6/+8
If EVP_PKEY_new() returns NULL, it would be passed to the paramgen() pmeth which would typically dereference it. This is identical to a recent change in keygen(). ok jsing
2024-04-17openssl req: plug obvious leaktb1-1/+2
CID 492603
2024-04-16Fix key share negotiation in HRR casetb1-1/+40
In the ClientHello retrying the handshake after a HelloRetryRequest, the client must send a single key share matching the group selected by the server in the HRR. This is not necessarily the mutually preferred group. Incorrect logic added in ssl_tlsect.c r1.134 would potentially reject such a key share because of that. Instead, add logic to ensure on the server side that there is a single share matching the group we selected in the HRR. Fixes a regress test in p5-IO-Socket-SSL where server is configured with P-521:P-384 and the client with P-256:P-384:P-521. Since the client sends an initial P-256 key share, a HRR is triggered which the faulty logic rejected because it was not the mutually preferred P-384 but rather matching the server-selected P-521. This will need some deduplication in subsequent commits. We may also want to consider honoring the mutual preference and request a key accordingly in the HRR. reported by bluhm, fix suggested by jsing ok beck jsing
2024-04-16Invert BN_BITS2 handling in bn_bin2bn_cbs() and bn_hex2bn_cbs().jsing1-11/+11
This results in simpler code. Suggested by tb@ during review.
2024-04-16Rewrite BN_bin2bn() using CBS.jsing1-35/+58
ok tb@