summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/arch/arm (unfollow)
Commit message (Collapse)AuthorFilesLines
4 daysRework PKCS7_add1_attrib_digest()tb1-12/+18
There's nothing really wrong here (at least when compared to the rest of this file an hour or so ago), but we can make this look somewhat more like code. That there's no bug here is not really related to the fact that it's an add1 function, not an add0 one. In fact, it's kind of surprising that the author had an uncharacteristic moment of lucidity and remembered to free the last argument passed to PKCS7_add_signed_attribute() on failure. ok kenjiro
4 daysRewrite PKCS7_get_smimecap() to use d2i_X509_ALGORS()tb1-6/+9
Since we finally found a use for i2d_X509_ALGORS(), make use of its sibling here. This avoids some ridiculous contortions in not quite peak muppet code (obviously this was a first test run for the grand finale in CMS). ok kenjiro
4 daysPlug leaks due to misuse of PKCS7_add_signed_attribute()tb2-26/+52
set0/add0 functions that can fail are the worst. Without fail this trips up both users and authors (by and large these are two identical groups consisting of a single person), resulting in leaks and double frees. In today's episode of spelunking in the gruesome gore provided by the PKCS#7 and Time-Stamp protocol "implementations", we fix a couple of leaks in PKCS7_add_attrib_smimecap() and ESS_add_signing_cert(). We do so by recalling that there is i2d_X509_ALGORS(), so we might as well put it to use instead of inlining it poorly (aka, without error checking). Normalize said error checking and ensure ownership is handled correctly in the usual single-exit idiom. ESS_add_signing_cert() can also make use of proper i2d handling, so it's simpler and correct and in the end looks pretty much the same as PKCS7_add_attrib_smimecap(). ok kenjiro
6 dayscurve25519.c: zap trailing whitespace introduced in previoustb1-2/+2
7 daysPKCS7_add0_attrib_signing_time: tweak commenttb1-2/+2
7 daysBelow STANDARDS, reference the two most relevant sections of RFC 5652.schwarze1-1/+5
Given that RFC 5652 does not override the earlier (and simpler) standards but instead strives to remain compatible, referencing both the original and the latest versions seems helpful. OK tb@
7 daysopenssl certhash: add digest param to certhash_directoryjoshua1-13/+9
This will allow us to call certhash_directory with other digests as required to implement the openssl rehash command, which uses SHA1 or MD5. ok jsing tb
7 daysRemove DES_UNROLL from opensslconf.h.jsing13-156/+0
This is no longer used in the DES code. ok tb@
7 daysRework DES encryption/decryption loops.jsing2-124/+31
Use a slightly unrolled loop, which gets us half way between DES_UNROLL and no DES_UNROLL. While we're not terribly concerned by DES performance, this gets us a small gain on aarch64 and a small loss on arm. But above all, we end up with simpler code. ok tb@
8 daysInline cms_add1_signingTime() in its only consumertb1-31/+9
Why have seven lines if you can have 30... tweak/ok kenjiro
8 daysUpdate PKCS7_add0_attrib_signing_time() docstb1-3/+3
Document the change of behavor from pk7_attr.c r1.17: the time is now validated to be in correct RFC 5280 time format. ok kenjiro
8 daysFix PKCS7_add0_attrib_signing_time()tb1-5/+24
If the caller passes in NULL, helpfully a new ASN1_TIME is allocated with X509_gmtime_adj() and leaked if PKCS7_add0_attrib_signing_time() fails afterward. Fix this. Also don't blindly set the signing time to a UTCTime. Validate the usual RFC 5280 format before setting it, as that's what RFC 5652, section 11.3 mandates. ok kenjiro
8 daysFix incorrect ownership handling in add_attribute()tb1-34/+42
This little gem has a number of issues. On failure, the caller can't know whether ownership of value was taken or not, so to avoid a double free, the only option is to leak value on failure. As X509_ATTRIBUTE_create() takes ownership on success, this call must be the last one that can fail. This way ownership is only taken on success. Next, if X509_ATTRIBUTE_create() fails in the case that the input stack already contains an attribute of type nid, that attr is freed and the caller freeing the stack with pop_free() will double free. So, rework this in a few ways. Make this transactional, so we don't fail with a modified *in_sk, so work with a local sk as usual. Then walk the stack and see if we have an attribute with the appropriate nid already. If not, make sure there's room to place the new attribute. Create the new attribute, free the old attribute if necessary and replace it with the new one. Finally assign the local sk to *in_sk and return success. On error unwind all we did. The behavior now matches OpenSSL 3's new behavior, except that we don't leave an empty stack around on error. ok kenjiro
9 daysRetire interop tests with OpenSSL 3.3 and 3.4tb9-141/+11
11 daysRemove BN_LLONG defines/undefs from opensslconf.h.jsing13-65/+0
These have been ineffective since r1.19 of bn.h, when BN_LLONG/BN_ULLONG defines/undefs were added based on _LP64. ok tb@
12 daysregress/libcrypto/x509/bettertls: switch to eopenssl35tb1-4/+4
12 daysregress/libcrypto/ec: switch to openssl35tb1-4/+4
12 daysec_asn1_test: fix includestb1-1/+5
12 daysectest: fix includestb1-6/+3
12 daysc2sp: unhook openssl 3.3 and 3.4tb1-2/+2
13 daysRemove unused function pointer from struct aead_aes_gcm_ctx.jsing1-2/+1
13 daysRemove remaining block128_f casts from EVP AES.jsing2-5/+8
Use aes_encrypt_block128() instead of AES_encrypt(), avoiding risky casts.
13 daysRemove crypto_cpu_caps_ia32()jsing6-30/+6
There are no more consumers of crypto_cpu_caps_ia32(), so remove it. ok bcook@ joshua@ tb@
13 daysMove AES-NI for ECB out of EVP.jsing6-87/+58
Make aes_ecb_encrypt_internal() replaceable and provide machine dependent versions for amd64 and i386, which dispatch to AES-NI if appropriate. Remove the AES-NI specific EVP methods for ECB. This removes the last of the machine dependent code from EVP AES. ok bcook@ joshua@ tb@
14 daysMove AES-NI from EVP to AES for CCM mode.jsing7-112/+145
The mode implementation for CCM has two variants - one takes the block function, while the other takes a "ccm64" function. The latter is expected to handle the lower 64 bits of the IV/counter but only for 16 byte blocks. The AES-NI implementation for CCM currently uses the second variant. Provide aes_ccm64_encrypt_internal() as a function that can be replaced on a machine dependent basis, along with an aes_ccm64_encrypt_generic() function that provides the default implementation and can be used as a fallback. Wire up the AES-NI version for amd64 and i386, change EVP's aes_ccm_cipher() to use CRYPTO_ctr128_{en,de}crypt_ccm64() with aes_ccm64_encrypt_internal()) and remove the various AES-NI specific EVP_CIPHER methods for CCM. ok tb@
2025-07-20Zero stack based IV and buffer when aes_ctr32_encrypt_generic() completes.jsing1-1/+4
ok tb@
2025-07-17Rename the file PEM_X509_INFO_read.3 to PEM_X509_INFO_read_bio.3schwarze2-5/+5
because PEM_X509_INFO_read(3) no longer exists. Requested by tb@.
2025-07-17avoid undefined behavior when shifting into sign bitkenjiro1-116/+127
Shifting a signed int64_t into the sign bit is undefined behavior in C. /dev/portable/crypto/curve25519/curve25519.c:3900:18: runtime error: left shift of negative value -222076011 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /dev/portable To avoid this, import int64_lshift21() from BoringSSL, a helper function that casts the input to uint64_t before shifting and back to int64_t afterward. This ensures defined behavior when shifting left by 21 bits, avoiding undefined behavior in expressions like `carry << 21`. This change addresses potential runtime issues detected by sanitizers when shifting signed values with high bits set. ok tb beck
2025-07-16Remove BIO_s_log() prototype, pointed out by schwarzetb1-14/+13
2025-07-16Undocument the undocumentedness of BIO_s_log. It's gone.tb1-3/+2
2025-07-16Remove bss_log.c: no longer linked to buildtb1-216/+0
2025-07-16Undocument PEM_X509_INFO_read(3), X509_PKEY_new(3) and X509_PKEY_free(3)schwarze9-144/+31
because tb@ removed them from Symbols.list rev. 1.220 today.
2025-07-16This thread-aware profiling support diff comes from Yuichiro NAITO.deraadt1-1/+5
At runtime, profiling data is stored per-thread. Upon termination, the per-thread profiling data pools are merged into a into a single record, which is then written out (using the new kernel-assisted system). I think the original gmon merging parts may have come from or been inspired by someone at NetBSD. This has been delayed because there were concerns about adding a TLS object which would require other library cranks, so this rides all the major cranks today. ok kettenis tb claudio sthen etc etc etc
2025-07-16bump major for libssl and libtls to match libcryptotb2-4/+4
2025-07-16Ride the libcrypto bump with some simple cleanup:tb8-197/+15
Remove BIO_s_log(): already unhooked in portable, completely unused. Remove X509_PKEY_new/free from public API. Remove PEM_X509_INFO_read() PEM_X509_INFO_write_bio(): all unused garbage. The simplify X509_PKEY_new/free was ok kenjiro.
2025-07-16Make the FILE object opaque. Move the __sFILE definition intoyasuoka1-1/+1
libc/hidden/_stdio.h. All programs that refer to the internal structure of the FILE object can't be compiled from now on. std{in,out,err} doesn't refer __sF[] now, but the hidden __sF along with __srget and __swbuf symbols are kept temporarily to make our transition easier. But those symbols will be deleted soon. The shared library versions are bumped for libc and all the other libraries that refer to std{in,out,err}. diff from guenther, tweak by me, tested by many ok sthen tb
2025-07-13Simplify AES-XTS implementation and remove AES-NI specific code from EVP.jsing8-132/+117
Provide aes_xts_encrypt_internal() and call that from aes_xts_cipher(). Have amd64 and i386 provide their own versions that dispatch to aesni_xts_encrypt()/aesni_xts_decrypt() as appropriate. The AESNI_CAPABLE code and methods can then be removed. ok tb@
2025-07-12add libc specific __cmtx and __rcmtx locks for internal use.dlg1-1/+55
__cmtx provides mutual exclusion using futex(2) and cas on archs that support it, or _spinlocks on the rest. __rcmtx is a recursive mutex built on top of __cmtx, so it inherits the use of futex and cas/spinlock from __cmtx. until now the options we had for locking between threads in libc were spinlocks or pthread mutexes. spinlocks use sched_yield to relax if they have to spin on a contended lock, which we are trying to minimise the use of as much as possible. pthread_mutex is relatively large in memory and offers a lot of complicated features which are unecessary for most of libc. the non cas/futex version of pthread_mutexes currently relies on __thrsleep and __thrwakeup, which we also want to deprecate. having a small futex based lock available everywhere will help us move away from overuse of spinlocks, and deprecate __thrsleep and __thrwakeup. ok kettenis@ jca@ provided his eyes too.
2025-07-12Merge the two functions from x_pkey.c into pem_info.ctb3-127/+60
It looks like those can be unexported.
2025-07-12Merge the two functions from x_info.c into pem_info.ctb3-100/+36
X509_INFO_new() isn't used directly outside of this file, so this is a bit tidier.
2025-07-12pem_info.c: more include tweakstb1-8/+3
2025-07-12pem_info.c: fix includestb1-2/+6
2025-07-11X509_sign: make variables in SYNOPSIS match the ones used in DESCRIPTIONtb1-8/+8
2025-07-10X509_verify(): sync with X509_CRL_verify()tb1-2/+6
Check X509_ALGOR_cmp() explicitly against 0 and add an explanatory comment referring to the relevant RFC 5280 sections. ok beck kenjiro
2025-07-10Add missing check to X509_CRL_verify()tb1-1/+7
When fixing CVE-2014-8275 in commit 684400ce, Henson added a check that the AlgorithmIdentifier in the certificate's signature matches the one in the tbsCertificate. A corresponding check for CRLs was missed. BoringSSL added such a check in 2022, so this should be fine for us to do as well even though OpenSSL still doesn't have it. The only caller will set an error on the stack, so we don't do it here. There's no obvious check that X509_REQ_verify() could do. ok beck kenjiro
2025-07-09libcrypto regress: add interop harness for openssl/3.5tb8-10/+75
2025-07-09libcrypto regress: move GOCACHE to obj/tb3-12/+28
While it may be acceptable for Go to fill regular users' homedirs with a compiler cache that is unable to deal with corruption and full disks, this is terrible for people running regress as root since the cache can quickly grow to hundreds of megs and can thus result in all sorts hilarity below /root. Move the GOCACHE under ${.OBJDIR} and use a cleanup target to get rid of it again. This makes these tests a bit slower for regular users as well, but so be it. Let's see how this goes before I switch libtls to the same model. discussed with claudio and jsing
2025-07-07.Lb libtls libssl libcryptoschwarze12-24/+37
OK tb@ and no objection from tedu@
2025-07-06Move aes_ecb_encrypt_internal() prototype to aes_local.h.jsing2-5/+5
2025-07-06X509_get0_signature: call out inconsistent argument order in BUGStb1-2/+9
These annoying and careless inconsistencies were introduced when const was sprinkled everywhere without rhyme or reason.