openbsd
9 months agoRemove check{,obj_cleanup}_defer documentation
tb [Sat, 13 Jan 2024 19:06:20 +0000 (19:06 +0000)]
Remove check{,obj_cleanup}_defer documentation

Both check_defer() and the global variable obj_cleanup_defer were removed
from the public API two years ago. Now they were removed from the internals
as well, simplifying the cleanup process greatly. We no longer need them
to have a chance to understand the cleanup process. Also remove references
to EVP_cleanup() since this has long been deprecated and now it doesn't
clean up things anymore.

9 months agoRemove mention of a refcount bug
tb [Sat, 13 Jan 2024 18:37:51 +0000 (18:37 +0000)]
Remove mention of a refcount bug

Said bug was fixed in OpenSSL 1.0.0, released 14 years ago. It is of course
unsurprising that you may accidentally increment the refcount if your idiom
for decrementing it is CRYPTO_add(&bio-references, -1, CRYPTO_LOCK_BIO)).

9 months agoBIO_f_ssl.3: Remove explicit library initialization
tb [Sat, 13 Jan 2024 17:50:01 +0000 (17:50 +0000)]
BIO_f_ssl.3: Remove explicit library initialization

9 months agoRemove calls to OpenSSL_add_all_{ciphers,digests}()
tb [Sat, 13 Jan 2024 17:04:29 +0000 (17:04 +0000)]
Remove calls to OpenSSL_add_all_{ciphers,digests}()

9 months agoMove errno.h inclusion where it belongs
tb [Sat, 13 Jan 2024 16:32:53 +0000 (16:32 +0000)]
Move errno.h inclusion where it belongs

9 months agoClean up EVP_MD_CTX_init() usage in ASN1_item_sign()
joshua [Sat, 13 Jan 2024 13:59:18 +0000 (13:59 +0000)]
Clean up EVP_MD_CTX_init() usage in ASN1_item_sign()

ok tb@

9 months agoPrepare to remove the EVP_PKEY_meth_* API
tb [Sat, 13 Jan 2024 12:46:59 +0000 (12:46 +0000)]
Prepare to remove the EVP_PKEY_meth_* API

