summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove X509_TRUST extensibilitytb2024-01-071-102/+10
| | | | | | | | This is pretty much identical to the X509_PURPOSE case: remove the stack used for extending and overriding the trust table and make X509_TRUST_add() always fail. Simplify some other bits accordingly. ok jsing
* Zap some more CRL method thingstb2024-01-061-10/+1
|
* Remove X509_PURPOSE_cleanup() call in OPENSSL_cleanup()tb2024-01-061-2/+1
| | | | | Since x509_purp.c r1.34 this is a noop since there is nothing to clean up anymore. Remove the last caller.
* Remove X509_CRL_METHOD internalstb2024-01-063-92/+25
| | | | | | | | | | | | | | | Another complication of dubious value that nobody's ever used. crl_init(), crl_free() and the meth_data are dead weight, as are their accessors. Inline def_crl_verify() in X509_CRL_verify() so that the latter becomes the trivial wrapper of ASN1_item_verify() that one would expect it to be. It is quite unclear what kind of customization would make sense here... def_crl_lookup() is renamed into crl_lookup() and its two callers, X509_CRL_lookup_by_{serial,cert}(), are moved below it so that we don't need a prototype. ok jsing
* Remove X509_PURPOSE extensibilitytb2024-01-061-112/+10
| | | | | | | | | | | | | | | | | | | Another bit of global state without lock protection. The by now familiar complications of a stack to make this user configurable, which, of course, no one ever did. The table is not currently const, and the API exposes its entries directly, so anyone can modify it. This fits very well with the safety guarantees of Rust's 'static lifetime, which is how rust-openssl exposes it (for no good reason). Remove the stack and make the X509_PURPOSE_add() API always fail. Simplify the other bits accordingly. In addition, this API inflicts the charming difference between purpose identifiers and purpose indexes (the former minus one) onto the user. Neither of the two obvious solutions to avoid this trap seems to have crossed the implementer's mind. ok jsing
* EVP_PKEY_asn1_find_str() tweakstb2024-01-051-4/+3
| | | | | Switch i to a size_t and improve a flag check. Part of an earlier diff that was ok jsing but were lost when I reworked the diff.
* evp_key.c: Remove more unnecessary parenthesestb2024-01-051-7/+6
|
* Minor tweaks in EVP_read_pw_string_min()tb2024-01-051-4/+4
| | | | | Remove unnecessary parentheses and use a better place to break an overlong line.
* Plug a leak in EVP_read_pw_string_min()tb2024-01-051-9/+14
| | | | | | | Use an error exit that frees the ui in case the UI_add_* fail. Also add a few empty lines for readability. ok joshua
* Disable EVP_PKEY_meth_* extensibilitytb2024-01-041-46/+7
| | | | | | | | | | This removes the global pkey_app_methods stack that was never cleaned up and makes EVP_PKEY_meth_add0() always fail and push an error on the stack. EVP_PKEY_meth_find() can now walk the list of PKEY_METHODs forward and things become a bit cleaner. It's still all way more complicated than it needs to be... ok jsing
* Remove unused app_data from EVP_CIPHERtb2024-01-0415-84/+15
| | | | | | | | The EVP_CIPHER structs are static const data that the library returns when you call EVP_aes_128_cbc(), for example. It makes no sense whatsoever to hang user data off such a struct, but it's been there since forever. ok jsing
* Clean up EVP_PKEY_asn1_get0_info() a bittb2024-01-041-14/+16
| | | | | Use better variable names without silly p prefix and use explicit checks against NULL.
* Clean up EVP_PKEY_asn1_find_str()tb2024-01-041-9/+18
| | | | | | | | | Use slightly better argument and variable names, do not pointlessly try to match a string of negative length < -1, use a size_t for the strlen() and preserve the logic that allows lookup by a string fragment rather than a full string. ok jsing
* Simplify EVP_PKEY_asn1_find()tb2024-01-041-33/+9
| | | | | | | | | EVP_PKEY_asn1_find() finds the EVP_PKEY_ASN1_METHOD underlying the method or alias with nid (or, rather, pkey_id) passed in. Now that we have the base method stored in a pointer, we can return that method after a simple lookup of said nid (or, rather, pkey_id). ok jsing
* Replace .pkey_base_id with a .base_method pointertb2024-01-0411-32/+32
| | | | | | | | | | | | | | | | Every EVP_PKEY_ASN1_METHOD is either an ASN.1 method or an alias. As such it resolves to an underlying ASN.1 method (in one step). This information can be stored in a base_method pointer in allusion to the pkey_base_id, which is the name for the nid (aka pkey_id aka type) of the underlying method. For an ASN.1 method, the base method is itself, so the base method is set as a pointer to itself. For an alias it is of course a pointer to the underlying method. Then obviously ameth->pkey_base_id is the same as ameth->base_method->pkey_id, so rework all ASN.1 methods to follow that. ok jsing
* Neuter the remainder of the ameth libtb2024-01-041-65/+13
| | | | | | | | | | | The few pieces of the ameth lib that will stay in libcrypto were moved to p_lib.c recently. The functions that still are in ameth_lib.c will be removed in the next major bump. With disabled EVP_PKEY_asn1_add{0,_alias}() API they are completely useless now and they are getting in the way of more ameth surgery. Rip out their guts and turn them into stubs that do nothing but push an error onto the stack. ok jsing
* Split ameth arrays into individual methodstb2024-01-044-149/+150
| | | | | | | | | | | | For some reason DSA, GOST, and RSA had their ASN.1 methods stored in an array. This is clumsy and the only benefit is that one saves a few externs in p_lib.c. They were also arranged by ascending NID because of bsearch() madness. Split them up and arrange the methods by name, which is much saner and simpler. ok jsing
* Improve length checks for oiv and ivtb2024-01-041-4/+5
| | | | | | | | | | There are two unsigned char arrays of size EVP_MAX_IV_LENGTH to store the IVs of block ciphers. In most modes, only iv is used, but in some modes iv is modified and oiv is used to store the original IV. At the moment nothing enforces that they are of the same length. Therefore make sure the correct one or both are checked before writing to or reading from them. ok miod
* Improve order in ancient CMS helperstb2024-01-031-25/+25
| | | | | | | First came EVP_CIPHER_param_to_asn1() which wraps EVP_CIPHER_set_asn1_iv() which was implemented last. Then came EVP_CIPHER_asn1_to_param() wrapping EVP_CIPHER_get_asn1_iv(). Move each param function below the iv function it wraps.
* Move a t to the right place in a commenttb2024-01-021-2/+2
|
* Match struct order for the EVP_CIPHER_CTX accessorstb2024-01-021-69/+73
| | | | | | This isn't great since the struct is ordered in about the silliest way imaginable, but it is better than it was before. Bringing order into this mess is harder than solving a Rubik's cube.
* Move down EVP_CIPHER_CTX accessors expose EVP_CIPHER internalstb2024-01-021-38/+42
| | | | | These confusingly named getters were added "for convenience" in 1.1. They fit best next to the EVP_CIPHER API.
* Move the trivial EVP_CIPHER getters downtb2024-01-021-31/+35
| | | | | They are now below the CMS ASN.1 IV stuff, but above the EVP_CIPHER_meth* API, which are setters, in a way.
* Simplify EVP_CIPHER_{asn1_to_param,parma_to_asn1}()tb2024-01-021-17/+13
| | | | There's no need for a ret variable and else if/else
* Move the EVP_CIPHER API that only exists for CMS/legacy a bit downtb2024-01-021-121/+125
|
* sm4: more NULL misspellingstb2024-01-021-4/+4
|
* Two spellings of key length are enoughtb2024-01-021-6/+7
| | | | | | The API is called EVP_CIPHER_CTX_set_key_length() it has an argument called keylen and, the EVP_CIPHER_CTX's member is called key_len. One of the three is trivial to adjust, so do it.
* Rename the poor outlier EVP_CIPHER *e into *ciphertb2024-01-021-3/+3
|
* Better variable names in EVP_CIPHER_type()tb2024-01-021-7/+8
| | | | | The EVP_CIPHER *ctx (yes) is renamed to cipher, otmp becomes an aobj. Change two !ptr to ptr == NULL checks.
* Consistently use ctx for an EVP_CIPHER_CTXtb2024-01-021-36/+36
| | | | Not c (which is most of the time an EVP_CIPHER) or a (?!).
* Fix bounds check in EVP_PKEY_CTX_get_keygen_info()tb2024-01-011-2/+2
| | | | | | | | | Replace > with >= for the upper array bound to disallow a 4 byte overread. For RSA you can read the padding mode and for DH past the DH_PKEY_CTX. Unfortunately, Ruby thought it important to use this, so we can't kill it easily. ok miod
* kill gross whitespacetb2024-01-011-6/+6
|
* pkey_is_pss() and pkey_ctx_is_pss() to rsa_ameth.ctb2024-01-012-6/+6
| | | | | These aren't particularly helpful and should probably both be expanded. For now move them to the only place where they are actually used.
* Remove EVP_PKEY's save_type membertb2024-01-012-6/+2
| | | | | | | This was only used to avoid an ameth lookup in EVP_PKEY_set_type(), a micro-optimization that was removed in p_lib.c r1.48. ok jsing
* KNF nittb2023-12-311-2/+2
|
* Sort the NIDs by nametb2023-12-311-8/+8
| | | | requested by jsing
* Replace the sorted extensions lookup with a switchtb2023-12-311-58/+23
| | | | | | | | | If all you have is OBJ_bsearch_(), everything looks like a nail. This changes a binary search over a list of 12 elements with a lookup via a switch. switch suggested by claudio ok jsing
* Make x509_issuer_cache_free_oldest() statictb2023-12-301-2/+2
| | | | | This is an internal function and you can't hold the required mutex to call it anyway since that's internal, too.
* Some Australians don't like voids eithertb2023-12-301-3/+3
|
* One more missing void was hiding heretb2023-12-301-2/+2
|
* Some BoringSSL devs spent too much time with C++tb2023-12-302-4/+4
|
* fix previous: key -> parametertb2023-12-291-2/+2
|
* A .Xr to DSA_generate_parameters_ex() was lost accidentallytb2023-12-291-1/+2
|
* Move DSA_generate_parameters.3 to DSA_generate_parameters_ex.3tb2023-12-292-3/+3
|
* Adjust documentation for upcoming DSA_generate_parameters removaltb2023-12-295-70/+17
| | | | | | | This removes any mention of DSA_generate_parameters in the manuals apart from a comment that it is intentionally undocumented and adapts cross references to DSA_generate_parameters_ex. The file itself will be moved in a second step.
* ameth_lib: zap trailing empty linetb2023-12-291-2/+1
|
* eckey: adjust some variable names and unwrap function definitionstb2023-12-291-11/+8
| | | | ok jsing
* Clean up old_ec_priv_decode()tb2023-12-291-10/+17
| | | | | | As per usual. Stylistic adjustments and missing error check. ok jsing
* Clean up eckey_param_decode()tb2023-12-291-9/+16
| | | | | | | | This aligns eckey's parameter decoding routine with the one of other cipher abstractions: better variable names, single exit and add missing check for EVP_PKEY_assign_EC_KEY(). ok jsing
* Rework eckey_priv_decode()tb2023-12-291-49/+53
| | | | | | | | | Factor out the pubkey computation and bring it into more sensible form. This removes lots of pointless setting of errors (twice) and makes the code a bit easier on the eyes. Other than that perform some stylistic cleanup like single exit and add an error check for EVP_PKEY_assign(). ok jsing