summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Make the openssl_dsa_meth static consttb2024-05-091-2/+2
|
* Move openssl_dsa_meth below the methods it usestb2024-05-091-25/+17
| | | | no functional change
* Make the DH_METHOD static consttb2024-05-091-2/+2
|
* Move public API and DH_METHOD to the bottom of the filetb2024-05-091-38/+31
| | | | no functional change
* Tiny style tweaks in X509_REQ_add_extension_nid()tb2024-05-091-6/+5
| | | | | | Test & assign and use ret instead of rv. ok jsing
* Streamline X509_REQ_check_private_key() a bittb2024-05-091-16/+17
| | | | | | | Use better variable names, split the success from the error path and return directly rather than using an ok variable. ok jsing
* Zap some extra parentheses in X509_REQ_get_pubkey()tb2024-05-091-4/+4
| | | | ok jsing
* Clean up X509_to_X509_REQ()tb2024-05-091-21/+18
| | | | | | | | | | Use better variable names. X509_REQ_new() sets the version to the only specified version, so there is no point to set it. Extract the subject name, then assign to make it more obvious that we error happens if the cert has a missing subject. Switch to X509_get0_pubkey() to avoid some strange dance with a strangely named variable to adjust the refcount. ok jsing
* Further simplify X509_REQ_get_extensions()tb2024-05-091-6/+4
| | | | | | | Instead of inlining a poor version of ASN1_TYPE_unpack_sequence() with missing error checks, just call the real thing. It's safer and simpler. ok jsing
* fix line wrapping in function definitiontb2024-05-081-2/+3
|
* Simplify X509_REQ_get_extensions()tb2024-05-081-22/+13
| | | | | | | | | | | | | Now that we know the two OIDs we need to look for when checking for the extension list attribute in a certification request, we can simplify this quite a bit. There is one change of behavior. Attribute value sets are not supposed to be empty and it makes no sense to return an empty stack of extensions in that case, return NULL instead, matching BoringSSL. This removes last use of ext_nids and ext_nid_list[], so these two bits of unprotected global mutable state can now join the party in the attic. ok jsing
* Simplify X509_REQ_extension_nid()tb2024-05-081-11/+3
| | | | | | | | | | | | | Now that the global ext_nids[] array can no longer be modified by the application, we can simplify this by returning the two possible NIDs that we accept in the extension list attribute in PKCS#10 certification requests. The year is 2024. This API is entirely unused by the ecosystem. Well not entirely! One small village of indomitable rare API use still holds out against the cleansers. You may have guessed it: security/xca. ok jsing
* Defang X509_REQ_{s,g}et_extension_nids()tb2024-05-081-15/+20
| | | | | | | | | These fiddle with unprotected global state, so aren't thread safe and of course there was no good reason to have this API in the first place. Nothing uses it, so it becomes a noop and will be removed in the next major bump. ok jsing
* PEM_read_bio_PrivateKey: fix grammartb2024-05-071-3/+3
| | | | This old [...] routines use [...] -> These old [...] routines [...]
* Reorder functions and drop static function prototypes.jsing2024-05-071-123/+119
| | | | No functional change.
* Fix function wrapping.jsing2024-05-061-2/+3
|
* Guard call to contract() from doall_util_fn().jsing2024-05-061-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@
* Remove disgusting NULL checks in tm_to_{gentime,utctime}()tb2024-05-031-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
* Intercept a NULL s early in ASN1_TIME_set_string_internal()tb2024-05-031-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
* Simplify type handling in ASN1_TIME_set_string_internal()tb2024-05-031-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
* Simplify tm handling in ASN1_time_parse()tb2024-05-031-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
* Align CRL and CSR version printing with certstb2024-05-032-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
* Remove a useless OBJ_obj2nid() call from X509_CRL_print()tb2024-05-021-2/+1
| | | | ok beck (as part of a larger diff)
* Tweak start of DESCRIPTION of EC_GROUP_new()tb2024-04-271-4/+9
| | | | | Complete precision will lead to complete confusion, however outright lies are also bad.
* Document EC_curve_{nid2nist,nist2nid}()tb2024-04-261-4/+57
|
* Take pem2.h behind the barntb2024-04-252-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
* One empty line is enoughtb2024-04-231-18/+1
|
* remove space at eoljsg2024-04-221-3/+3
|
* unwrap linetb2024-04-211-3/+2
|
* Remove more unnecessary GOST codetb2024-04-202-24/+2
| | | | ok jsing
* bss_conn: zap trailing whitespacetb2024-04-191-8/+8
|
* Remove a couple of lies about GOST in CMStb2024-04-182-8/+8
|
* More GOST removal adjustmentstb2024-04-181-3/+3
|
* EVP_PKEY_set1_RSA.3 some adjustments after GOST removaltb2024-04-181-4/+4
|
* Add some more comments explaining shortcomings of the APItb2024-04-181-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
* Use X509_ALGOR_get0() in ecdh_cms_set_shared_info()tb2024-04-181-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
* Test and assign in ecdh_cms_set_shared_info()tb2024-04-181-9/+7
| | | | ok jsing
* Turn ecdh_cms_set_shared_info() into single exittb2024-04-181-7/+9
| | | | ok jsing
* Remove comments from captain obvious and drop useless prototypestb2024-04-171-43/+1
|
* tidy includestb2024-04-171-3/+2
|
* bn_convert: zap extra blank linetb2024-04-171-2/+1
|
* Rewrite BN_mpi2bn() using CBS and bn_bin2bn_cbs().jsing2024-04-171-32/+29
| | | | ok tb@
* Rewrite BN_lebin2bn() using CBS.jsing2024-04-171-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@
* Provide constant time operations for uint8_t.jsing2024-04-171-1/+68
| | | | | | These will be used in upcoming changes. ok tb@
* Shuffle EVP_PKEY_CTX setting togethertb2024-04-171-5/+3
| | | | | | | Another stroke of the already very dirty brush eliminates more traces of ADHD and/or crack. ok jsing
* ecdh_cms_encrypt(): tweak wrap_algor constructiontb2024-04-171-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
* ecdh_cms_encrypt: tweak handling of ecdh_nidtb2024-04-171-4/+3
| | | | ok jsing
* ecdh_cms_encrypt: handle kdf_md in one gotb2024-04-171-3/+3
| | | | | | | Again the getting and the setting were interrupted by ten lines of completely unrelated code. ok jsing
* ecdh_cms_encrypt: simplify setting the KDF typetb2024-04-171-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
* Use error checked X509_ALGOR_set0_by_nidtb2024-04-171-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