summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/p_lib.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Garbage collect unused attributes member from EVP_PKEYtb2024-08-221-2/+1
| | | | ok miod
* Hide public symbols in evp.hbeck2024-04-091-1/+47
| | | | | | largely mechanically done by the guentherizer 9000 ok tb@
* Unhook and remove GOST and STREEBOGtb2024-03-021-9/+1
| | | | | | | | | | | | 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
* 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.
* 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-041-3/+3
| | | | | | | | | | | | | | | | 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
* Split ameth arrays into individual methodstb2024-01-041-14/+21
| | | | | | | | | | | | 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
* Remove EVP_PKEY's save_type membertb2024-01-011-4/+1
| | | | | | | 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
* Move the EVP_PKEY_asn1_* API that will stay to evp/p_lib.ctb2023-12-291-5/+193
| | | | | | | | Most of these functions are only called from this file internally apart from the pem_str lookups from pem/. In the next major bump we can then remove asn/ameth_lib.c. Also move EVP_PKEY_ASN1_METHOD to evp_local.h. While this is used to dispatch to various ASN.1 decoding routines, it doesn't fit into asn1/ at all.
* Move EVP_PKEY_assign() a bit up and tweak it slightlytb2023-12-251-10/+10
| | | | ok jsing
* Rename a few ret into pkeytb2023-12-251-28/+29
|
* Rework EVP_PKEY_set_type{,_str}()tb2023-12-251-34/+27
| | | | | | | | | | | | | These two functions previously wrapped a pkey_set_type() helper, which was an utter mess because of ENGINE. With the long awaited departure of ENGINE, this function became a lot simpler. A further simplification is obtained by not doing the optimization to avoid an ameth lookup: this requires walking a list of 11 ameths. We should consider bsearch()... With this gone and a saner implementation of EVP_PKEY_free_it(), we can implement these functions with a dozen lines of code each. ok jsing
* Rework EVP_PKEY_free()tb2023-12-251-11/+7
| | | | | | | | Use pkey instead of x, remove the pointless variable i, no need to check for NULL before sk_X509_ATTRIBUTE_pop_free(), switch to freezero() to leave fewer invalid pointers around. ok jsing
* Move EVP_PKEY_free() up next to evp_pkey_free_pkey_ptr()tb2023-12-251-19/+19
| | | | ok jsing
* Fix EVP_PKEY_up_ref() - must have hit ^X somehowtb2023-12-251-2/+2
|
* Rework evp_pkey_free_pkey_ptr()tb2023-12-251-6/+7
| | | | | | Rename the variable from x into pkey, make it NULL safe and unindent. ok jsing
* Rename EVP_PKEY_free_it() into evp_pkey_free_pkey_ptr()tb2023-12-251-4/+4
| | | | ok jsing
* Move the confusingly named EVP_PKEY_free_it() a bit uptb2023-12-251-12/+10
| | | | ok jsing
* Simplify EVP_PKEY_up_ref()tb2023-12-251-3/+2
| | | | | | There is no need for a local variable and a ternary operator here. ok jsing
* Switch EVP_PKEY_new() from malloc() to calloc()tb2023-12-251-8/+6
| | | | ok jsing
* Ignore ENGINE at the API boundarytb2023-11-291-26/+17
| | | | | | | | This removes the remaining ENGINE members from various internal structs and functions. Any ENGINE passed into a public API is now completely ignored functions returning an ENGINE always return NULL. ok jsing
* Unifdef OPENSSL_NO_ENGINE in libcryptotb2023-11-191-20/+1
| | | | | | | This is mechanical apart from a few manual edits to avoid doubled empty lines. ok jsing
* Make EVP_PKEY_get1_$TYPE a wrapper of EVP_PKEY_get0_$TYPEtb2023-09-101-22/+29
| | | | | | | Avoids a bit of code duplication and reduces the probability of a fix being applied to only one of get0 and get1 (which happend in p_lib.c r1.35). ok jsing
* Align EVP_PKEY_get1_RSA() with EVP_PKEY_get0_RSA()tb2023-09-021-6/+7
|
* Fix EVP_PKEY_get0_RSA() for RSA-PSStb2023-09-011-6/+6
| | | | | | It currently returns NULL. This is OpenSSL 4088b926 + De Morgan. ok jsing
* Unbreak the namespace build after a broken mk.conf and tool misfire hadbeck2023-07-071-41/+1
| | | | | | | | me aliasing symbols not in the headers I was procesing. This unbreaks the namespace build so it will pass again ok tb@
* Hide symbols in hkdf, evp, err, ecdsa, and ecbeck2023-07-071-1/+41
| | | | | | (part 2 of commit) ok jsing@
* Make internal header file names consistenttb2022-11-261-3/+3
| | | | | | | | | | | | | | | | Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include <ssl_locl.h> was fixed manually. discussed with jsing, no objection bcook
* Change the pkey.ptr from char * to void *tb2022-11-181-2/+2
| | | | | | | | Now that EVP_PKEY is opaque, there is no reason to keep the ptr member of the pkey union as a weird char pointer, a void pointer will do. This avoids a few stupid casts and simplifies an upcoming diff. ok jsing
* Port EVP raw key API from OpenSSL.jsing2022-11-101-2/+91
| | | | | | This will be needed to deal with Curve25519 based keys. ok beck@ tb@
* Prepare to provide EVP_PKEY_security_bits()tb2022-06-271-1/+12
| | | | | | | This also provides a pkey_security_bits member to the PKEY ASN.1 methods and a corresponding setter EVP_PKEY_asn1_set_security_bits(). ok beck jsing
* Add check for BIO_indent return valueinoguchi2022-01-201-2/+3
| | | | | | CID 24778 ok jsing@ millert@ tb@
* Include evp_locl.h where it will be needed once most structs fromtb2021-12-121-1/+2
| | | | | | evp.h will be moved to evp_locl.h in an upcoming bump. ok inoguchi
* Prepare to provide EVP_PKEY_new_CMAC_key()tb2021-03-291-8/+43
| | | | | | | sebastia ran into this when attempting to update security/hcxtools. This will be tested via wycheproof.go once the symbol is public. ok jsing, tested by sebastia
* Provide EVP_PKEY_get0_hmac(). From OpenSSL 1.1.1 which is stilltb2019-03-171-1/+17
| | | | | | freely licensed. From jsing
* Add a const qualifier to the argument of EVP_PKEY_size().tb2018-05-301-2/+2
| | | | | tested in a bulk build by sthen ok jsing
* Add a const qualifier to the argument of EVP_PKEY_get0(3).tb2018-05-131-2/+2
| | | | | tested in a bulk build by sthen ok beck (as part of a larger diff)
* Add a const qualifier to the argument of EVP_PKEY_bits(3).tb2018-05-131-2/+2
| | | | | tested in a bulk build by sthen ok beck (as part of a larger diff)
* make ENGINE_finish() succeed on NULL and simplify callers as intb2018-04-141-13/+7
| | | | | | | | | | | OpenSSL commit 7c96dbcdab9 by Rich Salz. This cleans up the caller side quite a bit and reduces the number of lines enclosed in #ifndef OPENSSL_NO_ENGINE. codesearch.debian.net shows that almost nothing checks the return value of ENGINE_finish(). While there, replace a few nearby 'if (!ptr)' with 'if (ptr == NULL)'. ok jsing, tested by & ok inoguchi
* Provide EVP_PKEY_get0_EC_KEY() and 'if (ret)' vs 'if (ret != 0)' cosmetics.tb2018-02-201-11/+20
| | | | ok jsing
* Provide further parts of the OpenSSL 1.1 API: {DH,DSA}_get0_{key,pqg}(),tb2018-02-171-19/+48
| | | | | | EVP_PKEY_get0_{DH,DSA,RSA}(), RSA_{g,s}et0_key(). ok jsing
* Provide EVP_PKEY_up_ref().jsing2018-02-141-1/+8
|
* Send the function codes from the error functions to the bit bucket,beck2017-01-291-11/+9
| | | | | | as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
* No need to include asn1_mac.h here.miod2014-07-121-2/+1
|
* Only import cryptlib.h in the four source files that actually need it.jsing2014-07-111-8/+8
| | | | | | | | Remove the openssl public includes from cryptlib.h and add a small number of includes into the source files that actually need them. While here, also sort/group/tidy the includes. ok beck@ miod@
* Explicitly include <openssl/opensslconf.h> in every file that referencesjsing2014-07-101-1/+4
| | | | | | | | | an OPENSSL_NO_* define. This avoids relying on something else pulling it in for us, plus it fixes several cases where the #ifndef OPENSSL_NO_XYZ is never going to do anything, since OPENSSL_NO_XYZ will never defined, due to the fact that opensslconf.h has not been included. This also includes some miscellaneous sorting/tidying of headers.
* tags as requested by miod and teduderaadt2014-06-121-1/+1
|
* malloc() result does not need a cast.deraadt2014-06-071-1/+1
| | | | ok miod