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
tb [Sun, 25 Jun 2023 19:29:30 +0000 (19:29 +0000)]
With ech_local.h gone, we no longer need to -I ecdh
tb [Sun, 25 Jun 2023 19:28:47 +0000 (19:28 +0000)]
Remove ech_local.h
tb [Sun, 25 Jun 2023 19:26:04 +0000 (19:26 +0000)]
Stop including ech_local.h
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.
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.
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.
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
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.
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
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
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
tb [Sun, 25 Jun 2023 18:35:28 +0000 (18:35 +0000)]
ecdsa_do_sign(): remove useless ecdsa_check() call
ok jsing
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
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
tb [Sun, 25 Jun 2023 18:15:21 +0000 (18:15 +0000)]
x509v3.h: unwrap a line
nicm [Sun, 25 Jun 2023 15:53:07 +0000 (15:53 +0000)]
SGR 0 should not end hyperlink, reported by Lucas Trzesniewski.
tb [Sun, 25 Jun 2023 13:54:58 +0000 (13:54 +0000)]
Adjust/fix X509_check_purpose(3) documentation
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
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@
tb [Sun, 25 Jun 2023 08:12:23 +0000 (08:12 +0000)]
ech_local.h: remove unused ECDH_FLAG_FIPS_METHOD
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
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
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
tb [Sun, 25 Jun 2023 07:50:37 +0000 (07:50 +0000)]
ec_local.h: move ec_group_simple_order_bits down a bit
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@
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@
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@
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@
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@
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*
jsing [Sat, 24 Jun 2023 16:19:52 +0000 (16:19 +0000)]
Assign and test.
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@
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@
jsing [Sat, 24 Jun 2023 15:51:47 +0000 (15:51 +0000)]
Provide optimised bn_subw() and bn_subw_subw() for arm.
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.
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
tb [Fri, 23 Jun 2023 20:05:30 +0000 (20:05 +0000)]
Fix warning about empty ipAddressesOrRanges
Committed from an older tree.
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@
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
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@
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@
tb [Fri, 23 Jun 2023 10:50:47 +0000 (10:50 +0000)]
Codify BN_asc2bn(NULL, *) behavior in regress.
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
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
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
tb [Fri, 23 Jun 2023 10:31:27 +0000 (10:31 +0000)]
typo: hexidecimal -> hexadecimal
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.
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
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
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.
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
mlarkin [Fri, 23 Jun 2023 03:47:10 +0000 (03:47 +0000)]
ksmn(4): Support thermal sensors on Ryzen 9 79xx
ok deraadt, brynet
tb [Thu, 22 Jun 2023 19:23:27 +0000 (19:23 +0000)]
symbols: Tweak this test so it works with -j N
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@.
tobhe [Thu, 22 Jun 2023 15:29:05 +0000 (15:29 +0000)]
Mention lid position support.
From Jan Stary
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@
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@
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@
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@
claudio [Thu, 22 Jun 2023 09:08:02 +0000 (09:08 +0000)]
KNF
claudio [Thu, 22 Jun 2023 09:07:04 +0000 (09:07 +0000)]
KNF
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
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
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
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
jsg [Thu, 22 Jun 2023 05:10:03 +0000 (05:10 +0000)]
drm/amd: Make sure image is written to trigger VBIOS image update flow
From Mario Limonciello
b2706d862b6577b8218bdef1c238e175624b906d in linux-6.1.y/6.1.35
3eb1a3a04056ba3df3205e169b8acc9da0c65a94 in mainline linux
jsg [Thu, 22 Jun 2023 05:08:30 +0000 (05:08 +0000)]
drm/amd/display: edp do not add non-edid timings
From Hersen Wu
ee8c6580c3106b0061c7cdff1804e5a1f1e1d7fe in linux-6.1.y/6.1.35
e749dd10e5f292061ad63d2b030194bf7d7d452c in mainline linux
jsg [Thu, 22 Jun 2023 05:07:09 +0000 (05:07 +0000)]
drm/amdgpu: vcn_4_0 set instance 0 init sched score to 1
From Sonny Jiang
5d1fdfb3d185a9726478ba174235eff7c16f1101 in linux-6.1.y/6.1.35
9db5ec1ceb5303398ec4f899d691073d531257c3 in mainline linux
jsg [Thu, 22 Jun 2023 05:05:56 +0000 (05:05 +0000)]
drm:amd:amdgpu: Fix missing buffer object unlock in failure path
From Sukrut Bellary
8ca9880735b0a33a4ff54328d6c5eb60fe2b0a6d in linux-6.1.y/6.1.35
60ecaaf54886b0642d5c4744f7fbf1ff0d6b3e42 in mainline linux
jsg [Thu, 22 Jun 2023 05:04:19 +0000 (05:04 +0000)]
drm: panel-orientation-quirks: Change Air's quirk to support Air Plus
From Maya Matuszczyk
c45aed74318e65b8da938a593c124ad2ee1a1e66 in linux-6.1.y/6.1.35
1aa7f416175619e0286fddc5fc44e968b06bf2aa in mainline linux
mlarkin [Wed, 21 Jun 2023 23:24:10 +0000 (23:24 +0000)]
Remove extra trailing whitespace
ok stsp
millert [Wed, 21 Jun 2023 22:22:08 +0000 (22:22 +0000)]
ksh: escape control chars when displaying file name completions.
If there are multiple matches when using autocomplete, the list of
matching file names was output as-is. However, for a single match,
control characters are escaped before the file name is displayed.
This makes the behavior more consistent by escaping control chars
in the list of matches too. Discussed with deraadt@, OK op@
cheloha [Wed, 21 Jun 2023 21:16:21 +0000 (21:16 +0000)]
Revert "schedcpu, uvm_meter(9): make uvm_meter() an independent timeout"
Sometimes causes boot hang after mounting root partition.
Thread 1: https://marc.info/?l=openbsd-misc&m=
168736497407357&w=2
Thread 2: https://marc.info/?l=openbsd-misc&m=
168737429214370&w=2
op [Wed, 21 Jun 2023 17:59:24 +0000 (17:59 +0000)]
clear errno before strtoull as it may already be set to ERANGE
noticed and ok millert@
op [Wed, 21 Jun 2023 17:56:26 +0000 (17:56 +0000)]
avoid truncation of filtered data lines
Don't copy in a buffer the filter' output for parsing as we may truncate
filter-dataline (i.e. the mail body). Instead, parse the string by
advancing the pointer without copying or modifications.
Issue reported by Joachim Schneider on the OpenSMTPD-portable
repository.
ok millert@
claudio [Wed, 21 Jun 2023 13:11:49 +0000 (13:11 +0000)]
Use recallocarray() consistently. recallocarray() was introduced to simplify
exactly this use case where the new memory needs to be zeroed during resize.
Since recallocarray() takes care of all this there is no need to bzero()
memory anymore.
OK tb@ millert@
krw [Wed, 21 Jun 2023 12:50:09 +0000 (12:50 +0000)]
Add a parameter 'action' to mpfree() so it can optionally discard
or keep the memory pointed at by the char ** parameter.
Allows mpfree() to be used against the global mountpoints[] and
eliminates a couple of manual loops to free the current contents
of mountpoints[].
No intentional functional change.
sthen [Wed, 21 Jun 2023 09:47:03 +0000 (09:47 +0000)]
add "fib reload" support to ospf6d/ospf6ctl, and trigger it
automatically on a timeout after RTM_DESYNC (i.e. route socket
overflow). ported across from ospfd. fixes/ok claudio@
(it's much harder to overflow the routing socket buffer these
days since it was bumped to 2MB, but still happens occasionally
on a busy machine).
jsing [Wed, 21 Jun 2023 07:56:43 +0000 (07:56 +0000)]
Provide optimised bn_clzw() for aarch64.
claudio [Wed, 21 Jun 2023 07:54:54 +0000 (07:54 +0000)]
Simplify and clean up the code. Try to use more ibuf idioms but the
mix of types used in these functions make this rather hard.
The expected data checks are still not great but a step in the right
direction.
OK tb@
claudio [Wed, 21 Jun 2023 07:49:24 +0000 (07:49 +0000)]
Convert string2binary() to use new ibuf api instead of working with an
extra buffer first.
OK tb@
jsing [Wed, 21 Jun 2023 07:48:41 +0000 (07:48 +0000)]
Provide and use bn_clzw() in place of bn_word_clz().
On some architectures, we can provide an optimised (often single
instruction) count-leading-zero implementation. In order to do this
effectively, provide bn_clzw() as a static inline that can be replaced
by an architecture specific version. The default implementation defers
to the bn_word_clz() function (which may also be architecture specific).
ok tb@
claudio [Wed, 21 Jun 2023 07:45:47 +0000 (07:45 +0000)]
Update ospf6d to use new ibuf api.
This mostly moves away from memcpy(ibuf_seek(buf, off, size), data, size) to
ibuf_set(buf, off, data, size). Also ibuf_reserve() is replaced with
ibuf_add_zero().
OK tb@
claudio [Wed, 21 Jun 2023 07:44:08 +0000 (07:44 +0000)]
Remove extra newlines
jsing [Wed, 21 Jun 2023 07:41:55 +0000 (07:41 +0000)]
Make BN_num_bits() independent of bn->top.
Provide bn_bitsize(), which performs a constant time scan of a BN in order
to determine the bit size of the BN value. Use this for BN_num_bits() such
that it is no longer dependent on the bn->top value.
ok tb@
jsing [Wed, 21 Jun 2023 07:18:10 +0000 (07:18 +0000)]
Add tests for BN_sqr() corner cases.
Test BN_sqr() with a newly allocated BN, a BN explicitly set to zero and
small values that fit in a single BN_ULONG.
jsing [Wed, 21 Jun 2023 07:16:08 +0000 (07:16 +0000)]
Add BN_cmp()/BN_ucmp() tests with zero padded inputs.
Currently BN_hex2bn() removes the leading zeros, however this will not be
the case in the future.
jsing [Wed, 21 Jun 2023 07:15:38 +0000 (07:15 +0000)]
Add a BN_num_bits() with zero padded input.
Currently BN_hex2bn() removes the leading zeros, however this will not be
the case in the future.
nicm [Wed, 21 Jun 2023 06:28:18 +0000 (06:28 +0000)]
Check fdopen return value, from Christian Menges.
djm [Wed, 21 Jun 2023 05:10:26 +0000 (05:10 +0000)]
better validate CASignatureAlgorithms in ssh_config and sshd_config.
Previously this directive would accept certificate algorithm names, but
these were unusable in practice as OpenSSH does not support CA chains.
part of bz3577; ok dtucker@
djm [Wed, 21 Jun 2023 05:08:32 +0000 (05:08 +0000)]
make `ssh -Q CASignatureAlgorithms` only list signature algorithms that
are valid for CA signing. Previous behaviour was to list all signing
algorithms, including certificate algorithms (OpenSSH certificates do
not support CA chains). part of bz3577; ok dtucker@
djm [Wed, 21 Jun 2023 05:06:04 +0000 (05:06 +0000)]
handle rlimits > INT_MAX (rlim_t is u64); ok dtucker
bz3581
jsg [Wed, 21 Jun 2023 01:10:17 +0000 (01:10 +0000)]
call rk3328 not rk3288 functions in rk3328_pinctrl()
tested by and ok kettenis@
djm [Tue, 20 Jun 2023 23:59:33 +0000 (23:59 +0000)]
prepare for support for connecting to unix domain sockets using ssh -W
by explicitly decoding PORT_STREAMLOCAL (a negative number) from the u32
that's passed over the multiplexing socket; previously code would just
cast, which is UB.
cheloha [Tue, 20 Jun 2023 16:30:30 +0000 (16:30 +0000)]
schedcpu, uvm_meter(9): make uvm_meter() an independent timeout
uvm_meter(9) should not base its periodic uvm_loadav() call on the UTC
clock. It also no longer needs to periodically wake up proc0 because
proc0 doesn't do any work. schedcpu() itself may change or go away,
but as kettenis@ notes we probably can't completely remove the concept
of a "load average" from OpenBSD, given its long Unix heritage.
So, (1) remove the uvm_meter() call from schedcpu(), (2) make
uvm_meter() an independent timeout started alongside schedcpu() during
scheduler_start(), and (3) delete the vestigial periodic proc0 wakeup.
With input from deraadt@, kettenis@, and claudio@. deraadt@ cautions
that this change may confuse administrators who hold the load average
in high regard.
Thread: https://marc.info/?l=openbsd-tech&m=
168710929409153&w=2
general agreement with this direction from kettenis@
ok claudio@
claudio [Tue, 20 Jun 2023 15:19:55 +0000 (15:19 +0000)]
Update ospfd to use new ibuf api.
This mostly moves away from memcpy(ibuf_seek(buf, off, size), data, size) to
ibuf_set(buf, off, data, size). Also ibuf_reserve() is replaced with
ibuf_add_zero().
OK tb@
claudio [Tue, 20 Jun 2023 15:15:14 +0000 (15:15 +0000)]
Use new ibuf API in rpki-client.
Use ibuf_fd_get/set/avail in the file descriptor passing code.
Switch some ibuf_seek() calls to ibuf_set() and use ibuf_add_zero() instead
of ibuf_reserve().
OK tb@ job@
espie [Tue, 20 Jun 2023 14:50:05 +0000 (14:50 +0000)]
tweak fragment handling error messages a bit
don't pass parameters we don't need
tb [Tue, 20 Jun 2023 14:37:15 +0000 (14:37 +0000)]
Consolidate elliptic curve cofactor handling
The various checks of the cofactor to be set in EC_GROUP_set_generator()
are a bit all over the place. Move them into a single function and clean
things up a little. Instead of calculating directly with the cofactor
member of the group, use a temporary variable and copy this variable only
if all tests passed. In cryptographic contexts the cofactor almost always
fits if not into a single byte then into a word, so copying is cheap.
Also streamline the computations a bit and remove some binary curve
contortions.
ok jsing