summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove some GOST relicstb2024-03-021-133/+0
|
* Unhook and remove GOST and STREEBOGtb2024-03-025-539/+2
| | | | | | | | | | | | This stops compiling the GOST source. The current implementation is low quality and got in the way, especially in libssl. While we would be open for GOST support, it needs to be significantly better than what we have had and it also needs a maintainer. Add OPENSSL_NO_GOST to opensslfeatures and stop installing gost.h. Some code wrapped in #ifndef OPENSSL_NO_GOST will be removed later. ok jsing
* Garbage collect CUSTOM_KEY_LENGTH/SET_KEY_LENGTHtb2024-03-021-4/+1
| | | | | | | These are unused defines that used to add unwanted complications in EVP_CIPHER_CTX_set_key_lenght(). ok jsing
* Remove more PBE stuff from the public APItb2024-03-023-11/+9
| | | | | | | This is still needed internally for CMS and its predecessors. This removal will enable disentangling some of its innards. ok jsing
* Remove most PBEPARAM stuff from public visibilitytb2024-03-021-1/+2
| | | | | | The struct itself needs to remain public, unfortunately. ok jsing
* Remove a lot of PKCS12 garbage from the public APItb2024-03-021-1/+5
| | | | | | | | PKCS12 is a hot mess. Please participate in the survey at the end of https://www.cs.auckland.ac.nz/~pgut001/pubs/pfx.html to increase its credibility and unanimity. ok jsing
* Remove RC4-HMAC-MD5 and AES-{128,256}-CBC-HMAC-SHA-1tb2024-03-024-945/+2
| | | | | | | "Stitched" mode AEADs were removed from libssl a long time ago. Nothing uses these CIPHERs anymore. ok jsing
* Make legacy cipher methods internaltb2024-03-022-10/+8
| | | | | | | These are ASN.1 handlers for CIPHERs, still used by CMS and its predecessors. They should never have been public. ok jsing
* Remove EVP_PBE_* API from public visibilitytb2024-03-023-61/+6
| | | | | | | You can no longer add your custom PBE algorithm. Pity. EVP_PBE_CipherInit() stays for internal use, the rest goes away copmletely. ok jsing
* Remove EVP_PKEY_meth_*() APItb2024-03-022-237/+2
| | | | | | After ameth, the second bit of custom EVP_PKEY API removal. ok jsing
* Remove the ameth libtb2024-03-021-43/+1
| | | | | | | | This is accessor API for ASN.1 methods needed for custom PKEYs. Nothing has ever used this. This has been neutered for months. The EVP_PKEY_asn1_* API that needs to stay was moved elsewhere. ok jsing
* Remove EVP_MD_meth* againtb2024-03-022-132/+2
| | | | | | | | | | | Erlang upstream disabled the otp_test_engine for LibreSSL >= 3.5 without explanation. It was the only reason we added this garbage API in the first place. Meanwhile libfido2 started using it for a mock up of OpenSSL 3's broken fetch design with old API. This is pointless, so all this garbage goes away again (in particular we can remove the absolutely horrifying EVP_MD_meth_set_app_datasize() again). ok jsing
* Fix signature and semantics of EVP_{CIPHER,MD}_CTX_init()tb2024-03-023-13/+13
| | | | | | | | | | | | | | When the EVP_CIPHER_CTX and the EVP_MD_CTX were still expected to live on the stack, these initialization APIs were wrappers around memset. In OpenSSL 1.1, somebody removed them and carelessly made _init() an alias of _reset() aka _cleanup(). As a consequence, both signature and semantics changed. Unsurprisingly, there is now code out there that actually uses the new semantics, which causes leaks on LibreSSL and older OpenSSL. This aligns our _init() with OpenSSL 1.1 semantics. ok jsing
* Switch name member of OBJ_NAME to const void *tb2024-03-021-3/+3
| | | | | | Because this is the type it should have had from the get go. ok jsing
* Remove unused public OBJ_NAME_* APItb2024-03-021-53/+1
| | | | | | | This functionality has been disabled for a few months. Now it is high time to garbage collect it. ok jsing
* Remove EVP_{add,delete}_{cipher,digest}_alias()tb2024-03-021-10/+1
| | | | | | | | These are macro wrappers around the neutered OBJ_NAME_{add,remove}() API (notice the consistency), which will be removed shortly. Only security/xca used to use this. ok jsing
* Remove EVP_add_{cipher,digest}() from public APItb2024-03-022-17/+2
| | | | | | | | | | | Ciphers and digests are now handled in a static lookup table and no longer by the associative array that used to underlie the OBJ_NAME API. Adding ciphers is no longer possible. What uses this API does so for historic reasons coming from a time where SHA-2 and some AES variants needed to be enabled explicitly. Ports doing this (PHP and DANE code) were fixed. ok jsing
* Remove custom key length handlingtb2024-02-241-5/+1
| | | | | | | | | | | No cipher in libcrypto is marked EVP_CIPH_CUSTOM_KEY_LENGTH and no control handler deals with EVP_CTRL_SET_KEY_LENGTH, which means that this code is dead as far as libcrypto is concerned. Almost nothing uses EVP_CIPHER_meth* (this was added for a single project) and nothing sets a custom ctrl. This isn't going to change anyway since EVP_CIPHER_meth* is deprecated in order to promote more provider beauty. ok beck jsing
* Align EVP_CIPHER_CTX_init() and _legacy_clear()tb2024-02-181-2/+2
|
* Hide EVP_{CIPHER,MD}_CTX_init() from internalstb2024-02-181-1/+5
| | | | ok jsing
* Use EVP_MD_CTX_legacy_clear() internallytb2024-02-186-15/+15
| | | | ok jsing
* Use EVP_CIPHER_CTX_legacy_clear() internallytb2024-02-182-6/+6
| | | | ok jsing
* Add EVP_MD_CTX_legacy_clear()tb2024-02-182-2/+9
| | | | | | | | | This is analogous to EVP_CIPHER_CTX_legacy_clear() and will serve as an internal replacement for EVP_MD_CTX_init() until the conversion to heap allocated ctx is completed. This way EVP_MD_CTX_init() can be changed to match the OpenSSL 1.1 API. ok jsing
* Add EVP_CIPHER_CTX_legacy_clear()tb2024-02-182-2/+10
| | | | | | | | | | | | | | OpenSSL 1.1 made EVP_CIPHER_CTX_init() an alias of EVP_CIPHER_CTX_reset(). In particular, it changed signature and it would no longer leak internal state if used on an already used ctx. On the other hand, it can't be used for ctx on the stack. libcrypto still has a few ctx on the stack which will be converted to heap allocated contexts at some point. Until this is completed, we will use EVP_CIPHER_CTX_legacy_clear() internally, so that the public API can be changed to match OpenSSL 1.1. ok jsing
* Inline EVP_PBE_find() in its last two callerstb2024-02-011-140/+69
| | | | | | | | | | | | | | | | | This API was already cleaned up quite a bit, but it is unused in the ecosystem and the two internal callers can be simplified a lot when inlining the lookups. EVP_PBE_CipherInit() can walk the table of "outer" PBEs and reach into the matching pbe for its cipher_nid, md_nid and keygen(). PKCS5_v2_PBKDF2_keyivgen() uses EVP_PBE_find() as a way to mapping a PRF (given by the nid of an HMAC with some digest) to the digest's nid. This can be done by a simple switch. Move MD5 to the top and GOST to the end in that switch and wrap the latter in OPENSSL_NO_GOST, so it will go away once we define OPENSSL_NO_GOST. ok beck
* Make EVP_{CIPHER,MD}_CTX_{cleanup,reset}() NULL-safetb2024-01-302-3/+8
| | | | | | | | We have a bunch of code that relies on this. Surely there is code out there in the wider ecosystem that relies on these being NULL-safe by now since upstream sprinkles NULL checks wherever they can. ok beck joshua
* Dynamic EVP_PKEY_METHODs are a thing from the pasttb2024-01-271-3/+1
|
* Add a few aliases for ECDSA and DSA for security/xcatb2024-01-271-1/+143
| | | | ok jsing
* Use ret instead of rv in a few keyivgen functionstb2024-01-271-11/+11
|
* Fold keyivgen functions into evp_pbe.ctb2024-01-273-472/+386
| | | | | These are only used by the EVP_PBE routines and will become internal in the next major bump.
* Make some comments and some whitespace less uglytb2024-01-271-13/+14
|
* Whitespace tweaktb2024-01-271-2/+4
|
* Throw PKCS5_PBE_add() into the trash bin at the end of evp_pbe.ctb2024-01-272-10/+7
| | | | This has been a noop since forever and will be removed in the next bump.
* Mark the functions at the end of this file for removaltb2024-01-271-1/+5
|
* Support HMAC with SHA-3 as a PBE PRFtb2024-01-271-1/+21
| | | | ok jsing
* Support HMAC with truncated SHA-2 as a PBE PRFtb2024-01-271-1/+11
| | | | ok jsing
* Prepare to remove the EVP_PKEY_meth_* APItb2024-01-131-89/+50
| | | | | | | | | | After removing the last caller of EVP_PKEY_meth_find() from libssl, none of these is used. And with EVP_PKEY_meth_new() gone, there will no longer be a way to get your hands onto an EVP_PKEY_METHOD that is writable, so none of the silent failures (because they're void functions) should matter in the few weeks until we bump. ok jsing
* The OBJ_NAME API joins the party in evp_names.ctb2024-01-131-1/+50
| | | | ... and another file without license disappears.
* Move EVP_add_{cipher,digest}() to the trashcantb2024-01-132-78/+17
| | | | They will await their removal in the next major bump.
* Open a garbage bin at the bottom of evp_names.ctb2024-01-132-7/+13
| | | | | First to move is EVP_cleanup(), which should probably be moved to an evp_lib.c if such a file is reinstated.
* Remove obj_cleanup_defertb2024-01-131-7/+1
| | | | | With check_defer() gone, this is never set to anything but 0, so the two conditional branches it is still involved in are dead code.
* Garbage collect check_defer()tb2024-01-131-2/+1
| | | | | | | | | | | | | This was a mechanism to ensure that OBJ_cleanup() doesn't remove the ASN1_OBJECT associated with a custom cipher or digest (that was added with EVP_add_{cipher,digest}(), while the latter is still referenced in the OBJ_NAME table. It had the effect that OBJ_cleanup() wasn't actually called ever from OPENSSL_cleanup() (it is only called if you load the OID conf module). Oh, and of course it was once part of the public API. I fixed that two years ago, almost exactly to the day. Still mentioned in OBJ_create.3.
* Neuter EVP_add_{cipher,digest}()tb2024-01-131-11/+1
| | | | | | | | | | This makes them noops. They are used in the wild for adding ciphers that are always added by the library init code. This is a historic leftover. This removes the last (and only ever) calls to check_defer(). ok jsing
* Remove most of EVP_add_{cipher,digest}() internalstb2024-01-131-30/+6
| | | | | | | OBJ_NAME_add() is a noop now, so remove all calls and simplify the remainder of these two functions a bit. Intermediate step to a larger diff that was ok jsing
* Remove OBJ_NAME_cleanup() calls from EVP_cleanup()tb2024-01-131-8/+1
| | | | This is a noop now, so no need to call it.
* Stub out {OpenSSL,OPENSSL}_add*tb2024-01-131-331/+0
| | | | | | | | | | | These serve no purpose anymore (and really haven't for many years) but will have to be kept since there's a number of software that still uses them because many years ago they had to. Relocate the stubs to crypto_init.c since library initialization's what they were there for. ok jsing
* Reimplement EVP_get_{cipher,digest}byname()tb2024-01-132-20/+47
| | | | | | | Instead of a hashtable lookup do a bsearch() over the static table. This needs about the same number of strcmp and is a lot simpler. ok jsing
* Reimplement {EVP_CIPHER,EVP_MD,OBJ_NAME}_do_all{,_sorted}(3)tb2024-01-132-95/+160
| | | | | | | | | | | | | | | | | | | | | This implements the do_all API by simple loops over the tables of digests and ciphers. Since some ciphers are only available on some platforms, we need to skip them if necessary. We use loops in each of the functions rather the convoluted way of reducing some of the loops to others. Since the tables are sorted, as ensured by regress, both do_all() and do_all_sorted() walk the lists in order. In particular, we no longer need to allocate to be able to sort hash tables by name on the fly in a void function that may end up doing nothing because allocation failed. We still need to do an unchecked OPENSSL_init_crypto() call. But that's what prayer and clean living are there for (as beck put it). The OBJ_NAME API is completely misnamed. It has little to do with objects and a lot to do with EVP. Therefore we implement what will remain from its saner replacement in the evp directory, i.e., evp_names.c. ok jsing
* Add a table of digest names, digests and aliasestb2024-01-131-2/+475
| | | | | | | | This is the corresponding commit for digests and their aliases. It only adds a table to be used in upcoming commits. What was said about ciphers applies mutatis mutandis to digests. ok jsing
* Add a table of cipher names, ciphers and aliasestb2024-01-131-0/+1088
| | | | | | | | | | | | | | | | | | | | | | | | | | This arranges the data provided by dynamic library initialization in a static table and will help avoid gross code with missing error checking and other defects on every use of the library. This table isn't pretty due to various naming inconsistecies accumulated over the decades. It will significantly simplify the implementation of API such as EVP_get_cipherbyname() and EVP_CIPHER_do_all(). All the table does is map strings to ciphers, typically used on the openssl(1) command line or in code it's the mechanism that underlies the map from NID_chacha20 to the data returned by EVP_chacha20(). It's of course more complicated because it just had to be stupid. This is one of the places where the use of bsearch() is justified. The price to pay for the simplification is that adding custom aliases and custom ciphers to this table will no longer be supported. It is one significant user of the LHASH madness. That's just another piece of the awful "toolkit aspect"-guided misdesign that contributes to making this codebase so terrible. A corresponding table for the digests will be added in the next commit. ok jsing