summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_item.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Hide public symbols in x509.hbeck2024-04-091-1/+5
| | | | | | | This picks up most of the remaining public symbols in x509.h ok tb@
* Clean up EVP_MD_CTX_{init,cleanup}() usage in ASN1_item_verify()joshua2024-01-281-9/+10
| | | | ok tb@
* Clean up EVP_MD_CTX_init() usage in ASN1_item_sign()joshua2024-01-131-8/+15
| | | | ok tb@
* Convert asn1_item_sign() to X509_ALGOR_set0_by_nid()tb2023-11-091-8/+4
| | | | ok jca
* Refactor ASN1_item_sign_ctx()tb2023-07-131-54/+89
| | | | | | | | | | | | | | | | | | | | | | Oh, joy! The muppets had a feast: they could combine the horrors of EVP with X.509... Return values between -1 and 3 indicating how much work needs to be done, depending on whether methods are present or absent. Needless to say that RSA and EdDSA had inconsistent return values until recently. Instead of interleaving if/else branches, split out two helper functions that do essentially independent things, which results in something that isn't entirely bad. Well, at least not compared to the surrounding code. asn1_item_set_algorithm_identifiers() extracts the signature algorithm from the digest and pkey if known, and sets it on the two X509_ALGOR that may or may not have been passed in. asn1_item_sign() converts data into der and signs. Of course there were also a few leaks and missing error checks. ok jsing
* Unbreak the namespace build after a broken mk.conf and tool misfire hadbeck2023-07-071-5/+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 asn1 and biobeck2023-07-051-1/+12
| | | | ok jsing@
* Some fixes in ASN1_item_verify()tb2023-06-151-17/+8
| | | | | | | | Switch to using EVP_DigestVerify(). Move the freeing of in where it belongs (previously it would leak on EVP_DigestVerifyUpdate() failure), and use the proper idiom for ASN1_item_i2d() error checking. ok jsing
* Make another NULL check explicit and put a brace on the proper linetb2023-06-151-4/+3
|
* Rename a few variables and other cosmeticstb2023-06-151-23/+21
| | | | | | | Rename buf_in into in, buf_out into out, use in_len and out_len for their lengths, drop a couple of silly casts and remove some empty lines. ok jsing
* Switch ASN1_item_sign_ctx() to EVP_DigestSign()tb2023-06-151-9/+7
| | | | | | | | | This makes this function work with Ed25519 and cleans up a handful of ugly contortions: use EVP_DigestSign() to determine the signature length instead of using the strange EVP_PKEY_size() and garbage collect the now useless out_len. Also use calloc(). ok jsing
* Make NULL checks explicit in ASN1_item_sign_ctx()tb2023-06-151-6/+8
| | | | | | | Also move the NULL check for the EVP_MD into the rv == 2 path, which is the only branch where it is used. ok jsing
* ASN1_item_sign_ctx()tb2023-06-151-3/+7
| | | | | | Pull a NULL check for pkey->ameth up to before ameth is first accessed. An EVP_PKEY created with EVP_PKEY_new() has ameth == NULL, so this check makes sense, but it does not make sense to do it where it was.
* Fix a logic error in ASN1_item_sign_ctx()tb2023-06-151-5/+8
| | | | | | | | | | | If the item_sign() ASN.1 method returns 1, it supposedly handles everything and the goto err prior to r1.5 was actually a success path. Go figure. This is fortunately inconsequential since there are only two item_sign() methods, one for RSA and one for Ed25519, neither of which can return 1. They only return 0, 2, and 3. Pointed out by and ok jsing
* Move comment about ASN1_item_dup() where it belongstb2023-06-131-7/+7
| | | | | Reword it in such a way that it stands on its own and doesn't refer to a non-existent model above. Also tweak grammar and fix typos.
* 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
* Clean up ASN1_item_sign_ctx() a littletb2022-05-241-25/+38
| | | | | | | | | | | | | Instead of inl, outl, and outll, use in_len, out_len, and buf_out_len. Use the appropriate types for them. Check return values properly, check for overflow. Remove some unnecessary casts and add some for readability. Use asn1_abs_set_unused_bits() instead of inlining it. This removes the last direct consumer of ASN1_STRING_FLAG_BITS_LEFT outside of asn1/a_bitstr.c. The flag is still mentioned in x509/x509_addr.c but that will hopefully go away soon. tweaks/ok jsing
* Remove legacy sign/verify from EVP_MD.tb2022-01-141-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes m_dss.c, m_dss1.c, and m_ecdsa.c and the corresponding public API EVP_{dss,dss1,ecdsa}(). This is basically the following OpenSSL commit. The mentioned change in RSA is already present in rsa/rsa_pmeth.c. ok inoguchi jsing commit 7f572e958b13041056f377a62d3219633cfb1e8a Author: Dr. Stephen Henson <steve@openssl.org> Date: Wed Dec 2 13:57:04 2015 +0000 Remove legacy sign/verify from EVP_MD. Remove sign/verify and required_pkey_type fields of EVP_MD: these are a legacy from when digests were linked to public key types. All signing is now handled by the corresponding EVP_PKEY_METHOD. Only allow supported digest types in RSA EVP_PKEY_METHOD: other algorithms already block unsupported types. Remove now obsolete EVP_dss1() and EVP_ecdsa(). Reviewed-by: Richard Levitte <levitte@openssl.org> Plus OpenSSL commit 625a9baf11c1dd94f17e5876b6ee8d6271b3921d for m_dss.c
* Indent goto labels for diffability.jsing2021-12-251-6/+6
| | | | Whitespace change only.
* Merge asn_pack.c into asn1_item.c - these are two ASN1_item_* functions.jsing2021-12-251-1/+48
| | | | No functional change.
* More consolidation of ASN.1 code.jsing2021-12-251-0/+595
Consolidate various ASN1_item_* functions into asn1_item.c and the remaining NO_OLD_ASN1 code (not to be confused with the NO_ASN1_OLD code) into asn1_old.c. This is preferable to having many files, often with one or two functions per file. No functional change. Discussed with tb@