openbsd
16 months agoUse shared net lock for DIOCGETIFACES
kn [Tue, 27 Jun 2023 17:36:56 +0000 (17:36 +0000)]
Use shared net lock for DIOCGETIFACES

snmpd(8) and 'pfctl -s Interfaces' dump pf's internal list of interfaces.

pf's internal interface list is completely protected by the pf lock,
pf lock assertions since pf_if.c r1.110 from over a week ago support this.

pfi_*() iterate over net lock protected if_groups lists, but only to read,
so downgrade from exclusive write net lock to a shared read-only one.

Feedback mvs
OK sashan

16 months agoRemove net lock from DIOC{SET,CLR}IFFLAG
kn [Tue, 27 Jun 2023 17:29:38 +0000 (17:29 +0000)]
Remove net lock from DIOC{SET,CLR}IFFLAG

pf.conf's 'set skip on ifN' and 'pfctl -F all|Reset' set and clear flags,
PFI_IFLAG_SKIP being the only flag.  Nothing else in base uses these ioctls
and internal state is protected by the pf lock already.

OK sashan

16 months agoAttach 0x51f1 devices to iwx(4) and fix params used for 0x7a70 devices.
stsp [Tue, 27 Jun 2023 15:31:27 +0000 (15:31 +0000)]
Attach 0x51f1 devices to iwx(4) and fix params used for 0x7a70 devices.

from reyk@

16 months agoregen
stsp [Tue, 27 Jun 2023 15:30:55 +0000 (15:30 +0000)]
regen

16 months agoadd 0x51f1 iwx(4) PCI device ID; from reyk@
stsp [Tue, 27 Jun 2023 15:30:25 +0000 (15:30 +0000)]
add 0x51f1 iwx(4) PCI device ID; from reyk@

16 months agoMake it possible to store the kstack or ustack in a map (as value, not key).
claudio [Tue, 27 Jun 2023 14:17:00 +0000 (14:17 +0000)]
Make it possible to store the kstack or ustack in a map (as value, not key).
Additionally fix the bacmp() function to work on integers and strings.
bacmp() is used when maps are printed out since the output is sorted by value.
Also adjust the rule parser to look into correctly into if branches to figure
out which values to request from the kernel.
OK kn@

16 months agoDocument the map specific functions (count, max, min, sum) in their own
claudio [Tue, 27 Jun 2023 14:13:33 +0000 (14:13 +0000)]
Document the map specific functions (count, max, min, sum) in their own
part of the bt.5 man page.
Input and OK kn@

16 months agoremove allupdates marker, it was only used by the short-lived
espie [Tue, 27 Jun 2023 11:11:46 +0000 (11:11 +0000)]
remove allupdates marker, it was only used by the short-lived
"@option explicit-update" flavor of firmware circa 2013.

pkg_add hasn't needed to know about this since basically forever

16 months agoSwitch from get_rfc*() to BN_get_rfc*()
tb [Tue, 27 Jun 2023 11:03:41 +0000 (11:03 +0000)]
Switch from get_rfc*() to BN_get_rfc*()

The existence of the public get_rfc*() API is a historic curiosity that may
soon be corrected. We inherited its use and it survived in libssl until now.
Switch to the better named BN_get_rfc*() wrappers.

ok jsing

16 months agoamd64: MCOUNT_EXIT: restore interrupts, don't unconditionally reenable them
cheloha [Tue, 27 Jun 2023 10:11:15 +0000 (10:11 +0000)]
amd64: MCOUNT_EXIT: restore interrupts, don't unconditionally reenable them

This bug can cause all sorts of problems, but in particular it was
most easily reproduced as a double fault in the syscall return path on
this CPU model:

Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz

Tons of help from guenther@ in narrowing down the root cause.  Fix
tweaked by guenther@.  Additional input from deraadt@ and kettenis@.

ok guenther@

16 months agoReturn error if the USB request to get the sample rate fails.
ratchov [Tue, 27 Jun 2023 09:28:08 +0000 (09:28 +0000)]
Return error if the USB request to get the sample rate fails.

found by mlarkin

16 months agoRemove some dead code from ECPKParameters_print()
tb [Tue, 27 Jun 2023 07:32:29 +0000 (07:32 +0000)]
Remove some dead code from ECPKParameters_print()

This code is unreachable since binary curve support was removed.
There is a lot more to clean up in here...

ok jsing

