summaryrefslogtreecommitdiff
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Move EVP_Cipher() from evp_lib.c to evp_enc.ctb2023-12-152-9/+9
| | | | | | | | EVP_Cipher() is a dangerous thin wrapper of the do_cipher() method set on the EVP_CIPHER_CTX's cipher. It implements (part of) the update and final step of the EVP_Cipher* API. Its behavior is nuts and will be documented in a comment in a subsequent commit. schwarze has a manpage diff that will fix the incorrect documentation.
* Clean up includestb2023-12-151-6/+4
|
* Neuter EVP_PKEY_asn1_add{0,_alias}()tb2023-12-151-42/+10
| | | | | | | | | Nothing uses these, so they will be removed in the next bump. For now make them always fail and remove the unprotected global state backing them. This makes EVP_PKEY_asn1_get{0,_count}() completely trivial and will allow some further cleanup in later steps. ok jsing
* Hoist OBJ_sn2nid() over OBJ_ln2nid()tb2023-12-151-17/+17
| | | | | In all other places, the short name comes before the long name, so fix the only exception.
* Coverity rightly points out that an unsigned int is always >= 0tb2023-12-151-4/+4
|
* OBJ_create: sorry Omar, aobj is a better name than optb2023-12-141-5/+5
| | | | Done.
* OBJ_create: use a nid variable to avoid nested function calltb2023-12-141-3/+4
|
* OBJ_create: malloc() -> calloc()tb2023-12-141-2/+2
|
* OBJ_create: test and assign as usualtb2023-12-141-7/+7
|
* OBJ_create: initialize buf and turn function into single exittb2023-12-141-4/+5
|
* OBJ_create: rename ok to ret and make it last declarationtb2023-12-141-4/+4
|
* OBJ_create(): rename i to lentb2023-12-141-8/+8
|
* OBJ_create(): remove pointless parenthesestb2023-12-141-4/+4
|
* OBJ_create(): remove useless casttb2023-12-141-2/+2
|
* OPENSSL_assert() that the passed nid is within rangetb2023-12-141-1/+7
| | | | discussed with deraadt and jsing
* Bump OPENSSL_showfatal() from LOG_INFO to LOG_CONStb2023-12-141-2/+2
| | | | | | This way people can actually notice that an OPENSSL_assert() triggered. discussed with deraadt and jsing
* Move the txt to obj/nid conversions a bit down.tb2023-12-141-42/+42
| | | | No code change
* Dedup OBJ_nid2{obj,sn,ln}()tb2023-12-141-49/+9
| | | | | First get the obj corresponding to nid, then inspect its sn and ln. Shaves off 40 lines of code and will simplify locking.
* Simplify OBJ_nid2obj()tb2023-12-141-23/+26
| | | | | | | This is now yet another identical copy of the same code... Next step will be to dedup. ok jsing
* Simplify OBJ_nid2sn()tb2023-12-141-23/+26
| | | | | | | This is exactly the same as the previous OBJ_nid2ln() change modulo s/ln/sn/g. ok jsing
* Simplify OBJ_nid2ln()tb2023-12-141-23/+26
| | | | | | | | | | | | If nid is in the range of built-in NIDs, return the corresponding long name, unless some genius left a hole. Otherwise perform a yolo check if there are any user-added objects with matching nid in the global hash. This changes behavior in that we now push an OBJ_R_UNKNOWN_NID error onto the stack even if there are no user-added objects. ok jsing
* Fix sk_deep_copy() implementationtb2023-12-141-32/+22
| | | | | | | | | | | | | | | | | sk_deep_copy() is bad code. It is less bad than the upstream code, but still bad: it passes strdup() through a void pointer and assigns it to a function pointer of different type before calling the latter. That's not kosher in more than one way. There is no need for such gymnastics. If we need a deep copy for a type, we should implement it as appropriate for that type. Also, we should not expect and even less so allow holes in a STACK_OF(). The only way the vpm->hosts can be populated is by way of this deep_copy function or x509_param_set_hosts_internal(), which pushes only after a non-NULL check. Invariants: they're useful. ok jsing
* Simplify OBJ_ln2nid()tb2023-12-131-42/+32
| | | | | | | | | This is s/sn/ln/g of the previous commit and eliminates another OBJ_bsearch_() user, the last one in this file. The bsearch() uses in this file are possibly the only ones that actually make sense since we're searching tables of roughly 1000 entries. ok jsing
* Simplify OBJ_sn2nid()tb2023-12-131-41/+30
| | | | | | | | | | Another OBJ_bsearch_() elimination. OBJ_sn2nid() is very similar to OBJ_obj2nid(). First it tries to retrieve an object identifier with matching "short name" from the global hash of added objects and then searches the table of built-in objects. ok jsing
* Simplify OBJ_obj2nid()tb2023-12-131-39/+28
| | | | | | | | | | | | | | | | | | Continue with OBJ_bsearch_() elimination. OBJ_obj2nid() first checks if the object identifier passed in has a nid and if so, it returns that. Otherwise, it looks into the global hash of added objects (of course without locking) for a match and then returns the nid thereof. As a last attempt, it searches the table of built-in object identifiers. The last two steps can be cleaned up and simplified quite a bit by using C99 initializers, bsearch() and an appropriate comparison function. Then it becomes obvious that bsearch() already returns a pointer to the nid we're looking for, so there is no point in converting that into its corresponding obj and returning the nid thereof. ok jsing
* rfc3779: remove redundant const.tb2023-12-131-5/+5
| | | | | This is already included in the typedef (yuck) and makes some Windows compilers unhappy.
* tlsexttest: \178 isn't a valid octal escape sequencetb2023-12-131-2/+2
|
* constraints: \178 isn't a valid octal escape sequencetb2023-12-131-2/+2
|
* x509_asn1: avoid lookup table that makes some compilers whinetb2023-12-131-59/+37
|
* evp_test: zap extra empty linetb2023-12-101-2/+1
|
* Add regress coverage for OBJ_NAME_do_all*()tb2023-12-081-2/+99
| | | | | | | While this may seem a bit out of place since is an objects API by name, it really is about EVP. Plus, we want to leverage some things we already needed for the EVP_*do_all() API (which currently wraps OBJ_NAME_do_all* but that will change soon).
* last .Nm should not have a commajsg2023-12-051-3/+3
|
* zap trailing whitespacetb2023-12-041-2/+2
|
* Save backtraces to show in leak dump. Depth of backtrace set byotto2023-12-042-87/+184
| | | | | malloc option D (aka 1), 2, 3 or 4. No performance impact if not used. ok asou@
* Remove misuse warnings for EVP_*Final()tb2023-12-031-12/+1
| | | | | | | | | | | | | | They make no sense. These are thin wrappers of EVP_*Final_ex() and behave exactly the same way. The minor behavior difference of Init and Init_ex is likely a historical artefact of this abomination of an API. Deprecation of the Init functions was recently removed from the manpage. The only reason to prefer the _ex versions over the normal versions is ENGINE. This is no longer an argument. The warnings were added in an attempt at adding automatic cleanup. This broke stuff and was therefore backed out. The warnings remained. discussed with schwarze
* Fix some NULL misspellingstb2023-12-021-10/+10
|
* Revert a hunk of r1.23 that makes no sensetb2023-12-021-8/+2
| | | | | | The commit was about checking EVP_CIPHER_CTX_iv_length(), but the function called here is EVP_CIPHER_CTX_key_length(). The result of the computation is still correct, the check and local variable simply make no sense.
* Some cleanup:schwarze2023-12-011-71/+33
| | | | | | | | | | Remove some lies and some irrelevant historical information about the non_ex variants and waste fewer words deprecating them. Telling people to type longer function names and to pass an ignored NULL argument doesn't really help anything. Also talk less about those ignored ENGINE arguments. OK tb@
* EVP_EncryptInit(3) is among the most important "how to drive" manuals,schwarze2023-12-014-65/+165
| | | | | | | | but it is still excessively long and complicated. To reduce the amount of distractions a bit, split out three deprecated functions into a new manual page EVP_CIPHER_CTX_init(3). No text change. In part suggested by tb@, who agrees with the direction.
* Unify various EVP_*{Update,Final}*() wrapperstb2023-12-011-18/+10
| | | | | | The correct way of wrapping foo() is 'int ret; ret = foo(); return ret;' because 'return foo();' would be too simple... Also unify branching from EVP_Cipher* into EVP_Encrypt* EVP_Decrypt*.
* Clean up and de-spaghettize by_file_callbackbeck2023-11-301-21/+15
| | | | | | | I had to read this for other purposes and it exceeded my muppetry tolerance. ok tb@
* Ignore ENGINE at the API boundarytb2023-11-2919-84/+61
| | | | | | | | 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
* Clean up CMAC implementation a littletb2023-11-291-34/+66
| | | | | | | | | | | | | | | | Add explanatory comments that refer to the spec so that all the weird dances make a little more sense. It turns out that this implmeentation only supports block ciphers with block sizes of 64 and 128 bits, so enforce this with a check. Simplify make_kn() to make a little more sense and make it constant time. Some stylistic fixes like checking pointers explicitly against NULL and shuffle things into an order that makes a bit more sense. Includes a fix for a warning reported by Viktor Szakats in https://github.com/libressl/portable/issues/926 ok jsing
* Convert ssl3_cipher_by_id() to bsearch()tb2023-11-293-39/+19
| | | | | | | | | | | | | | | | | This was previously the only user of OBJ_bsearch_ssl_cipher_id(), which in turn is the one remaining user of OBJ_bsearch_() outside of libcrypto. OBJ_bsearch_() is OpenSSL's idiosyncratic reimplementation of ANSI C89's bsearch(). Since this used to be hidden behind macro insanity, the result was three inscrutable layers of comparison functions. It is much simpler and cleaner to use the standard API. Move all the code to s3_lib.c, since it's ony used there. In a few further diffs, OBJ_bsearch_() will be removed from libcrypto. Unfortunately, we'll need to keep OBJ_bsearch_ex(), because it is exposed via sk_find_ex(), which is exposed by M2Crypto... ok jsing
* Use a long for id in ssl3_get_cipher_by_id()tb2023-11-292-4/+4
| | | | | | | | | While the cipher id is effectively a 32-bit value, someone decided that it should be represented by a long in various internal structs, whose mameber is passed as id. So use a long because of this and also to make an upcoming diff simpler. ok jsing
* Switch to legacy method late in tls13_use_legacy_stack()tb2023-11-281-3/+7
| | | | | | | | | | | | | | If memory allocation of s->init_buf fails in ssl3_setup_init_buffer() during downgrade to the legacy stack, the legacy state machine would resume with an incorrectly set up SSL, resulting in a NULL dereference. The fix is to switch to the legacy method only after the SSL is fully set up. There is a second part to this fix, which will be committed once we manage to agree on the color of the bikeshed. Detailed analysis and patch from Masaru Masuda, many thanks! https://github.com/libressl/openbsd/issues/146 ok jsing
* correct spelling of FALLTHROUGHjsg2023-11-281-2/+2
|
* EVP test: fix includestb2023-11-271-3/+3
|
* EVP test: add regress coverage for the do_all() APItb2023-11-271-1/+132
|
* Regen cert.pemtb2023-11-271-224/+400
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ok sthen New Roots for existing CA: /CN=Atos TrustedRoot Root CA ECC TLS 2021/O=Atos/C=DE /CN=Atos TrustedRoot Root CA RSA TLS 2021/O=Atos/C=DE New CA: BEIJING CERTIFICATE AUTHORITY /C=CN/O=BEIJING CERTIFICATE AUTHORITY/CN=BJCA Global Root CA1 /C=CN/O=BEIJING CERTIFICATE AUTHORITY/CN=BJCA Global Root CA2 Two E-Tugra roots were removed due to a breach: /C=TR/L=Ankara/O=E-Tugra EBG A.S./OU=E-Tugra Trust Center/CN=E-Tugra Global Root CA ECC v3 /C=TR/L=Ankara/O=E-Tugra EBG A.S./OU=E-Tugra Trust Center/CN=E-Tugra Global Root CA RSA v3 https://groups.google.com/a/mozilla.org/g/dev-security-policy/c/C-HrP1SEq1A Removed expired root: /C=HK/O=Hongkong Post/CN=Hongkong Post Root CA 1 Removed expired CA: SECOM Trust.net /C=JP/O=SECOM Trust.net/OU=Security Communication RootCA1 New CA: Sectigo Limited /C=GB/O=Sectigo Limited/CN=Sectigo Public Server Authentication Root E46 /C=GB/O=Sectigo Limited/CN=Sectigo Public Server Authentication Root R46 New roots for existing CA: /C=US/O=SSL Corporation/CN=SSL.com TLS ECC Root CA 2022 /C=US/O=SSL Corporation/CN=SSL.com TLS RSA Root CA 2022