openbsd
2 years agoreturn EIO, not ENXIO, when the interface underneath ifq_deq_sleep dies.
dlg [Tue, 18 Jan 2022 10:54:05 +0000 (10:54 +0000)]
return EIO, not ENXIO, when the interface underneath ifq_deq_sleep dies.

this is consistent with other drivers when they report their
underlying device being detached.

2 years agoa comment about bridges shouldnt list switch(4), but can have veb(4).
dlg [Tue, 18 Jan 2022 10:48:33 +0000 (10:48 +0000)]
a comment about bridges shouldnt list switch(4), but can have veb(4).

2 years agoAdd cdsdhc(4), a driver for the Cadence SD/SDIO/eMMC host controller.
visa [Tue, 18 Jan 2022 07:53:39 +0000 (07:53 +0000)]
Add cdsdhc(4), a driver for the Cadence SD/SDIO/eMMC host controller.

Tested on a PolarFire SoC.

2 years agoplic: Fix cpuid handling
visa [Tue, 18 Jan 2022 07:44:37 +0000 (07:44 +0000)]
plic: Fix cpuid handling

Make `cpu' signed so that the possible return value -1 from
plic_get_cpuid() gets handled correctly in the (cpu < 0) condition.
This prevents plic_attach() from updating sc_contexts[] out of bounds.

When plic_get_cpuid() returns -1, ignore the entry and continue
processing. The error is not fatal. It is normal that secondary CPUs
are not found when running a non-MULTIPROCESSOR kernel on
a multiprocessor machine.

OK kettenis@

2 years agowhen decompressing zlib compressed packets, use Z_SYNC_FLUSH instead
djm [Mon, 17 Jan 2022 22:56:04 +0000 (22:56 +0000)]
when decompressing zlib compressed packets, use Z_SYNC_FLUSH instead
of Z_PARTIAL_FLUSH as the latter is not actually specified as a valid
mode for inflate(). There should be no practical change in behaviour
as the compression side ensures a flush that should make all data
available to the receiver in all cases.

repoted by lamm AT ibm.com via bz3372; ok markus

2 years agomake most of the sftp errors more idiomatic, following the general form
djm [Mon, 17 Jan 2022 21:41:04 +0000 (21:41 +0000)]
make most of the sftp errors more idiomatic, following the general form
of "[local/remote] operation path: error message"; ok markus

2 years agowhen transferring multiple files in SFTP mode, create the destination
djm [Mon, 17 Jan 2022 21:39:51 +0000 (21:39 +0000)]
when transferring multiple files in SFTP mode, create the destination
directory if it doesn't already exist to match olde-scp(1) behaviour.
noticed by deraadt@ ok markus@

2 years agoUpdate libexpat to 2.4.3. This fixes CVE-2021-45960, CVE-2021-46143,
bluhm [Mon, 17 Jan 2022 20:50:22 +0000 (20:50 +0000)]
Update libexpat to 2.4.3.  This fixes CVE-2021-45960, CVE-2021-46143,
and CVE-2022-22822 to CVE-2022-22827.  Relevant for OpenBSD are
security fixes #531 #534 #532 #538 #539 and other changes #527 #513
#514 #502 #503.  No library bump necessary.
OK millert@

2 years agoStop supporting a GOT with only one reserved entry in static PIE
guenther [Mon, 17 Jan 2022 19:45:34 +0000 (19:45 +0000)]
Stop supporting a GOT with only one reserved entry in static PIE
and ld.so itself: support for that in dynamic objects was removed
in 2010.

Inline RELOC_GOT() into boot_md.c and clean up the result like
boot.c, snag just the three DT_MIPS_* tags needed, and delete the
error case which is verified at build time.

ok visa@

2 years agodig: fix -Wunused-but-set-variable warnings
naddy [Mon, 17 Jan 2022 18:19:51 +0000 (18:19 +0000)]
dig: fix -Wunused-but-set-variable warnings

with and ok florian@

2 years agorad: fix -Wunused-but-set-variable warning
naddy [Mon, 17 Jan 2022 18:04:35 +0000 (18:04 +0000)]
rad: fix -Wunused-but-set-variable warning

ok florian@

2 years agosfcc: Fix accidental spinning
visa [Mon, 17 Jan 2022 14:17:48 +0000 (14:17 +0000)]
sfcc: Fix accidental spinning

Adjust end condition so that sfcc_cache_wbinv_range() would not spin
when (pa + len) is not cache line aligned.

While here, fix parameter types of sfcc_cache_wbinv_range() as
suggested by kettenis@.

OK kettenis@ (earlier version), miod@

2 years agoCall uvm_pglistfree(9) instead of uvm_pmr_freepageq().
mpi [Mon, 17 Jan 2022 13:55:32 +0000 (13:55 +0000)]
Call uvm_pglistfree(9) instead of uvm_pmr_freepageq().

There is no functionnal change as the former is just a wrapper around the
latter.  However upper layer of UVM do not need to mess with the internals
of the page allocator.

This will also help when a page cache will be introduced to reduce contention
on the global mutex serializing acess to pmemrange's data.

ok kettenis@, kn@, tb@

2 years agochange irq work from interrupt context back to process context like
jsg [Mon, 17 Jan 2022 12:42:30 +0000 (12:42 +0000)]
change irq work from interrupt context back to process context like
our 5.10 drm used (via a task) by changing from timeout_set() to
timeout_set_proc()

irq work is supposed to be in interrupt context but some path used on
inteldrm with gen 9 graphics sleeps.

Reported by Agnosto Dvonik on kaby lake and jcs@ and aja@ on comet lake.
For Agnosto Dvonik this occured when running firefox or mpv, for jcs@
when playing a video in firefox, for aja@ after 5 min of running gnome.
aja@ has run gnome for many hours with this change without problem.

2 years agoDo not try to strdup NULL, from seL4 at disroot dot org in GitHub issue
nicm [Mon, 17 Jan 2022 10:40:03 +0000 (10:40 +0000)]
Do not try to strdup NULL, from seL4 at disroot dot org in GitHub issue
3038.

2 years agofilessystems -> filesystems
jsg [Mon, 17 Jan 2022 04:12:15 +0000 (04:12 +0000)]
filessystems -> filesystems

2 years agounstub dma_fence_chain_find_seqno() for non zero seqno
jsg [Mon, 17 Jan 2022 03:54:03 +0000 (03:54 +0000)]
unstub dma_fence_chain_find_seqno() for non zero seqno

2 years agoAllow more memory ranges in hibernate
mlarkin [Mon, 17 Jan 2022 02:54:28 +0000 (02:54 +0000)]
Allow more memory ranges in hibernate

The previous limit of VM_PHYSSEG_MAX ranges (16) was proving too small for
newer machines. This diff reorganizes the hibernate signature block to allow
for 22 ranges by removing the kernel version comparison and replacing it
with a SHA of several unique kernel features (the version string and several
addresses of functions not inside the same .o).

Reported by claudio@, who also helped fix some issues in the diff. Input
from deraadt@ as well.

Tested by myself and claudio on a variety of machines. Only compile tested on
i386 as I have no more S4-capable i386 hardware anymore.

ok claudio@

2 years agoNothing depends on archdep.h pulling in other #includes anymore,
guenther [Mon, 17 Jan 2022 01:35:36 +0000 (01:35 +0000)]
Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

these are the ones I tested; kettenis@ was on board with the concept

2 years agoremove "for all AArch64 platforms" from comment
jsg [Sun, 16 Jan 2022 23:05:48 +0000 (23:05 +0000)]
remove "for all AArch64 platforms" from comment
removed from other archs in 2020 before riscv64 was imported

2 years agodrm/i915: Avoid bitwise vs logical OR warning in snb_wm_latency_quirk()
jsg [Sun, 16 Jan 2022 22:43:25 +0000 (22:43 +0000)]
drm/i915: Avoid bitwise vs logical OR warning in snb_wm_latency_quirk()

From Nathan Chancellor
48d56b00c35266b00ec92aaf0db5b71ce1f27702 in linux 5.15.y/5.15.15
2e70570656adfe1c5d9a29940faa348d5f132199 in mainline linux

2 years agoRemove trailing whitespace in a few places. No code change.
mlarkin [Sun, 16 Jan 2022 22:27:46 +0000 (22:27 +0000)]
Remove trailing whitespace in a few places. No code change.

2 years agodhcpd: fix -Wunused-but-set-variable warning
naddy [Sun, 16 Jan 2022 21:20:25 +0000 (21:20 +0000)]
dhcpd: fix -Wunused-but-set-variable warning

ok krw@

2 years agolibfuse: fix -Wunused-but-set-variable warning
naddy [Sun, 16 Jan 2022 20:06:18 +0000 (20:06 +0000)]
libfuse: fix -Wunused-but-set-variable warning

ok tb@

2 years agoisakmpd: fix -Wunused-but-set-variable warnings
naddy [Sun, 16 Jan 2022 14:30:11 +0000 (14:30 +0000)]
isakmpd: fix -Wunused-but-set-variable warnings

ok guenther@

2 years agopfctl: fix -Wunused-but-set-variable warning
naddy [Sun, 16 Jan 2022 14:28:16 +0000 (14:28 +0000)]
pfctl: fix -Wunused-but-set-variable warning

ok dlg@ guenther@

2 years agomodernise pcn_start with m_defrag and the "new" ifq pattern.
dlg [Sun, 16 Jan 2022 11:34:05 +0000 (11:34 +0000)]
modernise pcn_start with m_defrag and the "new" ifq pattern.

aside from getting rid of a use of the ifq_deq_begin/commit/rollback
stuff, it simplifies the code a lot. im also sick of having the
diff in my tree.

2 years agoAvoid memory leak in error path with openssl(1) smime
inoguchi [Sun, 16 Jan 2022 07:12:28 +0000 (07:12 +0000)]
Avoid memory leak in error path with openssl(1) smime

CID 345316

ok tb@

2 years agoAvoid memory leak in error path with openssl(1) cms
inoguchi [Sun, 16 Jan 2022 07:11:49 +0000 (07:11 +0000)]
Avoid memory leak in error path with openssl(1) cms

CID 345314 345320

ok tb@

2 years agoactivate/notify waiting kq kevents from bpf_wakeup directly.
dlg [Sun, 16 Jan 2022 06:27:14 +0000 (06:27 +0000)]
activate/notify waiting kq kevents from bpf_wakeup directly.

this builds on the mpsafe kq/kevent work visa has been doing.

normally kevents are notified by calling selwakeup, but selwakeup
needs the KERNEL_LOCK. because bpf runs from all sorts of contexts
that may or may not have the kernel lock, the call to selwakeup is
deferred to the systq which already has the kernel lock. while this
avoids spinning in bpf for the kernel lock, it still adds latency
between when the buffer is ready for a program and when that program
gets notified about it. now that bpf kevents are mpsafe and bpf_wakeup
is already holding the necessary locks, we can avoid that latency.

bpf_wakeup now checks if there are waiting kevents and notifies
them immediately. if there are no other things to wake up, bpf_wakeup
avoids the task_add (and associated reference counting) to defer
the selwakeup call.

selwakeup can still try to notify waiting kevents, so this uses the
hint passed to knote() to differentiate between the notification
from bpf_wakeup and selwakeup and returns early from the latter.

ok visa@

2 years agoinitialies -> initializes
jsg [Sun, 16 Jan 2022 05:38:58 +0000 (05:38 +0000)]
initialies -> initializes
ok visa@

2 years agospelling
jsg [Sun, 16 Jan 2022 04:43:34 +0000 (04:43 +0000)]
spelling

2 years agoNothing depends on archdep.h pulling in other #includes anymore,
guenther [Sun, 16 Jan 2022 02:17:05 +0000 (02:17 +0000)]
Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

ok jca@

2 years agoNothing depends on archdep.h pulling in other #includes anymore,
guenther [Sun, 16 Jan 2022 02:16:40 +0000 (02:16 +0000)]
Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

ok kettenis@

2 years agoNothing depends on archdep.h pulling in other #includes anymore,
guenther [Sun, 16 Jan 2022 02:14:27 +0000 (02:14 +0000)]
Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

ok aoyama@

2 years agostoeplizt -> stoeplitz
jsg [Sun, 16 Jan 2022 00:15:48 +0000 (00:15 +0000)]
stoeplizt -> stoeplitz

2 years agovmd: Remove a warning about non-32KHz timebases
mlarkin [Sat, 15 Jan 2022 23:39:11 +0000 (23:39 +0000)]
vmd: Remove a warning about non-32KHz timebases

Remove a warning that has outlived its usefulness.

From Brian Conway, thanks.

2 years agospelling
jsg [Sat, 15 Jan 2022 23:38:50 +0000 (23:38 +0000)]
spelling
ok tb@

2 years agoAdd back an accidentally dropped .Pp
tb [Sat, 15 Jan 2022 18:16:02 +0000 (18:16 +0000)]
Add back an accidentally dropped .Pp

2 years agoDon't reset the controller on each transaction. Remove unecessary polling
kettenis [Sat, 15 Jan 2022 11:04:16 +0000 (11:04 +0000)]
Don't reset the controller on each transaction.  Remove unecessary polling
loop and adjust another polling loop.  This makes accessing the cs42l83
audio codec work.  Probably removing the reset is enough to fix this
but the other changes bring us in line with the Linux driver which had
some decent RE done to it recently.

ok patrick@

2 years agoUpdate for HMAC_CTX_{init,cleanup} hand HMAC_cleanup removal
tb [Sat, 15 Jan 2022 09:14:40 +0000 (09:14 +0000)]
Update for HMAC_CTX_{init,cleanup} hand HMAC_cleanup removal

2 years agoStop documenting clone digests.
tb [Sat, 15 Jan 2022 09:08:51 +0000 (09:08 +0000)]
Stop documenting clone digests.

2 years agobring back spelling fix from rev 1.138 lost in rev 1.140
jsg [Sat, 15 Jan 2022 04:10:01 +0000 (04:10 +0000)]
bring back spelling fix from rev 1.138 lost in rev 1.140
pointed out by Brad

2 years agoMinor cleanup and simplification in dsa_pub_encode()
tb [Sat, 15 Jan 2022 04:02:37 +0000 (04:02 +0000)]
Minor cleanup and simplification in dsa_pub_encode()

This function has a weird dance of allocating an ASN1_STRING in an
inner scope and assigning it to a void pointer in an outer scope for
passing it to X509_PUBKEY_set0_param() and ASN1_STRING_free() on error.
This can be simplified and streamlined.

ok inoguchi

2 years agoAdd ct.h and x509_vfy.h
inoguchi [Sat, 15 Jan 2022 02:46:12 +0000 (02:46 +0000)]
Add ct.h and x509_vfy.h

2 years agoAvoid buffer overflow in asn1_parse2
inoguchi [Fri, 14 Jan 2022 23:55:46 +0000 (23:55 +0000)]
Avoid buffer overflow in asn1_parse2

asn1_par.c r1.29 changed to access p[0] directly, and this pointer could be
overrun since ASN1_get_object advances pointer to the first content octet.
In case invalid ASN1 Boolean data, it has length but no content, I thought
this could be happen.
Adding check p with tot (diff below) will avoid this failure.

Reported by oss-fuzz 43633 and 43648(later)

ok tb@

2 years agomark failing tests for macppc
mbuhl [Fri, 14 Jan 2022 19:53:42 +0000 (19:53 +0000)]
mark failing tests for macppc
OK bluhm@

2 years agoIntroduce a validated cache which holds all the files that have
claudio [Fri, 14 Jan 2022 15:00:23 +0000 (15:00 +0000)]
Introduce a validated cache which holds all the files that have
successfully been verified by rpki-client.

With this the rsync and rrdp directories are more of a temporary storage
location. New files are downloaded there and then moved to the valid
directory at the end. In -n mode only the valid directory is looked at with
the exception of the ta directory holding the trust anchors.
A file can now be in two different locations so adjust all the code paths
that open files to check both locations.
One nice side-effect of this is that the RRDP handling in the main process
got simplified. There is no longer the need for temporary RRDP directories.
OK tb@

2 years agoWe don't have 64-bit atomics on powerpc, but we don't really need them.
kettenis [Fri, 14 Jan 2022 15:00:16 +0000 (15:00 +0000)]
We don't have 64-bit atomics on powerpc, but we don't really need them.
So don't provide atomic64_cmpxchg() on powerpc and on other architectures
make its implementation similar to atomic64_xchg().
This makes the tree build again on macppc.

suggested by & ok jsg@

2 years agoEnable openssl pkey -{,pub}check and pkeyparam -check
tb [Fri, 14 Jan 2022 10:17:30 +0000 (10:17 +0000)]
Enable openssl pkey -{,pub}check and pkeyparam -check

2 years agoUndo static linking and other workarounds that are no longer needed
tb [Fri, 14 Jan 2022 09:38:50 +0000 (09:38 +0000)]
Undo static linking and other workarounds that are no longer needed
after the bump

2 years agoConvert wycheproof.go for opaque EVP_AEAD_CTX
tb [Fri, 14 Jan 2022 09:35:18 +0000 (09:35 +0000)]
Convert wycheproof.go for opaque EVP_AEAD_CTX

2 years agoThe cttest can link dynamically now
tb [Fri, 14 Jan 2022 09:33:46 +0000 (09:33 +0000)]
The cttest can link dynamically now

2 years agoSimplify BN_mont test slightly using a new accessor.
tb [Fri, 14 Jan 2022 09:32:27 +0000 (09:32 +0000)]
Simplify BN_mont test slightly using a new accessor.

2 years agoopenssl(1) dgst: fix build after clones removal
tb [Fri, 14 Jan 2022 09:28:07 +0000 (09:28 +0000)]
openssl(1) dgst: fix build after clones removal

ok inoguchi jsing

2 years agoConvert openssl(1) speed for opaque EVP_AEAD_CTX
tb [Fri, 14 Jan 2022 09:27:30 +0000 (09:27 +0000)]
Convert openssl(1) speed for opaque EVP_AEAD_CTX

ok inoguchi jsing

2 years agoConvert openssl(1) rsa.c for opaque RSA
tb [Fri, 14 Jan 2022 09:26:41 +0000 (09:26 +0000)]
Convert openssl(1) rsa.c for opaque RSA

ok inoguchi jsing

2 years agoopenssl(1) genrsa: simplify access to rsa->e
tb [Fri, 14 Jan 2022 09:25:42 +0000 (09:25 +0000)]
openssl(1) genrsa: simplify access to rsa->e

ok inoguchi jsing

2 years agoConvert openssl(1) gendsa.c to opaque DSA
tb [Fri, 14 Jan 2022 09:25:00 +0000 (09:25 +0000)]
Convert openssl(1) gendsa.c to opaque DSA

ok inoguchi jsing

2 years agoConvert openssl(1) dsaparam to opaque dsa
tb [Fri, 14 Jan 2022 09:24:20 +0000 (09:24 +0000)]
Convert openssl(1) dsaparam to opaque dsa

ok inoguchi jsing

2 years agoConvert openssl(1) dsa.c to opaque DSA
tb [Fri, 14 Jan 2022 09:23:42 +0000 (09:23 +0000)]
Convert openssl(1) dsa.c to opaque DSA

ok inoguchi jsing

2 years agoConvert openssl(1) dhparam to opaque DH
tb [Fri, 14 Jan 2022 09:22:50 +0000 (09:22 +0000)]
Convert openssl(1) dhparam to opaque DH

ok inoguchi jsing

2 years agoConvert openssl(1) dh.c to opaque DH
tb [Fri, 14 Jan 2022 09:21:54 +0000 (09:21 +0000)]
Convert openssl(1) dh.c to opaque DH

ok inoguchi jsing

2 years agoFix acme-client build with opaque RSA
tb [Fri, 14 Jan 2022 09:20:18 +0000 (09:20 +0000)]
Fix acme-client build with opaque RSA

2 years agoisakmpd: convert modp to opaque DH
tb [Fri, 14 Jan 2022 09:19:19 +0000 (09:19 +0000)]
isakmpd: convert modp to opaque DH

2 years agosync
tb [Fri, 14 Jan 2022 09:16:52 +0000 (09:16 +0000)]
sync

2 years agobump libcrypto, libssl, libtls majors after struct visibility changes
tb [Fri, 14 Jan 2022 09:15:07 +0000 (09:15 +0000)]
bump libcrypto, libssl, libtls majors after struct visibility changes
and Symbol addition and removal in libcrypto.

2 years agoUse the correct type for ssl_callback_ctrl()
tb [Fri, 14 Jan 2022 09:12:53 +0000 (09:12 +0000)]
Use the correct type for ssl_callback_ctrl()

2 years agoConvert the new record layers to opaque EVP_AEAD_CTX
tb [Fri, 14 Jan 2022 09:12:15 +0000 (09:12 +0000)]
Convert the new record layers to opaque EVP_AEAD_CTX

ok jsing

2 years agoConvert ssl_kex.c to opaque DH
tb [Fri, 14 Jan 2022 09:11:22 +0000 (09:11 +0000)]
Convert ssl_kex.c to opaque DH

Stop reaching into DH internals and use the new API functions instead.

ok inoguchi jsing

2 years agoUse BIO_next/BIO_set_next in ssl_lib.c
tb [Fri, 14 Jan 2022 09:10:11 +0000 (09:10 +0000)]
Use BIO_next/BIO_set_next in ssl_lib.c

Trivial conversion to cope with opaque BIO.

2 years agobio_ssl.c needs to peek into bio_local.h
tb [Fri, 14 Jan 2022 09:09:30 +0000 (09:09 +0000)]
bio_ssl.c needs to peek into bio_local.h

2 years agolibkeynote: fix build with opaque RSA and DSA
tb [Fri, 14 Jan 2022 09:08:03 +0000 (09:08 +0000)]
libkeynote: fix build with opaque RSA and DSA

This is a completely mechanical conversion to use accessors instead
of reaching inside the structs by hand.

ok millert

2 years agoUpdate Symbols.list
tb [Fri, 14 Jan 2022 09:06:02 +0000 (09:06 +0000)]
Update Symbols.list

ok inoguchi

2 years agoUnconditionally comment out OPENSSL_NO_RFC3779
tb [Fri, 14 Jan 2022 09:03:53 +0000 (09:03 +0000)]
Unconditionally comment out OPENSSL_NO_RFC3779

ok inoguchi jsing

2 years agoRemove header guard around RFC 3779 declarations
tb [Fri, 14 Jan 2022 09:01:36 +0000 (09:01 +0000)]
Remove header guard around RFC 3779 declarations

ok inoguchi jsing

2 years agoExpose Certificate Transparency symbols in headers
tb [Fri, 14 Jan 2022 08:59:30 +0000 (08:59 +0000)]
Expose Certificate Transparency symbols in headers

ok inoguchi jsing

2 years agoHide OBJ_bsearch_ from public visibility,
tb [Fri, 14 Jan 2022 08:56:00 +0000 (08:56 +0000)]
Hide OBJ_bsearch_ from public visibility,

This removes OBJ_bsearch_ex_() from the exported symbols and makes
OBJ_bsearch_() semi-private. It is still used in libssl.

While here, remove some hideous unused macros

ok inoguchi jsing

2 years agoMove ASN1_BOOLEAN to internal only.
tb [Fri, 14 Jan 2022 08:53:53 +0000 (08:53 +0000)]
Move ASN1_BOOLEAN to internal only.

This moves {d2i,i2d}_ASN1_BOOLEAN() to internal only. They are unused,
but help us testing the encoding.

ok jsing

2 years agoRemove check_defer and obj_cleanup_defer from public visibility
tb [Fri, 14 Jan 2022 08:52:05 +0000 (08:52 +0000)]
Remove check_defer and obj_cleanup_defer from public visibility

ok inoguchi jsing

2 years agoRemove name_cmp from public visibility
tb [Fri, 14 Jan 2022 08:50:25 +0000 (08:50 +0000)]
Remove name_cmp from public visibility

ok inoguchi jsing

2 years agoRemove all asn1_* symbols from public visibility
tb [Fri, 14 Jan 2022 08:43:06 +0000 (08:43 +0000)]
Remove all asn1_* symbols from public visibility

ok inoguchi jsing

2 years agoImplement new-style OpenSSL BIO callbacks
tb [Fri, 14 Jan 2022 08:40:57 +0000 (08:40 +0000)]
Implement new-style OpenSSL BIO callbacks

This provides support for new-style BIO callbacks in
BIO_{read,write,gets,puts}() and a helper function to
work out whether it should call the new or the old
style callback. It also adds a few typedefs and minor
code cleanup as well as the BIO_{get,set}_callback_ex()

from jsing, ok tb

2 years agoGarbage collect last use of EVP_ecdsa()
tb [Fri, 14 Jan 2022 08:38:48 +0000 (08:38 +0000)]
Garbage collect last use of EVP_ecdsa()

ok inoguchi jsing

2 years agoRemove legacy sign/verify from EVP_MD.
tb [Fri, 14 Jan 2022 08:38:05 +0000 (08:38 +0000)]
Remove legacy sign/verify from EVP_MD.

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

2 years agoMake RSA, RSA_PSS_PARAMS and RSA_METHOD opaque
tb [Fri, 14 Jan 2022 08:34:39 +0000 (08:34 +0000)]
Make RSA, RSA_PSS_PARAMS and RSA_METHOD opaque

Move the struct internals to rsa_locl.h and provide a missing
typedef in ossl_typ.h.

ok inoguchi jsing

2 years agoMake structs in ocsp.h opaque
tb [Fri, 14 Jan 2022 08:32:26 +0000 (08:32 +0000)]
Make structs in ocsp.h opaque

This adds a little order to this pig sty.

ok inoguchi jsing

2 years agoMove ECDSA_SIG to ecs_locl.h
tb [Fri, 14 Jan 2022 08:31:03 +0000 (08:31 +0000)]
Move ECDSA_SIG to ecs_locl.h

We can't make ECDSA_METHOD opaque since it is still used in smtpd(8)

ok inoguchi jsing

2 years agoSimplify DSAPublicKey_it
tb [Fri, 14 Jan 2022 08:29:06 +0000 (08:29 +0000)]
Simplify DSAPublicKey_it

This was obtained by porting the OpenSSL commit below and then using
expand_crypto_asn1.go to unroll the new ASN.1 macros - actually the
ones from 987157f6f63 which fixed the omission of dsa_cb() in the
first commit.

ok inoguchi jsing

commit ea6b07b54c1f8fc2275a121cdda071e2df7bd6c1
Author: Dr. Stephen Henson <steve@openssl.org>
Date:   Thu Mar 26 14:35:49 2015 +0000

    Simplify DSA public key handling.

    DSA public keys could exist in two forms: a single Integer type or a
    SEQUENCE containing the parameters and public key with a field called
    "write_params" deciding which form to use. These forms are non standard
    and were only used by functions containing "DSAPublicKey" in the name.

    Simplify code to only use the parameter form and encode the public key
    component directly in the DSA public key method.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2 years agoMake DSA opaque
tb [Fri, 14 Jan 2022 08:27:23 +0000 (08:27 +0000)]
Make DSA opaque

This moves DSA_SIG, DSA and DSA_METHOD to dsa_locl.h.

ok inoguchi jsing

2 years agoMake structs in dh.h opaque
tb [Fri, 14 Jan 2022 08:25:44 +0000 (08:25 +0000)]
Make structs in dh.h opaque

This moves the struct internals for DH and DH_METHOD to dh_local.h.

ok inoguchi jsing

2 years agoGarbage collect the unused OPENSSL_ITEM
tb [Fri, 14 Jan 2022 08:23:25 +0000 (08:23 +0000)]
Garbage collect the unused OPENSSL_ITEM

ok inoguchi jsing

2 years agoMake structs in comp.h opaque
tb [Fri, 14 Jan 2022 08:21:12 +0000 (08:21 +0000)]
Make structs in comp.h opaque

This moves COMP_CTX and COMP_METHOD to comp_local.h and provides
missing typedefs in ossl_typ.h.

ok inoguchi jsing

2 years agoMake structs in bio.h opaque
tb [Fri, 14 Jan 2022 08:18:55 +0000 (08:18 +0000)]
Make structs in bio.h opaque

Move BIO, BIO_METHOD and BIO_F_BUFFER_CTX to bio_local.h and provide
BIO typedef in ossl_typ.h.

ok inoguchi jsing

2 years agoGarbage collect the app_items field of ASN1_ADB
tb [Fri, 14 Jan 2022 08:16:13 +0000 (08:16 +0000)]
Garbage collect the app_items field of ASN1_ADB

This is unused and was removed in OpenSSL 5b70372d when it was
replaced with an ASN.1 ADB callback (which we don't support).

ok inoguchi jsing

2 years agoRemove NO_ASN1_FIELD_NAMES
tb [Fri, 14 Jan 2022 08:14:48 +0000 (08:14 +0000)]
Remove NO_ASN1_FIELD_NAMES

This follows OpenSSL commit 26f2412d.

ok inoguchi jsing

2 years agoRemove obsolete key formats
tb [Fri, 14 Jan 2022 08:12:31 +0000 (08:12 +0000)]
Remove obsolete key formats

This removes NETSCAPE_X509, NETSCAPE{,_ENCRYPTED}_PKEY, RSA_NET,
Netscape_RSA things. Some of the nasty tentacles that could go in
principle are used in some test suites, so we need to keep them...

All this was removed as part of OpenSSL commit 0bc2f365.

ok inoguchi jsing

2 years agoRemove ASN1_OBJECT internals from public visibility.
tb [Fri, 14 Jan 2022 08:09:18 +0000 (08:09 +0000)]
Remove ASN1_OBJECT internals from public visibility.

Move the struct declaration to asn1_locl.h and add a forward
declaration to ossl_typ.h. This makes struct visibility in the
asn1 headers match OpenSSL.

ok inoguchi jsing

2 years agoRemove HMAC_CTX_{init,cleanup}() and HMAC_init from public visibility
tb [Fri, 14 Jan 2022 08:06:03 +0000 (08:06 +0000)]
Remove HMAC_CTX_{init,cleanup}() and HMAC_init from public visibility

In OpenSSL commit 32fd54a9a3 HMAC_CTX_cleanup() was integrated into
HMAC_CTX_init(), then HMAC_CTX_init() was renamed to HMAC_CTX_reset()
in dc0099e1.

LibreSSL retained them for API compatibility with OpenSSL 1.0.
Not many things use them anymore. In fact, some projects that didn't
want to modify their code for OpenSSL 1.1 API compatibility used the
removed functions to wrap the OpenSSL 1.1 API. We had to patch some
of these and this will now no longer be necessary.

Also remove HMAC_cleanup(). Nothing uses this.

ok inoguchi jsing

2 years agoMake structs in evp.h and hmac.h opaque
tb [Fri, 14 Jan 2022 08:04:14 +0000 (08:04 +0000)]
Make structs in evp.h and hmac.h opaque

This moves most structs to evp_locl.h and moves HMAC_CTX to hmac_local.h.

ok inoguchi jsing