16 months agoRemove the now unused poly[] from EC_GROUP
tb [Tue, 27 Jun 2023 07:31:18 +0000 (07:31 +0000)]
Remove the now unused poly[] from EC_GROUP

This was needed for defining the multiplication over binary fields. Since
that code is gone, this is no longer needed.

ok jsing

16 months agoSimplify EC_GROUP_get_basis_type()
tb [Tue, 27 Jun 2023 07:28:57 +0000 (07:28 +0000)]
Simplify EC_GROUP_get_basis_type()

The remaining EC_METHODs in libcrypto all have a field type of
NID_X9_62_prime_field, so this function always returns 0. Make
that more obvious.

ok jsing

16 months agoOn amd64, test whether PKU has been enabled and set our expectation
guenther [Mon, 26 Jun 2023 19:03:03 +0000 (19:03 +0000)]
On amd64, test whether PKU has been enabled and set our expectation
of the results based on that.  Also, the system now enforces
unreadability in copyin() of ld.so, libc, and application text,
even when PKU isn't enabled, so adjust those results to match.

ok deraadt@ anton@

16 months agoUpdate regress files to aspa-profile-15 format
job [Mon, 26 Jun 2023 18:55:52 +0000 (18:55 +0000)]
Update regress files to aspa-profile-15 format

16 months agoDecode and validate ASPA objects following the v1 syntax
job [Mon, 26 Jun 2023 18:39:53 +0000 (18:39 +0000)]
Decode and validate ASPA objects following the v1 syntax

Through draft-ietf-sidrops-aspa-profile-15, the ASPA profile was
made AFI-agnostic. This represents a simplification for both operators
and implementers in both the RPKI and BGP layers of the stack.

This update changes the JSON structure.

No effort was made to simultaneously support ASPA v0 and v1 objects.

OK tb@ claudio@

16 months agopax: truncate times to MAX_TIME_T, not INT_MAX
millert [Mon, 26 Jun 2023 18:00:59 +0000 (18:00 +0000)]
pax: truncate times to MAX_TIME_T, not INT_MAX
If the mtime in the file header is larger than MAX_TIME_T, trucate
it to MAX_TIME_T, not INT_MAX.  OK otto@

16 months agopax: use safe_print() to display messages which may include file names.
millert [Mon, 26 Jun 2023 16:58:50 +0000 (16:58 +0000)]
pax: use safe_print() to display messages which may include file names.
Reported by David Leadbeater.  OK op@

16 months agotimeout_hardclock_update: provide initial value for automatic variables
cheloha [Mon, 26 Jun 2023 16:26:20 +0000 (16:26 +0000)]
timeout_hardclock_update: provide initial value for automatic variables

16 months agoFix Ed Schouten's name
tb [Mon, 26 Jun 2023 15:28:52 +0000 (15:28 +0000)]
Fix Ed Schouten's name

from weerd

16 months agoStart using the new ibuf API in eigrpd. One ibuf_seek() still left since
claudio [Mon, 26 Jun 2023 14:07:19 +0000 (14:07 +0000)]
Start using the new ibuf API in eigrpd. One ibuf_seek() still left since
the change is not trivial and I don't have a eigrp testbed.
OK tb@

16 months agoImprove the conn_err() bufferevent error callback. To better report errors.
claudio [Mon, 26 Jun 2023 10:28:12 +0000 (10:28 +0000)]
Improve the conn_err() bufferevent error callback. To better report errors.
OK kn@

16 months agoUpdate and refactor dvrmpd to use the new ibu API.
claudio [Mon, 26 Jun 2023 10:08:56 +0000 (10:08 +0000)]
Update and refactor dvrmpd to use the new ibu API.

Do the checksum calculation in send_packet() instead of doing it all over
the place. This way the fixup only happens in one place.
OK tb@

16 months agoAdjust EVP_PKEY_CTRL_HKDF_KEY to OpenSSL's semantics
tb [Mon, 26 Jun 2023 08:57:17 +0000 (08:57 +0000)]
Adjust EVP_PKEY_CTRL_HKDF_KEY to OpenSSL's semantics

For some reason there is no NULL check on setting the HKDF key for p2 like
in the other cases in the switch, instead OpenSSL fail in memdup, nulling
out the key but leaving he key_len at the old value. This looks accidental
but our behavior makes some haproxy regress tests segfault. So mimic weird
OpenSSL semantics but in addition set the key_len to 0.

Reported by Ilya Shipitsin

ok jsing

