summaryrefslogtreecommitdiff
path: root/src/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zap a stray spacetb2023-08-251-2/+2
|
* cms_content_bio() is not used outside of cms_lib.ctb2023-08-242-5/+3
| | | | | Make it a static function and remove its prototype from the internal header.
* Some tweaking of cms_content_bio()tb2023-08-241-10/+10
| | | | | | | More idiomatic error checking and drop an always false test for !*pos. Use a slightly closer approximation to actual English sentences in comments. ok jsing
* Better names for the BIOs in CMS_dataInit()tb2023-08-241-14/+14
| | | | | | Rename cmsbio into cms_bio and use {,in_}content_bio for {,i}cont. ok jsing
* Update references from RFC 7539 to RFC 8439tb2023-08-243-10/+10
| | | | | | | | RFC 7539 was superseded by RFC 8439, incorporating errata and making editorial improvements. Very little of substance changed, in particular section numbers remain the same. Prompted by a question from schwarze
* Align the documentation of EVP_chacha20() with actual behaviortb2023-08-241-6/+6
| | | | | | | | Incorrect OpenSSL documentation was moved here and inherited parts of a comment that was fixed in evp/e_chacha.c r1.13. Adjust the manual page accordingly. Discussed with schwarze
* Clarify how the EVP IV is used with ChaChatb2023-08-241-8/+6
| | | | | | | | | | | EVP_chacha20() was aligned to follow OpenSSL's nonconformant implementation during a2k20 by djm and myself in an effort to allow OpenSSH to use the OpenSSL 1.1 API. Some corresponding OpenSSL 1.1 documentation was imported at the same time. A comment attempted to translate between implementation and the incorrect documentation, which was necessarily gibberish. Improve the situation by rephrasing and dropping nonsensical bits. Prompted by a question of schwarze
* Mention key and nonce lengths of AEAD ciphers.schwarze2023-08-232-33/+105
| | | | | | | | | Mention portability considerations regarding the EVP_AEAD API. Avoid confusing words like "older" and "native" API, be specific. Mention RFC 7905. Move publications we don't implement from STANDARDS to CAVEATS. Based on input from jsing@ and tb@, OK tb@.
* Pull the NULL check for cmsbio into the switchtb2023-08-221-14/+10
| | | | ok jsing
* Plug a leak of cont in CMS_dataInit()tb2023-08-221-11/+12
| | | | | | This and ts/ts_rsp_sign.c r1.32 were part of OpenSSL 309e73df. ok jsing
* Plug a leak of ASN1_INTEGR in def_serial_cb()tb2023-08-221-4/+7
| | | | ok jsing
* ec_ameth: clean up eckey_{pub,priv}_encode()tb2023-08-211-62/+67
| | | | | | | | | | | | | | | | | | | Factor eckey_param_free() out of eckey_pub_encode(). ASN1_OBJECT_free() is not actually needed. This will be addressed later. i2o_ECPublicKey() allocates internally if *out == NULL, so no need to do the two-call dance. Its return value is documented to be <= 0 on error, which is wrong in the sense that only 0 is returned. Keep using the same check for <= 0 as everywhere else. Set of EC_PKEY_NO_PARAMETERS after the poorly named eckey_param2type() to avoid potential underhanded side effects. In eckey_priv_encode(), error exits would leak pval was leaked a few times. Avoid this and simplify using i2d's internal allocation. Reinstate the flags in a single error path. ok jsing
* spellingjsg2023-08-211-4/+4
|
* Check X509_digest() return in x509v3_cache_extensions()tb2023-08-181-2/+3
| | | | | | | | On failure invalidate the cert with EXFLAG_INVALID. It's unlikely that a cert would make it through to the end of this function without setting the flag, but it's bad style anyway. ok jsing
* Garbage collect two commented abort()tb2023-08-171-3/+1
|
* Make the local ASN1_OBJECTs consttb2023-08-171-2/+2
| | | | ok jsing
* Remove some unnecessary else branchestb2023-08-171-7/+5
|
* Remove some parents from return statementstb2023-08-171-8/+8
|
* Use cmp instead of i for the result of a comparisontb2023-08-171-5/+5
| | | | ok jsing
* Use OBJ_cmp() instead of inlining two variantstb2023-08-171-12/+4
| | | | | | | | | | This also avoids more undefined behavior with memcmp(). ok jsing PS: Unsolicited advice for no one in particular: there is this awesome tool called grep. If someone reports an issue, you might want to use it to find more instances.
* Avoid memcmp(NULL, x, 0) in OBJ_cmp()tb2023-08-171-6/+7
| | | | | | | | If a->length is 0, either a->data or b->data could be NULL and memcmp() will rely on undefined behavior to compare them as equal. So avoid this comparison in the first place. ok jsing
* add the missing entry for EVP_CIPHER_CTX_ctrl(3) to the RETURN VALUES sectionschwarze2023-08-161-2/+11
|
* Describe more precisely how these functions are supposed to be used,schwarze2023-08-161-19/+185
| | | | | | | | document the control operations supported by EVP_chacha20_poly1305(3), and add the missing STANDARDS and HISTORY sections. This replaces all text written by Matt Caswell and all text Copyrighted by OpenSSL in the year 2019.
* Zap extra parenstb2023-08-151-2/+2
|
* Fix typo in previoustb2023-08-151-2/+2
|
* Avoid undefined behavior with memcmp(NULL, x, 0) in ASN1_STRING_cmp()tb2023-08-151-4/+6
| | | | ok jsing miod
* SHA-3 is not a symmetric cipher.schwarze2023-08-151-3/+3
| | | | | | | | | Fix a copy and paste mistake that Ronald Tse introduced in 2017 even though Richard Levitte and Bernd Edlinger reviewed his commit - and that i unwittingly copied. Even in the OpenSSL 3 main trunk, it wasn't fixed until 2022, and in OpenSSL-1.1.1, it is still wrong. Unfortunately, we need to be really careful before believing anything the OpenSSL documentation says...
* Import the EVP_chacha20(3) manual page from the OpenSSL 1.1 branch,schwarze2023-08-154-14/+102
| | | | | | which is still under a free license, to work on it in the tree. The required content changes have not been done yet, i only tweaked the markup and wording so far.
* Clean up alignment handling.jsing2023-08-152-57/+67
| | | | | | | | Instead of using HOST_{c2l,l2c} macros, provide and use crypto_load_le32toh() and crypto_store_htole32(). In some cases just use htole32() directly. ok tb@
* Use MD5_LONG instead of unsigned int for consistency.jsing2023-08-151-3/+3
| | | | ok tb@
* Condition only on #ifdef MD5_ASM.jsing2023-08-151-15/+5
| | | | | | | There are a bunch of unnecessary preprocessor directives - just condition on MD5_ASM, the same as we do elsewhere. ok tb@
* Inline INIT_DATA_* defines.jsing2023-08-141-10/+7
| | | | ok tb@
* style(9)jsing2023-08-141-6/+6
|
* Below SEE ALSO, point to all pages documenting the evp.h sub-library, andschwarze2023-08-141-11/+56
| | | | | | | | also point to a selection of functions from other sub-libraries that rely on evp.h objects, in particular on EVP_CIPHER, EVP_MD, and EVP_PKEY. While here, merge a few trivial improvements to orthography and punctuation from the OpenSSL 1.1 branch.
* import EVP_sha3_224(3) from the OpenSSL 1.1 branch, which is still underschwarze2023-08-143-3/+97
| | | | a free license, tweaked by me
* fix whitespacetb2023-08-131-14/+13
|
* document return values of the control function in EVP_MD_meth_set_ctrl(3)schwarze2023-08-121-5/+15
|
* 1. Tweak the descriptions of EVP_MD_CTX_ctrl(3), EVP_MD_CTX_set_flags(3),schwarze2023-08-121-52/+107
| | | | | | | | EVP_MD_CTX_clear_flags(3), EVP_MD_CTX_test_flags(3), and the atrocious EVP_MD_CTX_set_pkey_ctx(3) for precision. 2. Tweak the description of EVP_MD_type(3) and EVP_MD_CTX_type(3) for conciseness. 3. Add a few missing HISTORY bits.
* Remove a blatant lie about DSA_dup_DHtb2023-08-121-6/+2
| | | | | q is copied across since OpenSSL 31360957 which hit our tree with OpenSSL 1.0.1c in October 2012.
* The int_ prefix also leaves the ec_ameth messtb2023-08-121-5/+5
| | | | The prefixes in here are all over the place... This removes one variety.
* RSA's _free and _size also lose their int_ prefixtb2023-08-121-7/+7
|
* Drop silly int_ prefix from _free() and _size()tb2023-08-122-10/+10
|
* Free {priv,pub}_key before assigning to ittb2023-08-122-2/+7
| | | | | | | | While it isn't the case for the default implementations, custom DH and DSA methods could conceivably populate private and public keys, which in turn would result in leaks in the pub/priv decode methods. ok jsing
* Readability tweak for key parameters in DSAtb2023-08-121-2/+2
| | | | ok jsing
* Simplify and unify missing_parameters() for DH and DSAtb2023-08-122-11/+8
| | | | ok jsing
* Convert {DH,DSA}_new_method() to using calloc()tb2023-08-122-83/+54
| | | | | | | | | | | | | | | Due to OPENSSL_NO_ENGINE the engine member of dh and dsa is currently uninitialized. As a consequence, {DH,DSA}_get0_engine() will return a garbage pointer, which is particularly bad because the only reason we kept them in the first place is that they are used by some software... A side effect of freeing with {DH,DSA}_free() instead of a hand-rolled version is that we may call ->meth->finish() before ->meth->init() was called. We need a NULL check for ->meth to be on the safe side in case we should need to bring ENGINE back. with nits from djm ok deraadt djm
* Merge various improvements from the OpenSSL 1.1 branch,schwarze2023-08-111-13/+148
| | | | | | | | | | | | | | which is still under a free license. * document EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags * document EVP_MD_flags, EVP_MD_CTX_md_data * document EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_set_pkey_ctx * correct arg type of EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type * more information about EVP_MD_CTX_ctrl * add missing <string.h> and correct one variable type below EXAMPLES * two orthographic improvements with a few wording tweaks by me
* Stop including md32_common.h.jsing2023-08-111-15/+1
| | | | | Now that we're no longer dependent on md32_common.h, stop including it. Remove various defines that only existed for md32_common.h usage.
* Demacro sha256.jsing2023-08-111-49/+114
| | | | | | | | | | | | | | Replace macros with static inline functions, as well as writing out the variable rotations instead of trying to outsmart the compiler. Also pull the message schedule update up and complete it prior to commencement of the round. Also use rotate right, rather than transposed rotate left. Overall this is more readable and more closely follows the specification. On some platforms (e.g. aarch64) there is no noteable change in performance, while on others there is a significant improvement (more than 25% on arm). ok miod@ tb@
* Improve variable names in {dh,dsa}_{pub,priv}_{de,en}code()tb2023-08-112-114/+114
| | | | | | | | Use aint for the ASN1_INTEGER holding the key and astr for the ASN1_STRING holding the parameters. This frees up key and params for their DER encoded versions, matching the naming we use elsewhere much more closely. ok jsing