After removing the last caller of EVP_PKEY_meth_find() from libssl, none
of these is used. And with EVP_PKEY_meth_new() gone, there will no longer
be a way to get your hands onto an EVP_PKEY_METHOD that is writable, so
none of the silent failures (because they're void functions) should matter
in the few weeks until we bump.

ok jsing

9 months agoThe OBJ_NAME API joins the party in evp_names.c
tb [Sat, 13 Jan 2024 12:18:52 +0000 (12:18 +0000)]
The OBJ_NAME API joins the party in evp_names.c

... and another file without license disappears.

9 months agoMove EVP_add_{cipher,digest}() to the trashcan
tb [Sat, 13 Jan 2024 12:15:27 +0000 (12:15 +0000)]
Move EVP_add_{cipher,digest}() to the trashcan

They will await their removal in the next major bump.

9 months agoOpen a garbage bin at the bottom of evp_names.c
tb [Sat, 13 Jan 2024 12:13:17 +0000 (12:13 +0000)]
Open a garbage bin at the bottom of evp_names.c

First to move is EVP_cleanup(), which should probably be moved to an
evp_lib.c if such a file is reinstated.

9 months agoRemove obj_cleanup_defer
tb [Sat, 13 Jan 2024 11:57:51 +0000 (11:57 +0000)]
Remove obj_cleanup_defer

With check_defer() gone, this is never set to anything but 0, so the two
conditional branches it is still involved in are dead code.

9 months agoGarbage collect check_defer()
tb [Sat, 13 Jan 2024 11:55:31 +0000 (11:55 +0000)]
Garbage collect check_defer()

This was a mechanism to ensure that OBJ_cleanup() doesn't remove the
ASN1_OBJECT associated with a custom cipher or digest (that was added
with EVP_add_{cipher,digest}(), while the latter is still referenced
in the OBJ_NAME table.

It had the effect that OBJ_cleanup() wasn't actually called ever from
OPENSSL_cleanup() (it is only called if you load the OID conf module).

Oh, and of course it was once part of the public API. I fixed that two
years ago, almost exactly to the day. Still mentioned in OBJ_create.3.

9 months agoNeuter EVP_add_{cipher,digest}()
tb [Sat, 13 Jan 2024 11:48:16 +0000 (11:48 +0000)]
Neuter EVP_add_{cipher,digest}()

This makes them noops. They are used in the wild for adding ciphers
that are always added by the library init code. This is a historic
leftover.

This removes the last (and only ever) calls to check_defer().

ok jsing

9 months agoRemove most of EVP_add_{cipher,digest}() internals
tb [Sat, 13 Jan 2024 11:45:03 +0000 (11:45 +0000)]
Remove most of EVP_add_{cipher,digest}() internals

OBJ_NAME_add() is a noop now, so remove all calls and simplify the
remainder of these two functions a bit.

Intermediate step to a larger diff that was ok jsing

9 months agoRemove OBJ_NAME_cleanup() calls from EVP_cleanup()
tb [Sat, 13 Jan 2024 11:41:44 +0000 (11:41 +0000)]
Remove OBJ_NAME_cleanup() calls from EVP_cleanup()

This is a noop now, so no need to call it.

9 months agoRemove the guts of the OBJ_NAME API
tb [Sat, 13 Jan 2024 11:38:45 +0000 (11:38 +0000)]
Remove the guts of the OBJ_NAME API

With one exception, none of this is used anymore. All of it will be removed
in the next major bump.

The exception is OBJ_NAME_add(). scurity/xca ran into issues with their
cert renewal logic because RSA certs had a way of mapping the signature
algorithms to a hash, but a similar mechanism wasn't available for ECDSA
certs. So xca uses EVP_add_digest_alias() to have corresponding aliases
for ECDSA. This is a macro wrapping OBJ_NAME_add().

xca now has better logic using the more appropriate OBJ_find_sigid_algs()
(which wasn't available back then). We will still add the alias entries
that xca still adds ourselves to make sure there are no unexpected side
effects. They make sense anyway.

The diff will hopefully land in a few days. If your life depends on ECDSA
cert renewal in xca please hold off on updating to a new snap.

ok jsing

9 months agoStub out {OpenSSL,OPENSSL}_add*
tb [Sat, 13 Jan 2024 11:18:52 +0000 (11:18 +0000)]
Stub out {OpenSSL,OPENSSL}_add*

These serve no purpose anymore (and really haven't for many years) but
will have to be kept since there's a number of software that still uses
them because many years ago they had to.

Relocate the stubs to crypto_init.c since library initialization's what
they were there for.

ok jsing

9 months agoReimplement EVP_get_{cipher,digest}byname()
tb [Sat, 13 Jan 2024 11:12:32 +0000 (11:12 +0000)]
Reimplement EVP_get_{cipher,digest}byname()

Instead of a hashtable lookup do a bsearch() over the static table.
This needs about the same number of strcmp and is a lot simpler.

ok jsing

9 months agoReimplement {EVP_CIPHER,EVP_MD,OBJ_NAME}_do_all{,_sorted}(3)
tb [Sat, 13 Jan 2024 11:08:39 +0000 (11:08 +0000)]
Reimplement {EVP_CIPHER,EVP_MD,OBJ_NAME}_do_all{,_sorted}(3)

This implements the do_all API by simple loops over the tables of
digests and ciphers. Since some ciphers are only available on some
platforms, we need to skip them if necessary. We use loops in each
of the functions rather the convoluted way of reducing some of the
loops to others.

Since the tables are sorted, as ensured by regress, both do_all() and
do_all_sorted() walk the lists in order. In particular, we no longer
need to allocate to be able to sort hash tables by name on the fly in a
void function that may end up doing nothing because allocation failed.
We still need to do an unchecked OPENSSL_init_crypto() call. But that's
what prayer and clean living are there for (as beck put it).

The OBJ_NAME API is completely misnamed. It has little to do with objects
and a lot to do with EVP. Therefore we implement what will remain from
its saner replacement in the evp directory, i.e., evp_names.c.

ok jsing

9 months agoAdd a table of digest names, digests and aliases
tb [Sat, 13 Jan 2024 11:00:09 +0000 (11:00 +0000)]
Add a table of digest names, digests and aliases

This is the corresponding commit for digests and their aliases. It
only adds a table to be used in upcoming commits. What was said
about ciphers applies mutatis mutandis to digests.

ok jsing

9 months agoAdd a table of cipher names, ciphers and aliases
tb [Sat, 13 Jan 2024 10:57:08 +0000 (10:57 +0000)]
Add a table of cipher names, ciphers and aliases

This arranges the data provided by dynamic library initialization
in a static table and will help avoid gross code with missing error
checking and other defects on every use of the library. This table
isn't pretty due to various naming inconsistecies accumulated over
the decades. It will significantly simplify the implementation of
API such as EVP_get_cipherbyname() and EVP_CIPHER_do_all().

All the table does is map strings to ciphers, typically used on the
openssl(1) command line or in code it's the mechanism that underlies
the map from NID_chacha20 to the data returned by EVP_chacha20().
It's of course more complicated because it just had to be stupid.

This is one of the places where the use of bsearch() is justified.
The price to pay for the simplification is that adding custom aliases
and custom ciphers to this table will no longer be supported. It is
one significant user of the LHASH madness. That's just another piece
of the awful "toolkit aspect"-guided misdesign that contributes to
making this codebase so terrible.

A corresponding table for the digests will be added in the next
commit.

ok jsing

9 months agoProvide a more complete implementation of the "component" APIs. Also tweak
kettenis [Sat, 13 Jan 2024 10:00:27 +0000 (10:00 +0000)]
Provide a more complete implementation of the "component" APIs.  Also tweak
the "platform" interfaces to stash away the bits of fdt_attach_args that
we need later on instead of referencing it directly.  This makes those
interfaces usable after attach time.

ok jsg@

9 months agoClarify some behaviour for 'vmctl start' and 'vmctl reload'
mlarkin [Fri, 12 Jan 2024 23:50:11 +0000 (23:50 +0000)]
Clarify some behaviour for 'vmctl start' and 'vmctl reload'

Clarify that vmctl start max memory is governed by the vmd(8) user's
max datasize in /etc/login.conf and that vmctl reload only reloads
state for non-running VMs.

ok dv

9 months agoadd license; ok kettenis@
jsg [Fri, 12 Jan 2024 22:29:04 +0000 (22:29 +0000)]
add license; ok kettenis@

9 months agoRemove X509_STORE_CTX_purpose_inherit(3) documentation
tb [Fri, 12 Jan 2024 19:28:02 +0000 (19:28 +0000)]
Remove X509_STORE_CTX_purpose_inherit(3) documentation

This abomination of an API will be removed. Remove the hairy details of
its internals and make the documentation of X509_STORE_CTX_set_trust(3)
and X509_STORE_CTX_set_purpose(3) independent of it.

Neither of these two remaining APIs can be recommended. Once set, trust
and purpose are sticky. Setting the trust to a different (valid) value
will indicate success but leave the value unchanged. I suppose it means
the new trust value was successfully ignored. Also, setting the trust to
X509_TRUST_DEFAULT can succeed or fail depending on which OpenSSL
derivative you use. Setting the purpose will also set the trust (unless
it is already set). Setting some purposes may or may not fail depending
on the OpenSSL lib.

The only way you have a chance of knowing what will be set is by calling
only one of these functions directly after X509_STORE_CTX_init(). This
isn't really safe either because in some versions the user can override
the values stored in a global table by writing directly to it.

The actual contributions here are rather minimal. State more explicitly
that 0 is invalid (but results in success being returned), document the
error values to be accurate across implementations and call out some of
the nonsense in a CAVEATS section.

Many thanks to schwarze for the very helpful review with lots of input.

ok schwarze

9 months agoappstest: Zap a trailing tab added in previous
tb [Fri, 12 Jan 2024 13:16:48 +0000 (13:16 +0000)]
appstest: Zap a trailing tab added in previous

9 months agoAdd -force_pubkey -multivalue-rdn -set_issuer -set_subject -utf8 to x509 app
job [Fri, 12 Jan 2024 11:24:02 +0000 (11:24 +0000)]
Add -force_pubkey -multivalue-rdn -set_issuer -set_subject -utf8 to x509 app

The -set_issuer, -set_subject, and -force_pubkey features can be used to
'rechain' PKIs, for more information see https://labs.apnic.net/nro-ta/
and https://blog.apnic.net/2023/12/14/models-of-trust-for-the-rpki/

OK tb@

9 months agoConvert the simple IMSG calls in session.c to the new imsg API.
claudio [Fri, 12 Jan 2024 11:19:51 +0000 (11:19 +0000)]
Convert the simple IMSG calls in session.c to the new imsg API.
OK tb@

9 months agoSend UDP packets in parallel.
bluhm [Fri, 12 Jan 2024 10:48:03 +0000 (10:48 +0000)]
Send UDP packets in parallel.

Sending UDP packets via datagram socket is MP safe now.  Same applies
to raw IPv4 and IPv6, and divert sockets.  Switch sosend() from
exclusive net lock to shared net lock in combination with per socket
lock.  TCP and GRE still use exclusive net lock.

tested by otto@ and florian@
OK mvs@

9 months agonfssvc: When the client disconnects, close the socket before sleeping.
ratchov [Fri, 12 Jan 2024 08:47:46 +0000 (08:47 +0000)]
nfssvc: When the client disconnects, close the socket before sleeping.

If the server doesn't close the socket immediately and starts waiting
for the client to reconnect, then the TCP connection will remain open.
The client will have to wait for the connection to be closed in order
to reconnect with the same source port; this never happens, resulting
in a freeze until the file system is umounted.

This change fixes Linux NFS clients freezing after 5 min of inactivity.

ok miod, help from claudio

9 months agoSince no system call takes more than 6 arguments, and no more than one
miod [Thu, 11 Jan 2024 19:16:26 +0000 (19:16 +0000)]
Since no system call takes more than 6 arguments, and no more than one
off_t argument, there is no need to process more than 6 arguments on
64-bit platforms and 8 on 32-bit platforms.

Make the syscall argument gathering code simpler by removing never-used code
to fetch more arguments from the stack, and local argument arrays when pointing
to the trap frame does the job.

ok guenther@ jsing@

9 months agoifconfig.8: reorder hwfeature list
jan [Thu, 11 Jan 2024 17:22:04 +0000 (17:22 +0000)]
ifconfig.8: reorder hwfeature list

ok jmc@

9 months agofix build with VMM_DEBUG option
jan [Thu, 11 Jan 2024 17:13:48 +0000 (17:13 +0000)]
fix build with VMM_DEBUG option

ok dv@

9 months agoRemove the evp_pkey_method() test
tb [Thu, 11 Jan 2024 16:45:26 +0000 (16:45 +0000)]
Remove the evp_pkey_method() test

This is a minimal test for an API that will be removed in a subsequent
commit.

9 months agorename field ibuf to imsgbuf in struct ctl_conn
claudio [Thu, 11 Jan 2024 15:46:25 +0000 (15:46 +0000)]
rename field ibuf to imsgbuf in struct ctl_conn
OK tb@

9 months agoClear the last errors after receiving a RTR_EVNT_END_OF_DATA event.
claudio [Thu, 11 Jan 2024 15:38:05 +0000 (15:38 +0000)]
Clear the last errors after receiving a RTR_EVNT_END_OF_DATA event.

Once the cache is synced we can assume that the errors are no longer
relevant.
OK tb@

9 months agoMove the 'Last received shutdown reason:' output a bit down where it makes
claudio [Thu, 11 Jan 2024 14:34:49 +0000 (14:34 +0000)]
Move the 'Last received shutdown reason:' output a bit down where it makes
more sense.

9 months agoUse domain name for socket lock.
bluhm [Thu, 11 Jan 2024 14:15:11 +0000 (14:15 +0000)]
Use domain name for socket lock.

Syzkaller with witness complains about lock ordering of pf lock
with socket lock.  Socket lock for inet is taken before pf lock.
Pf lock is taken before socket lock for route.  This is a false
positive as route and inet socket locks are distinct.  Witness does
not know this.  Name the socket lock like the domain of the socket,
then rwlock name is used in witness lo_name subtype.  Make domain
names more consistent for locking, they were not used anyway.
Regardless of witness problem, unique lock name for each socket
type make sense.

Reported-by: syzbot+34d22dcbf20d76629c5a@syzkaller.appspotmail.com
Reported-by: syzbot+fde8d07ba74b69d0adfe@syzkaller.appspotmail.com
OK mvs@

9 months agoClear the last_sent_errcode, last_rcvd_errcode and last_reason when
claudio [Thu, 11 Jan 2024 14:11:03 +0000 (14:11 +0000)]
Clear the last_sent_errcode, last_rcvd_errcode and last_reason when
the session comes up instead of at the start of a connect.
With this the last errors reported should stick around longer.
Reported by linx.net, OK job@

9 months agoFix white spaces in TCP.
bluhm [Thu, 11 Jan 2024 13:49:49 +0000 (13:49 +0000)]
Fix white spaces in TCP.

9 months agoDisplay the exported rtr session state and fix a missing indent.
claudio [Thu, 11 Jan 2024 13:09:41 +0000 (13:09 +0000)]
Display the exported rtr session state and fix a missing indent.
OK tb@

9 months agoExport the rtr session state as string.
claudio [Thu, 11 Jan 2024 13:08:39 +0000 (13:08 +0000)]
Export the rtr session state as string.
OK tb@

9 months agoAdd basic support for R_386_GOT32X
jca [Thu, 11 Jan 2024 12:31:37 +0000 (12:31 +0000)]
Add basic support for R_386_GOT32X

Repairs ld.bfd operations on i386: since the switch to llvm-16 clang
emits such relocations (eg one is present in /usr/lib/crtbegin.o).
This unbreaks the build of ports/lang/fpc.

Help and tests from tb@, ok tb@ kettenis@

9 months agoMake the -P option work for Trust Anchor certificates as well
job [Thu, 11 Jan 2024 11:55:14 +0000 (11:55 +0000)]
Make the -P option work for Trust Anchor certificates as well

OK tb@

9 months agoTry to improve RTR version negotiation.
claudio [Thu, 11 Jan 2024 11:43:07 +0000 (11:43 +0000)]
Try to improve RTR version negotiation.

RFC8210 and especially draft-ietf-sidrops-8210bis are underspecified when
it comes to inital version negotiation. The authors seem to have a very
different view on how this works compared to the various RTR cache
implementations.

Reducing the version on any session close is a problem since it often leads
to downgraded sessions where not needed. Instead require the server to send
PDUs with their correct version (either a code 4 error, a cache response
or cache reset pdu).

Extensively tested against various modes of StayRTR.
Also tested against routinator which is currently not following the spec
(https://github.com/NLnetLabs/routinator/issues/919) and breaks on unknown
versions.

This is probably not the last change to make RTR version negotiation work
but it is a step in the right direction.

OK tb@

9 months agohandle MHI M1->M2 state transitions in qwx(4)
stsp [Thu, 11 Jan 2024 09:52:19 +0000 (09:52 +0000)]
handle MHI M1->M2 state transitions in qwx(4)

When the device signals transition to state M1, the MHI driver may
set the device into M2 state to save power. The MHI device will be
woken up again by the driver ringing the wake doorbell register
before doing PCI reads/writes, which qwx(4) already implements.

9 months agoadd XKH
deraadt [Thu, 11 Jan 2024 07:59:43 +0000 (07:59 +0000)]
add XKH

9 months agodon't disable RSA test when DSA is disabled; bug introduced in last commit
djm [Thu, 11 Jan 2024 04:50:28 +0000 (04:50 +0000)]
don't disable RSA test when DSA is disabled; bug introduced in last commit

9 months agoensure key_fd is filled when DSA is disabled; spotted by tb@
djm [Thu, 11 Jan 2024 01:51:16 +0000 (01:51 +0000)]
ensure key_fd is filled when DSA is disabled; spotted by tb@

9 months agomake DSA testing optional, defaulting to on
djm [Thu, 11 Jan 2024 01:45:58 +0000 (01:45 +0000)]
make DSA testing optional, defaulting to on

ok markus

9 months agomake DSA key support compile-time optional, defaulting to on
djm [Thu, 11 Jan 2024 01:45:36 +0000 (01:45 +0000)]
make DSA key support compile-time optional, defaulting to on

ok markus@

9 months agoX509_TRUST: tidy up includes
tb [Wed, 10 Jan 2024 21:34:53 +0000 (21:34 +0000)]
X509_TRUST: tidy up includes

9 months agoX509_TRUST: group together all trust_*() functions
tb [Wed, 10 Jan 2024 21:19:56 +0000 (21:19 +0000)]
X509_TRUST: group together all trust_*() functions

Now they are next to the trstandard[] table and listed in the order they
appear in the table.

9 months agoX509_TRUST: hoist trust_compat() to the other end of the file
tb [Wed, 10 Jan 2024 21:14:14 +0000 (21:14 +0000)]
X509_TRUST: hoist trust_compat() to the other end of the file

9 months agoX509_TRUST: start shuffling some code around
tb [Wed, 10 Jan 2024 21:11:37 +0000 (21:11 +0000)]
X509_TRUST: start shuffling some code around

Hoist obj_trust() to the top and move the static default_trust() next
to its setter.

9 months agoRework X509_STORE_CTX_set_{purpose,trust}()
tb [Wed, 10 Jan 2024 17:31:28 +0000 (17:31 +0000)]
Rework X509_STORE_CTX_set_{purpose,trust}()

Split the two codepaths in x509_vfy_purpose_inherit() into its two callers.
What remains is gross, but at least a reader has a chance of following all
this nonsense without leaving a significant amount of hair behind.

In short, purpose and trust are only overridden if they're not already
set.  Otherwise silently ignore valid purpose and trust identifiers that
were passed in and succeed. Error on almost all invalid trust or purpose
ids, except 0, because... well... who knows, really?

ok jsing

9 months agoSplit UDP PCB table into IPv4 and IPv6.
bluhm [Wed, 10 Jan 2024 16:44:30 +0000 (16:44 +0000)]
Split UDP PCB table into IPv4 and IPv6.

Having two hash tables instead of a common one, reduces table size
and contention on the per table lock.  The address family is always
known in advance.  The lookups and loops are more specific.

OK sashan@

9 months agoImprove rtr_send_error() so that there is no need to log_warnx() before.
claudio [Wed, 10 Jan 2024 16:08:36 +0000 (16:08 +0000)]
Improve rtr_send_error() so that there is no need to log_warnx() before.

Now rtr_send_error() supports a format string for the error message so
use this fact to make the error report better.

OK tb@

9 months agoAdd missing newlines in printf.
claudio [Wed, 10 Jan 2024 14:59:41 +0000 (14:59 +0000)]
Add missing newlines in printf.

9 months agoInline rsa_is_pss() and rsa_pkey_is_pss()
tb [Wed, 10 Jan 2024 14:59:19 +0000 (14:59 +0000)]
Inline rsa_is_pss() and rsa_pkey_is_pss()

It's more explicit and not that much longer.

ok jsing

9 months agoDrop an unnecessary cast
tb [Wed, 10 Jan 2024 14:23:37 +0000 (14:23 +0000)]
Drop an unnecessary cast

from jsing

9 months agoFix print_fp()
tb [Wed, 10 Jan 2024 14:22:53 +0000 (14:22 +0000)]
Fix print_fp()

The callback-based printing needs to die. But first BIO_set() will die.
We have a FILE *. We have fprintf(). No need to use a static BIO to dump
error codes to said stream.

This basically undoes an unrelated change of "Move crpytlib.h prior bio.h"
from 19 years ago (OpenSSL 25a66ee3). Except we don't cast and check len.

ok jsing (who had a nearly identical diff)

9 months agoImplement log_roa() and log_aspa() and use these functions in printconf.c
claudio [Wed, 10 Jan 2024 13:31:09 +0000 (13:31 +0000)]
Implement log_roa() and log_aspa() and use these functions in printconf.c
OK tb@

9 months agoUpdate the control.c code to use the new imsg API.
claudio [Wed, 10 Jan 2024 11:08:04 +0000 (11:08 +0000)]
Update the control.c code to use the new imsg API.

OK tb@

9 months agofix incorrect capitalisation;
jmc [Wed, 10 Jan 2024 06:33:13 +0000 (06:33 +0000)]
fix incorrect capitalisation;

9 months agoIf bringing up a queue fails, only tear down the ones that we set up
jmatthew [Wed, 10 Jan 2024 05:06:00 +0000 (05:06 +0000)]
If bringing up a queue fails, only tear down the ones that we set up
successfully, rather than trying to tear them all down and crashing.

tested by hrvoje, who can make queue setup fail sometimes
ok bluhm@

9 months agopthread_cond_timedwait(3): accept negative absolute timeouts
cheloha [Wed, 10 Jan 2024 04:28:43 +0000 (04:28 +0000)]
pthread_cond_timedwait(3): accept negative absolute timeouts

Negative absolute timeouts are valid inputs.

With input from kettenis@.

Thread: https://marc.info/?l=openbsd-tech&m=170467558006767&w=2

ok guenther@

9 months agovmm/vmd: add io instruction length to exit information.
dv [Wed, 10 Jan 2024 04:13:59 +0000 (04:13 +0000)]
vmm/vmd: add io instruction length to exit information.

Add the instruction length to the vm exit information to allower
vmd(8) to manipulate the instruction pointer after io emulation.
This is preparation for emulating string-based io instructions.

Removes the instruction pointer update from the kernel (vmm(4)) as
well as the instruction length checks, which were overly restrictive
anyways based on the way prefixes work in x86 instructions.

ok mlarkin@

9 months agoextend ChannelTimeout regression test to exercise multiplexed connections
djm [Tue, 9 Jan 2024 22:19:36 +0000 (22:19 +0000)]
extend ChannelTimeout regression test to exercise multiplexed connections
and the new "global" timeout type. ok dtucker@

9 months agoadd a "global" ChannelTimeout type to ssh(1) and sshd(8) that watches
djm [Tue, 9 Jan 2024 22:19:00 +0000 (22:19 +0000)]
add a "global" ChannelTimeout type to ssh(1) and sshd(8) that watches
all open channels and will close all open channels if there is no
traffic on any of them for the specified interval. This is in addition
to the existing per-channel timeouts added a few releases ago.

This supports use-cases like having a session + x11 forwarding channel
open where one may be idle for an extended period but the other is
actively used. The global timeout would allow closing both channels when
both have been idle for too long.

ok dtucker@

9 months agoadapt ssh_api.c code for kex-strict
djm [Tue, 9 Jan 2024 21:39:14 +0000 (21:39 +0000)]
adapt ssh_api.c code for kex-strict

from markus@ ok me

9 months agoConvert some struct inpcb parameter to const pointer.
bluhm [Tue, 9 Jan 2024 19:57:00 +0000 (19:57 +0000)]
Convert some struct inpcb parameter to const pointer.

OK millert@

9 months agoThe End of Data PDU changed between v0 (RFC6810) and v1 (RFC8210).
claudio [Tue, 9 Jan 2024 15:13:49 +0000 (15:13 +0000)]
The End of Data PDU changed between v0 (RFC6810) and v1 (RFC8210).

Add struct rtr_endofdata_v0 and rtr_parse_end_of_data_v0() to handle this
oddity. With this bgpd supports RFC6810 and RFC8210 and some form of
draft-ietf-sidrops-8210bis

OK tb@

9 months agortr_parse_notify() state check is special since we ignore the PDU when
claudio [Tue, 9 Jan 2024 14:43:41 +0000 (14:43 +0000)]
rtr_parse_notify() state check is special since we ignore the PDU when
it arrives in a strange moment. The RFC is as helpful about this as one
could expect. Still I botched the state check and later added an
rtr_send_error() call which made the previous worse.
OK tb@

9 months agoBe more consistent with RTR parse error reporting.
claudio [Tue, 9 Jan 2024 14:15:15 +0000 (14:15 +0000)]
Be more consistent with RTR parse error reporting.

Stop calling rtr_send_error() after a parse error in rtr_process_msg();
instead move the calls into the parse functions.
Use consistend and useful error text to most rtr_send_error() calls.
In parse header also check the minimal version for router key and ASPA pdus
before checking their length.

OK tb@

9 months agoConvert the parent process imsg handling over to the new imsg API.
claudio [Tue, 9 Jan 2024 13:41:32 +0000 (13:41 +0000)]
Convert the parent process imsg handling over to the new imsg API.

This simplifies the code a fair bit and removes direct unchecked memory
access to imsg.data.
OK tb@

9 months agoFix copy-paste error that broke openssl-ruby and openssl regress
tb [Tue, 9 Jan 2024 07:25:57 +0000 (07:25 +0000)]
Fix copy-paste error that broke openssl-ruby and openssl regress

Noticed by anton

9 months agoremove unused of_device_get_match_data() prototype
jsg [Tue, 9 Jan 2024 07:10:00 +0000 (07:10 +0000)]
remove unused of_device_get_match_data() prototype

9 months agoinline -> static inline ; fixes sparc64 build
jsg [Tue, 9 Jan 2024 05:49:44 +0000 (05:49 +0000)]
inline -> static inline ; fixes sparc64 build

9 months agoremove needless comment
jmatthew [Tue, 9 Jan 2024 04:32:29 +0000 (04:32 +0000)]
remove needless comment

9 months agoIf there are still mbufs on a ring when we're freeing it,
jmatthew [Tue, 9 Jan 2024 04:29:46 +0000 (04:29 +0000)]
If there are still mbufs on a ring when we're freeing it,
it'd be a good idea to free them too.

ok dlg@

9 months agoavoid unused var warning on sparc64
jsg [Tue, 9 Jan 2024 03:53:09 +0000 (03:53 +0000)]
avoid unused var warning on sparc64

9 months agoDelete support for FFS filesystems before the in-inode symlink
guenther [Tue, 9 Jan 2024 03:15:59 +0000 (03:15 +0000)]
Delete support for FFS filesystems before the in-inode symlink
optimization.  As observed by ali_farzanrad(at)riseup.net, support
for these was broken in the 5.5 release in early 2014 by the time_t
changes.  No one noticed before now, so clearly this isn't something
we need to continue to support; rejecting in ffs_validate() is an
improvement.

Also: simplify DIRSIZ(), drop OLDDIRFMT and NEWDIRFMT, tests of
fs_maxsymlinklen against zero, #ifdef tests of FS_44INODEFMT, and
remove support for newfs -O0, last used in 2016.

ok miod@

9 months agoImplement RootPathString support in the LoadTable() AML function. Fixes
kettenis [Mon, 8 Jan 2024 19:52:29 +0000 (19:52 +0000)]
Implement RootPathString support in the LoadTable() AML function.  Fixes
booting OpenBSD on some (ancient?) Hyper-V version.

Tested by Henryk Paluch
ok mlarkin@

9 months agoOnly use DIR_VALID in noop mode
tb [Mon, 8 Jan 2024 19:46:19 +0000 (19:46 +0000)]
Only use DIR_VALID in noop mode

Looking in DIR_TEMP will not find a file, resulting in lots of ugly
printf (null). This is another bandaid until I figure out how to fix
my fix for this function...

with/ok job

9 months agoRework rtr_parse_header() and introduce rtr_check_session_id() to make
claudio [Mon, 8 Jan 2024 16:39:17 +0000 (16:39 +0000)]
Rework rtr_parse_header() and introduce rtr_check_session_id() to make
the initial header parsing simpler.
This also allows to simplify the version negotiation dance a bit. More
is needed there.
OK tb@

9 months agoSimplify the IMSG_CTL_KROUTE after the change in bgpd.
claudio [Mon, 8 Jan 2024 15:09:14 +0000 (15:09 +0000)]
Simplify the IMSG_CTL_KROUTE after the change in bgpd.
OK tb@

9 months agoDefine and use struct ctl_kroute_req to encode the arguments of
claudio [Mon, 8 Jan 2024 15:08:34 +0000 (15:08 +0000)]
Define and use struct ctl_kroute_req to encode the arguments of
IMSG_CTL_KROUTE instead of doing it by hand.
OK tb@

9 months agoDisable X509_STORE_CTX_purpose_inherit()
tb [Mon, 8 Jan 2024 10:06:50 +0000 (10:06 +0000)]
Disable X509_STORE_CTX_purpose_inherit()

Nothing uses this function, except two internal callers. So split its guts
temporarily into a helper function and disable the gross general case.
The internal helper can be simplified by observing that def_purpose == 0:

Overriding 0 by 0 doesn't do anything, so drop that bit. Rename ptmp into
purp, and inline X509_PURPOSE_get_by_id(), i.e., make appropriate checks and
subtract X509_PURPOSE_MIN. The fallback to X509_PURPOSE_get_by_id(0) will
always fail since X509_PURPOSE_MIN == 1. So ditch that call. In particular,
X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_ANY) fails in current because
of this. That's nonsense. So remove the purp->trust == X509_TRUST_DEFAULT
check as only change of behavior. This matches what OpenSSL do nowadays.
They now set def_purpose = purpose if purpose != 0 and def_purpose == 0,
so in all real-world uses of this function they will just fetch the same
purpose again and do not check for default trust the second time around.
Finally, X509_TRUST_get_by_id() is only used to ensure that a non-zero (or
overridden) trust is between X509_TRUST_MIN and X509_TRUST_MAX. So expand
that into its explicit form.

ok jsing

9 months agoInline X509_{TRUST,PUPROSE}_set() in their only callers
tb [Mon, 8 Jan 2024 09:51:09 +0000 (09:51 +0000)]
Inline X509_{TRUST,PUPROSE}_set() in their only callers

They are now unused and will join the exodus to the attic in the next bump.

ok jsing

9 months agoconst correct aesni_{128,256}_cbc_hmac_sha1_cipher
tb [Mon, 8 Jan 2024 09:31:09 +0000 (09:31 +0000)]
const correct aesni_{128,256}_cbc_hmac_sha1_cipher

9 months agoFix regress build since the reacharounds are fragile
tb [Mon, 8 Jan 2024 08:26:38 +0000 (08:26 +0000)]
Fix regress build since the reacharounds are fragile

noted by anton

9 months agoRemove outdated note from PROTOCOL.mux
djm [Mon, 8 Jan 2024 05:11:18 +0000 (05:11 +0000)]
Remove outdated note from PROTOCOL.mux

Port forward close by control master is already implemented
by `mux_master_process_close_fwd` in `mux.c`

GHPR442 from bigb4ng

9 months agofix missing field in users-groups-by-id@openssh.com reply documentation
djm [Mon, 8 Jan 2024 05:05:15 +0000 (05:05 +0000)]
fix missing field in users-groups-by-id@openssh.com reply documentation

GHPR441 from TJ Saunders

9 months agoPass the request packet to response decorations for future use.
yasuoka [Mon, 8 Jan 2024 04:16:48 +0000 (04:16 +0000)]
Pass the request packet to response decorations for future use.
This is required for many cases and will be used future.

9 months agomake kex-strict section more explicit about its intent: banning all
djm [Mon, 8 Jan 2024 04:10:03 +0000 (04:10 +0000)]
make kex-strict section more explicit about its intent: banning all
messages not strictly required in KEX

9 months agoFix logic error (&& -> ||)
tb [Mon, 8 Jan 2024 03:32:01 +0000 (03:32 +0000)]
Fix logic error (&& -> ||)

CID 477172

9 months agoremove ext-info-* in the kex.c code, not in callers; with/ok markus@
djm [Mon, 8 Jan 2024 00:34:33 +0000 (00:34 +0000)]
remove ext-info-* in the kex.c code, not in callers; with/ok markus@

9 months agofix typo; spotted by Albert Chin
djm [Mon, 8 Jan 2024 00:30:39 +0000 (00:30 +0000)]
fix typo; spotted by Albert Chin

9 months agoIn ixl(4) attach, initialize mutex before using it.
bluhm [Sun, 7 Jan 2024 21:01:45 +0000 (21:01 +0000)]
In ixl(4) attach, initialize mutex before using it.

Function ixl_get_link_status() calls ixl_set_link_status() which
locks sc_link_state_mtx.  Move initilization of mutex before calling
ixl_get_link_status().  This makes witness happy.

Bug reported and fix tested by Hrvoje Popovski; OK miod@