16 months agoWhen exiting alternate screen, there is no need to reflow when going
nicm [Mon, 26 Jun 2023 08:14:19 +0000 (08:14 +0000)]
When exiting alternate screen, there is no need to reflow when going
back to old size since the contents will be overwritten. GitHub issue
3510.

16 months agoRevert unrelated change that sneaked into the pf_ioctl.c commit.
claudio [Mon, 26 Jun 2023 07:52:18 +0000 (07:52 +0000)]
Revert unrelated change that sneaked into the pf_ioctl.c commit.

16 months agoClose all pf transactions before opening a new one in DIOCGETRULES.
claudio [Mon, 26 Jun 2023 07:49:48 +0000 (07:49 +0000)]
Close all pf transactions before opening a new one in DIOCGETRULES.

Processes like snmpd or systat open pf(4) once and then issue many
DIOCGETRULES calls over their runtime. This accumulates many pf_trans
structs over their lifetime. At some point the kernel runs out of
memory because of that. By closing all transactions before creating
a new one, long living processes do no longer leak transactions.

This probably needs further refinement once more transactions types are
added but for now this solves the problem.

Problem found by florian@
OK sashan@ kn@

16 months agoAdd "us" to styles for underscore colour, GitHub issue 3589.
nicm [Mon, 26 Jun 2023 07:17:40 +0000 (07:17 +0000)]
Add "us" to styles for underscore colour, GitHub issue 3589.

16 months agofix grammar of the comment describing pat_chk(); ok millert@
op [Mon, 26 Jun 2023 07:10:17 +0000 (07:10 +0000)]
fix grammar of the comment describing pat_chk(); ok millert@

16 months agodocument handling of NULL envp as an extension;
jmc [Mon, 26 Jun 2023 06:58:18 +0000 (06:58 +0000)]
document handling of NULL envp as an extension;
from lucas de sena
ok espie

16 months agoProvide kstats based on the byte and packet counters available in some
jmatthew [Sun, 25 Jun 2023 22:36:09 +0000 (22:36 +0000)]
Provide kstats based on the byte and packet counters available in some
dwge(4) implementations.  The counters are all 32 bit, so enable reset-on-read
and accumulate them into 64 bit software counters, and enable the MMC
interrupts that indicate one or more counters is halfway to overflowing.
Tested on an RK3399, which has the counters, and an Allwinner A20, which
doesn't.

ok dlg@

16 months agoAdd missing RCS marker
tb [Sun, 25 Jun 2023 19:43:28 +0000 (19:43 +0000)]
Add missing RCS marker

16 months agoRemove unneeded bn_local.h and drop a NULL check
tb [Sun, 25 Jun 2023 19:35:56 +0000 (19:35 +0000)]
Remove unneeded bn_local.h and drop a NULL check

16 months agoMove ECDSA_size() to ecs_ossl.c to match what was done in ecdh
tb [Sun, 25 Jun 2023 19:33:39 +0000 (19:33 +0000)]
Move ECDSA_size() to ecs_ossl.c to match what was done in ecdh

16 months agoWith ech_local.h gone, we no longer need to -I ecdh
tb [Sun, 25 Jun 2023 19:29:30 +0000 (19:29 +0000)]
With ech_local.h gone, we no longer need to -I ecdh

16 months agoRemove ech_local.h
tb [Sun, 25 Jun 2023 19:28:47 +0000 (19:28 +0000)]
Remove ech_local.h

16 months agoStop including ech_local.h
tb [Sun, 25 Jun 2023 19:26:04 +0000 (19:26 +0000)]
Stop including ech_local.h

16 months agoRemove prototypes for EC_KEY_{get,insert}_key_method_data()
tb [Sun, 25 Jun 2023 19:22:21 +0000 (19:22 +0000)]
Remove prototypes for EC_KEY_{get,insert}_key_method_data()

These were accidentally left behind in a previous commit.

16 months agoMove ecdh_KDF_X9_63() to ec_local.h
tb [Sun, 25 Jun 2023 19:20:57 +0000 (19:20 +0000)]
Move ecdh_KDF_X9_63() to ec_local.h

In anticipation of merging ecdh/ and ecdsa/ into ec/, move the last
remaining thing in ech_local.h where it will soon belong.

16 months agoMove ECDH_size() to ech_key.c
tb [Sun, 25 Jun 2023 19:17:43 +0000 (19:17 +0000)]
Move ECDH_size() to ech_key.c

This way the public ECDH API that will remain in libcrypto is in one file
and the public ECDH API that will go is in the other one.

16 months agoMove the ecdh_method struct declaration to ech_lib.c
tb [Sun, 25 Jun 2023 19:14:14 +0000 (19:14 +0000)]
Move the ecdh_method struct declaration to ech_lib.c

No other file uses this anymore

16 months agoMove ECDH_OpenSSL() ECDSA_OpenSSL() to *_lib.c
tb [Sun, 25 Jun 2023 19:04:35 +0000 (19:04 +0000)]
Move ECDH_OpenSSL() ECDSA_OpenSSL() to *_lib.c

Now that they no longer use static methods, they can move where they
belong. Also make the static method const, as it should have been all
along.

16 months agoRemove EC_EXTRA_DATA
tb [Sun, 25 Jun 2023 18:52:27 +0000 (18:52 +0000)]
Remove EC_EXTRA_DATA

With the ecdh_check() and ecdsa_check() abominations gone, we can finally
get rid of EC_EXTRA_DATA and EC_KEY_{get,insert}_key_method_data(). The
EC_EX_DATA_*() handlers, (which fortunately have always had "'package'
level visibility") join the ride to the great bit bucket in the sky.

Thanks to op for making this possible.

ok jsing

16 months agoRemove {ecdh,ecdsa}_check() and {ECDH,ECDSA}_DATA
tb [Sun, 25 Jun 2023 18:45:56 +0000 (18:45 +0000)]
Remove {ecdh,ecdsa}_check() and {ECDH,ECDSA}_DATA

This is now unused code. Removing it will free us up to remove some
other ugliness in the ec directory.

ok jsing

16 months agoRemove method wrappers that use {ecdh,ecdsa}_check()
tb [Sun, 25 Jun 2023 18:41:36 +0000 (18:41 +0000)]
Remove method wrappers that use {ecdh,ecdsa}_check()

Now that it is no longer possible to set a custom {ECDH,ECDSA}_METHOD,
EC_KEY_METHOD can just call the relevant method directly without the
need for this extra contortion.

ok jsing

16 months agoecdsa_do_sign(): remove useless ecdsa_check() call
tb [Sun, 25 Jun 2023 18:35:28 +0000 (18:35 +0000)]
ecdsa_do_sign(): remove useless ecdsa_check() call

ok jsing

16 months agoMake ECDH and ECDSA ex_data handlers always fail
tb [Sun, 25 Jun 2023 18:27:38 +0000 (18:27 +0000)]
Make ECDH and ECDSA ex_data handlers always fail

They will be removed in the next major bump. No port uses them. They use
code that is in the way of upcoming surgery. Only libtls and smtpd used
to use the ECDSA version.

ok jsing

16 months agoMake {ECDH,ECDSA}_set_method() always fail
tb [Sun, 25 Jun 2023 18:24:33 +0000 (18:24 +0000)]
Make {ECDH,ECDSA}_set_method() always fail

They will be removed in the next major bump. No port uses them. They use
code that is in the way of upcoming surgery. Only libtls used the ECDSA
version, but thankfully op cleaned that up.

ok jsing

16 months agox509v3.h: unwrap a line
tb [Sun, 25 Jun 2023 18:15:21 +0000 (18:15 +0000)]
x509v3.h: unwrap a line

16 months agoSGR 0 should not end hyperlink, reported by Lucas Trzesniewski.
nicm [Sun, 25 Jun 2023 15:53:07 +0000 (15:53 +0000)]
SGR 0 should not end hyperlink, reported by Lucas Trzesniewski.

16 months agoAdjust/fix X509_check_purpose(3) documentation
tb [Sun, 25 Jun 2023 13:54:58 +0000 (13:54 +0000)]
Adjust/fix X509_check_purpose(3) documentation

16 months agoCheck for duplicate X.509v3 extension OIDs
tb [Sun, 25 Jun 2023 13:52:27 +0000 (13:52 +0000)]
Check for duplicate X.509v3 extension OIDs

Per RFC 5280, 4.2: A certificate MUST NOT include more than one instance
of a particular extension.

This implements such a check in x509v3_cache_extensions() by sorting the
list of extensions and looking for duplicate neighbors. This sidesteps
complications from extensions we do not know about and keeps algorithmic
complexity reasonable. If the check fails, EXFLAG_INVALID is set on the
certificate, which means that the verifier will not validate it.

ok jsing

16 months agoProvide additional BN primitives for BN_ULLONG architectures.
jsing [Sun, 25 Jun 2023 11:42:26 +0000 (11:42 +0000)]
Provide additional BN primitives for BN_ULLONG architectures.

On BN_ULLONG architectures, the C compiler can usually do a decent job
of optimising primitives, however it struggles to see through primitive
calls due to type narrowing. As such, providing explicit versions of
compound primitives can result in the production of more optimal code.
For example, on arm the bn_mulw_addw_addw() primitive can be replaced
with a single umaal instruction, which provides significant performance
gains.

Rather than intermingling #ifdef/#else throughout the header, the
BN_ULLONG defines are pulled up above the normal functions. This also
allows complex compound primitives to be reused. The conditionals have also
been changed from BN_LLONG to BN_ULLONG, since that is what really matters.

ok tb@

16 months agoech_local.h: remove unused ECDH_FLAG_FIPS_METHOD
tb [Sun, 25 Jun 2023 08:12:23 +0000 (08:12 +0000)]
ech_local.h: remove unused ECDH_FLAG_FIPS_METHOD

16 months agoremove ssl_init()
op [Sun, 25 Jun 2023 08:08:03 +0000 (08:08 +0000)]
remove ssl_init()

it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl
initialize themselves automatically before doing anything.

noticed by jsing, ok tb

16 months agoremove ssl_init()
op [Sun, 25 Jun 2023 08:07:38 +0000 (08:07 +0000)]
remove ssl_init()

it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl
initialize themselves automatically before doing anything.

ok tb

16 months agoremove ca_sslinit()
op [Sun, 25 Jun 2023 08:07:04 +0000 (08:07 +0000)]
remove ca_sslinit()

it's a noop; nowadays both LibreSSL and OpenSSL libcrypto and libssl
initialize themselves automatically before doing anything.

spotted by tb, ok tb tobhe

16 months agoec_local.h: move ec_group_simple_order_bits down a bit
tb [Sun, 25 Jun 2023 07:50:37 +0000 (07:50 +0000)]
ec_local.h: move ec_group_simple_order_bits down a bit

16 months agoCalculate inet PCB SIP hash without table mutex.
bluhm [Sat, 24 Jun 2023 20:54:46 +0000 (20:54 +0000)]
Calculate inet PCB SIP hash without table mutex.

Goal is to run UDP input in parallel.  Btrace kstack analysis shows
that SIP hash for PCB lookup is quite expensive.  When running in
parallel, there is also lock contention on the PCB table mutex.

It results in better performance to calculate the hash value before
taking the mutex.  The hash secret has to be constant as hash
calculation must not depend on values protected by the table mutex.
Do not reseed anymore when hash table gets resized.

Analysis also shows that asserting a rw_lock while holding a mutex
is a bit expensive.  Just remove the netlock assert.

OK dlg@ mvs@

16 months agoAdd initial support for StarFive VisionFive V2 to stfclock(4).
jsing [Sat, 24 Jun 2023 18:26:59 +0000 (18:26 +0000)]
Add initial support for StarFive VisionFive V2 to stfclock(4).

This adds initial support for the syscrg and pll clocks on the StarFive
VisionFive V2 JH7110 SoC.

ok kettenis@

16 months agoRemove precompute_mult/have_precompute_mult from EC_METHOD.
jsing [Sat, 24 Jun 2023 18:21:07 +0000 (18:21 +0000)]
Remove precompute_mult/have_precompute_mult from EC_METHOD.

These are no longer in use - stub EC_GROUP_precompute_mult() and
EC_GROUP_have_precompute_mult() to match their existing behaviour.

ok tb@

16 months agoMop up EC_GROUP precomp machinery.
jsing [Sat, 24 Jun 2023 17:49:44 +0000 (17:49 +0000)]
Mop up EC_GROUP precomp machinery.

Since there are now no EC implementations that perform pre-computation at
the EC_GROUP level, remove all of the precomp machinery, including the
extra_data EC_GROUP member.

The ec_wNAF_mul() code is horrific - simply cut out the precomp code,
rather than trying to rewrite it (that's a project for another day).

ok tb@

16 months agoMop up ec_wNAF_{,have_}precompute_mult().
jsing [Sat, 24 Jun 2023 17:18:15 +0000 (17:18 +0000)]
Mop up ec_wNAF_{,have_}precompute_mult().

These were previously called by GF2m code and are no longer used.
Also remove ec_pre_comp_new(), since it is only called by
ec_wNAF_precompute_mult() and is now unused.

ok tb@

16 months agoAdd conditional around bn_mul_words() call.
jsing [Sat, 24 Jun 2023 17:06:54 +0000 (17:06 +0000)]
Add conditional around bn_mul_words() call.

At least one of our bn_mul_words() assembly implementation fails to handle
n = 0 correctly... *sigh*

16 months agoAssign and test.
jsing [Sat, 24 Jun 2023 16:19:52 +0000 (16:19 +0000)]
Assign and test.

16 months agoCheck for non-zero length rather than a zero value.
jsing [Sat, 24 Jun 2023 16:10:23 +0000 (16:10 +0000)]
Check for non-zero length rather than a zero value.

This removes a data dependent timing path from BN_sqr().

ok tb@

16 months agoRewrite and simplify bn_sqr()/bn_sqr_normal().
jsing [Sat, 24 Jun 2023 16:01:43 +0000 (16:01 +0000)]
Rewrite and simplify bn_sqr()/bn_sqr_normal().

Rework bn_sqr()/bn_sqr_normal() so that it is less convoluted and more
readable. Instead of recomputing values that the caller has already
computed, pass it as an argument. Avoid branching and remove duplication
of variables. Consistently use a_len and r_len naming for lengths.

ok tb@

16 months agoProvide optimised bn_subw() and bn_subw_subw() for arm.
jsing [Sat, 24 Jun 2023 15:51:47 +0000 (15:51 +0000)]
Provide optimised bn_subw() and bn_subw_subw() for arm.

16 months agoCall notification_done() in the regress test so that the list
claudio [Sat, 24 Jun 2023 07:07:36 +0000 (07:07 +0000)]
Call notification_done() in the regress test so that the list
of deltas is adjusted to what the test expects.

16 months agoRemove a pair of parens and make one check more consistent with the others
tb [Sat, 24 Jun 2023 04:15:14 +0000 (04:15 +0000)]
Remove a pair of parens and make one check more consistent with the others

16 months agoFix warning about empty ipAddressesOrRanges
tb [Fri, 23 Jun 2023 20:05:30 +0000 (20:05 +0000)]
Fix warning about empty ipAddressesOrRanges

Committed from an older tree.

16 months agosmtpd: allow arguments on NOOP
op [Fri, 23 Jun 2023 18:32:28 +0000 (18:32 +0000)]
smtpd: allow arguments on NOOP

per RFC3521 ยง 4.1.1.9 the NOOP command allows optionally one argument
that SHOULD be ignored.  For semplicity, relax it to allow anything after it.

Original diff by Sebastian J. Bronner, GitHub PR 1150, tweaked by me to
add smtp_check_noop().

Gilles agrees, ok millert@

16 months agoUse consistent idiom for X509_get_ext_d2i()
tb [Fri, 23 Jun 2023 15:32:15 +0000 (15:32 +0000)]
Use consistent idiom for X509_get_ext_d2i()

X509_get_ext_d2i() is special. A NULL return value can be either a
success or a failure scenario: an extension may legitimately be absent.
However, to find out whether it was absent or an error ocurred, you need
to pass in &crit, a pointer to an int. Its purpose is to indicate whether
the extension was marked critical or not.

If the return value was NULL, crit becomes an error indicator:

crit == -1 means the extension was not found. This can be an error or fine
depending on the extension. Handle this accordingly. In particular for
basic constraints, if they are missing or non-critical, this is an error.

If crit == -2 then multiple extensions with the same OID as the nid
requested are present. this means the cert is non-conformant to RFC 5280.

If crit >= 0, then something weird happened. Either memory allocation
failed or the extension could not be parsed. It is not easily possible to
tell which.

In short, if crit != -1, drop the cert on the floor like a hot potato.
Add warnings where possible. For x509_any_inherits() this needs some more
work, but that will be done in a different diff another day.

ok job

16 months agoFix a bug in ex's 's' command with the 'c' flag when 'number' is off.
millert [Fri, 23 Jun 2023 15:06:45 +0000 (15:06 +0000)]
Fix a bug in ex's 's' command with the 'c' flag when 'number' is off.
The underlining was positioned in the wrong place.  This fixes
the problem and matches historic ex behavior.  OK op@

16 months agoImprove detection of RRDP session desynchronization
claudio [Fri, 23 Jun 2023 11:36:24 +0000 (11:36 +0000)]
Improve detection of RRDP session desynchronization

According to RFC 8182, a given session_id and serial number represent an
immutable record of the state of the Repository Server at a certain
point in time.

Add a check to the RRDP notification file processing to compare whether
the delta hashes associated to previously seen serials are different in
newly fetched notification files. Fall back to a snapshot if a difference
is detected, because such a mutation is a strong desynchronization
indicator.

Idea from Ties de Kock (RIPE NCC).
Based on a diff by job@
With and OK job@ tb@

16 months agoCodify BN_asc2bn(NULL, *) behavior in regress.
tb [Fri, 23 Jun 2023 10:50:47 +0000 (10:50 +0000)]
Codify BN_asc2bn(NULL, *) behavior in regress.

16 months agoAvoid crash in BN_asc2bn()
tb [Fri, 23 Jun 2023 10:48:40 +0000 (10:48 +0000)]
Avoid crash in BN_asc2bn()

Historically (and currently in OpenSSL), BN_asc2bn() could be called with
NULL, but only for positive numbers. So BN_asc2bn(NULL, "1") would succeed
but BN_asc2bn(NULL, "-1"), would crash. The other *2bn functions return a
length, so accepting a NULL makes some sense since it allows callers to
skip over part of the string just parsed (atoi-style).

For BN_asc2bn() a NULL bn makes no sense because it returns a boolean. The
recent CBS rewrite makes BN_asc2bn(NULL, *) always crash which in turn made
Coverity throw a fit.

Another change of behavior from that rewrite pertains to accidents (or is
it madness?) like -0x-11 and 0x-11 being parsed as decimal -17 (which Ingo
of course spotted and diligently documented). This will be addressed later.

ok jsing

16 months agoFix return check for BN_hex2bn()
tb [Fri, 23 Jun 2023 10:34:16 +0000 (10:34 +0000)]
Fix return check for BN_hex2bn()

Purely cosmetic change taking into account the fact that this function
returns a length rather than a boolean. This is the last offender in the
library.

ok jsing

16 months agoFix return check of bn_hex2bn_cbs()
tb [Fri, 23 Jun 2023 10:33:12 +0000 (10:33 +0000)]
Fix return check of bn_hex2bn_cbs()

It returns a length, not a Boolean, so check for 0 explicitly. This is
purely cosmetic.

ok jsing

16 months agotypo: hexidecimal -> hexadecimal
tb [Fri, 23 Jun 2023 10:31:27 +0000 (10:31 +0000)]
typo: hexidecimal -> hexadecimal

16 months agoRemove some redundant parentheses
tb [Fri, 23 Jun 2023 08:00:28 +0000 (08:00 +0000)]
Remove some redundant parentheses

This file is already enough of an eyesore without them.

16 months agorpki-client: check for duplicate certificate extensions
tb [Fri, 23 Jun 2023 07:40:28 +0000 (07:40 +0000)]
rpki-client: check for duplicate certificate extensions

RFC 5280 disallows multiple extensions with the same OID. Since libcrypto
does not check that currently, do this by hand. This only deals with CA
certs for now, EE certs could do that similarly.

Found with BBN test corpora

ok job

16 months agorpki-client: disallow empty sets of IP Addresses or AS numbers
tb [Fri, 23 Jun 2023 07:26:21 +0000 (07:26 +0000)]
rpki-client: disallow empty sets of IP Addresses or AS numbers

RFC 3779 doesn't say anything about empty lists of IP addresses and AS
numbers. Of course the RFC 3779 code in libcrypto implements a check for
empty lists for AS numbers but fails to do so for IP addresses...

While RFC 6487 is explicit about disallowing empty lists of IP addresses,
it is not explicit about disallowing empty ipAddressesOrRanges, but that
seems to be the intent.

Found with BBN test corpora

ok job

16 months agoRevert previous, not all platforms allow compiling
otto [Fri, 23 Jun 2023 05:26:45 +0000 (05:26 +0000)]
Revert previous, not all platforms allow compiling
__builtin_return_address(a) with a != 0.

16 months agoAvoid division by 0 in m_pool_used
gnezdo [Fri, 23 Jun 2023 04:36:49 +0000 (04:36 +0000)]
Avoid division by 0 in m_pool_used

OK dlg@

Reported-by: syzbot+a377d5cd833c2343429a@syzkaller.appspotmail.com
16 months agoksmn(4): Support thermal sensors on Ryzen 9 79xx
mlarkin [Fri, 23 Jun 2023 03:47:10 +0000 (03:47 +0000)]
ksmn(4): Support thermal sensors on Ryzen 9 79xx

ok deraadt, brynet

16 months agosymbols: Tweak this test so it works with -j N
tb [Thu, 22 Jun 2023 19:23:27 +0000 (19:23 +0000)]
symbols: Tweak this test so it works with -j N

16 months agoRevert "clockintr_cpu_init: initialize starting offsets with clockintr_stagger()"
cheloha [Thu, 22 Jun 2023 16:23:50 +0000 (16:23 +0000)]
Revert "clockintr_cpu_init: initialize starting offsets with clockintr_stagger()"

octeon machines do not increment the global variable "ncpus"
(init_main.c) in the same spot as other platforms, which violates the
KASSERT in clockintr_stagger(), causing a panic.

We need to bring octeon's behavior into alignment with every other
platform before proceeding with this patch.

Reported and debugged by bluhm@.

16 months agoMention lid position support.
tobhe [Thu, 22 Jun 2023 15:29:05 +0000 (15:29 +0000)]
Mention lid position support.

From Jan Stary

16 months agoAdd machdep.lidaction example. We support this on arm64 laptops now.
tobhe [Thu, 22 Jun 2023 15:20:16 +0000 (15:20 +0000)]
Add machdep.lidaction example. We support this on arm64 laptops now.

From Jan Stary
Ok patrick@

16 months agoInstead of tsleep on lbolt do a tsleep with a 1 second timeout.
claudio [Thu, 22 Jun 2023 13:18:02 +0000 (13:18 +0000)]
Instead of tsleep on lbolt do a tsleep with a 1 second timeout.
Result is the same and gets rid of a lbolt use.
OK miod@

16 months agoAllow to ask for deeper callers for leak reports using malloc options.
otto [Thu, 22 Jun 2023 11:04:16 +0000 (11:04 +0000)]
Allow to ask for deeper callers for leak reports using malloc options.
ok deraadt@

16 months agoUse new ibu API, switch from ibuf_seek() to ibuf_set().
claudio [Thu, 22 Jun 2023 10:38:27 +0000 (10:38 +0000)]
Use new ibu API, switch from ibuf_seek() to ibuf_set().
Also use ibuf_data() and ibuf_size().
OK tb@

16 months agoKNF
claudio [Thu, 22 Jun 2023 09:08:02 +0000 (09:08 +0000)]
KNF

16 months agoKNF
claudio [Thu, 22 Jun 2023 09:07:04 +0000 (09:07 +0000)]
KNF

16 months agodrm/amdgpu: Don't set struct drm_driver.output_poll_changed
jsg [Thu, 22 Jun 2023 05:19:01 +0000 (05:19 +0000)]
drm/amdgpu: Don't set struct drm_driver.output_poll_changed

From Thomas Zimmermann
4b4cae8e4b37c7ad4d9721dbda060a62e49e3c17 in linux-6.1.y/6.1.35
0e3172bac3f43759719384403fe2d1e4c61f87e0 in mainline linux

16 months agodrm/amdgpu: add missing radeon secondary PCI ID
jsg [Thu, 22 Jun 2023 05:17:31 +0000 (05:17 +0000)]
drm/amdgpu: add missing radeon secondary PCI ID

From Alex Deucher
21863dc45aed8d68a2573cce032ecbc8fe7c5bf5 in linux-6.1.y/6.1.35
e61f67749b351c19455ce3085af2ae9af80023bc in mainline linux

16 months agodrm/amd/pm: workaround for compute workload type on some skus
jsg [Thu, 22 Jun 2023 05:16:06 +0000 (05:16 +0000)]
drm/amd/pm: workaround for compute workload type on some skus

From Kenneth Feng
6f5b5ce9397d91b0a8bc8d15dc8fd72bc0aacaa4 in linux-6.1.y/6.1.35
7ca302d488f80cf4529620acc1c545f9022d8bb8 in mainline linux

16 months agodrm/amd: Tighten permissions on VBIOS flashing attributes
jsg [Thu, 22 Jun 2023 05:14:26 +0000 (05:14 +0000)]
drm/amd: Tighten permissions on VBIOS flashing attributes

From Mario Limonciello
b69a10df900386871703a4cc3be974485f52ff7c in linux-6.1.y/6.1.35
7ab1a4913d0051cf5196ef7987b5fa42c25e13b6 in mainline linux