openbsd
14 months agoAdd iked support for route based sec(4) tunnels.
tobhe [Fri, 11 Aug 2023 11:24:55 +0000 (11:24 +0000)]
Add iked support for route based sec(4) tunnels.

To use sec(4) instead of policy based tunnels, create a sec(4)
interface and add 'iface secXX' to your policy config.
sec(4) interfaces also support auto configuration for dynamic client
IPs via 'request any' like all other interfaces.
The config won't work without traffic selectors, 'from any to any'
should work for now but I plan to make this optional in the future.

ok dlg@

14 months agoMove the single_thread_check() to the start of userret().
claudio [Fri, 11 Aug 2023 07:54:18 +0000 (07:54 +0000)]
Move the single_thread_check() to the start of userret().

This way threads stopped by SINGLE_SUSPEND will check for pending
signals right after being released instead of returning to userland
first. The same order of check is already used in sleep_signal_check().

OK mpi@

14 months agoRename env_md{,_ctx}_st to evp_md{,_ctx}_st
tb [Fri, 11 Aug 2023 05:10:35 +0000 (05:10 +0000)]
Rename env_md{,_ctx}_st to evp_md{,_ctx}_st

As everyone knows (and who doesn't know will immediately guess), EVP is
short for envelope. Most structs backing the public EVP_* types are called
evp_*. For the EVP_MD and EVP_MD_CTX types, someone used env_md_st and
env_md_ctx_st, which, as jsing pointed out, may or may not be related to
a much less obvious abbreviation of envelope. It could also simply have
been for reasons of inconsistency.

Be all that as it may: rename these structs to use the evp_* namespace
to match all the other EVP types, as well as upstream.

ok jsing

14 months agoStop down-converting to a timeval when comparing and setting times.
guenther [Fri, 11 Aug 2023 05:07:28 +0000 (05:07 +0000)]
Stop down-converting to a timeval when comparing and setting times.
Replace use of the old BSD st_*timespec members in struct stat with
the POSIX-standard st_*tim members.

ok millert@

14 months agoSwitch rcs_{get,set}_mtime() from returning and taking a time_t to
guenther [Fri, 11 Aug 2023 05:02:21 +0000 (05:02 +0000)]
Switch rcs_{get,set}_mtime() from returning and taking a time_t to
doing so with a struct timespec and then use tv_nsec = UTIME_OMIT
instead of a (time_t)-1 as a "do nothing" value.  They can then
fully preserve the timestamp

ok millert@

14 months agoUse EVP_MD in HKDF() and HKDF_extract() prototypes
tb [Fri, 11 Aug 2023 04:52:08 +0000 (04:52 +0000)]
Use EVP_MD in HKDF() and HKDF_extract() prototypes

Switch these prototypes to be like all other code and use the EVP_MD type
rather than the internal name of the struct. This also makes the function
definitions match the prototypes.

ok jsing

14 months agomsdosfs_times() doesn't need to copy timespecs onto the stack: just
guenther [Fri, 11 Aug 2023 04:51:36 +0000 (04:51 +0000)]
msdosfs_times() doesn't need to copy timespecs onto the stack: just
mark unix2dostime()'s first argument as a pointer to const and skip
the copies.

ok millert@

14 months agocvs_file_copy() used futimes(), but only set the tv_sec fields,
guenther [Fri, 11 Aug 2023 04:48:14 +0000 (04:48 +0000)]
cvs_file_copy() used futimes(), but only set the tv_sec fields,
which presumably meant passing stack garbage in the tv_usec and
failing with EINVAL, whee.  Switch to futimens() and set the full
timespecs from the incoming struct stat

ok millert@

14 months agoMove EC_KEY and EC_KEY_METHOD typedefs to ossl_typ.h
tb [Fri, 11 Aug 2023 04:45:26 +0000 (04:45 +0000)]
Move EC_KEY and EC_KEY_METHOD typedefs to ossl_typ.h

ok jsing

14 months agoReplace use of the old BSD st_*timespec members in struct stat with
guenther [Fri, 11 Aug 2023 04:45:05 +0000 (04:45 +0000)]
Replace use of the old BSD st_*timespec members in struct stat with
the POSIX-standard st_*tim members.

ok millert@

14 months agoWhen used by itself, replace use of the old BSD st_mtimespec.tv_sec
guenther [Fri, 11 Aug 2023 04:44:28 +0000 (04:44 +0000)]
When used by itself, replace use of the old BSD st_mtimespec.tv_sec
member in struct stat with for-all-time st_mtime member.

ok millert@

14 months agoenable sec(4) so people can try it out
dlg [Fri, 11 Aug 2023 02:35:38 +0000 (02:35 +0000)]
enable sec(4) so people can try it out

14 months agobetter support queuing (hfsc) on sec(4)
dlg [Fri, 11 Aug 2023 02:34:56 +0000 (02:34 +0000)]
better support queuing (hfsc) on sec(4)

14 months agoagtimer(4/arm64): call CPU_BUSY_CYCLE() during spin-loop
cheloha [Fri, 11 Aug 2023 01:28:19 +0000 (01:28 +0000)]
agtimer(4/arm64): call CPU_BUSY_CYCLE() during spin-loop

For consistency with other delay(9) implementations, agtimer(4/arm64)
ought to call CPU_BUSY_CYCLE() as it spins.

kettenis@ notes that we could reduce the power consumed in
agtimer_delay() by enabling CNTKCTL_EL1.EVNTEN and configuring
ENTKCTL_EL1.EVNTI.

kettenis@ also notes that Armv8.7 adds FEAT_WFxT, which will, when the
feature appears in real hardware, make it even easier to save power in
agtimer_delay().

With input from drahn@ and kettenis@.

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

ok kettenis@

14 months agobetter debug logging of sessions' exit status
djm [Thu, 10 Aug 2023 23:05:48 +0000 (23:05 +0000)]
better debug logging of sessions' exit status

14 months agoagtimer(4/arm64): agtimer_delay: compute cycle count with 64-bit arithmetic
cheloha [Thu, 10 Aug 2023 22:58:04 +0000 (22:58 +0000)]
agtimer(4/arm64): agtimer_delay: compute cycle count with 64-bit arithmetic

Converting from microseconds to timer cycles is much simpler with
64-bit arithmetic.

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

ok drahn@ kettenis@

14 months agoTake advantage of the fact that the WFI instruction does continue
kettenis [Thu, 10 Aug 2023 21:01:50 +0000 (21:01 +0000)]
Take advantage of the fact that the WFI instruction does continue
immediately if there is a pending interrupt to fix a potential race
in the idle loop.

ok guenther@

14 months agoAdd some KASSERT on the proc p_stat in sleep_finish()
claudio [Thu, 10 Aug 2023 20:44:52 +0000 (20:44 +0000)]
Add some KASSERT on the proc p_stat in sleep_finish()
OK mpi@

14 months agoThe Lenovo X13s has broken firmware that makes it impossible to use PAC.
kettenis [Thu, 10 Aug 2023 19:29:32 +0000 (19:29 +0000)]
The Lenovo X13s has broken firmware that makes it impossible to use PAC.
But other machines that use the same SoC work just fine.  So instead of
disabling this feature on all CPUs that implement the architectured
algorithm, add an SMBIOS-based check that just disables the feature on
these machines.  This means we need to attach smbios0 before cpu0, which
in turn means attaching efi0 earlier.

tested by patrick@

14 months agoAlways create new softraid CRYPTO volume, do not reuse existing one
kn [Thu, 10 Aug 2023 17:09:34 +0000 (17:09 +0000)]
Always create new softraid CRYPTO volume, do not reuse existing one

The bioctl(8) command to create new and unlock old volumes is the same.
Use `-C force' to prevent reuse, which happens with, e.g. aborted/restarted
encrypted installations past the question or installations onto an old disk.

OK naddy sthen deraadt

14 months agoConvert {dh,dsa}_{pub,priv}_encode() to single exit
tb [Thu, 10 Aug 2023 16:57:15 +0000 (16:57 +0000)]
Convert {dh,dsa}_{pub,priv}_encode() to single exit

Use the same variable names throughout these functions and unify them
some more.

ok jsing

14 months agoTable persistent flag (PFR_TFLAG_PERSIST) won't get set
sashan [Thu, 10 Aug 2023 16:44:04 +0000 (16:44 +0000)]
Table persistent flag (PFR_TFLAG_PERSIST) won't get set
by ioctl(2) operation if table exists already. The issue
has been noticed by Giannis Kapetanakis (_at_) edu.physics.uoc.gr.
Giannis noticed relayd(8) aborts unexpectedly when 'relay host'
gets disabled by 'relayctl host dis ...' command. To understand
what's going on we must look at the way how relayd(8) manages
its firewall configuration. If relay-host 'example' is enabled relayd(8)
inserts rule to anchor relayd/example. The rule looks somewhat
like this:
     pass in from ... to ... rdr-to <example>
When the rule gets inserted to pf(4) the table 'example' is
created with flags:
    lumpy# pfctl -a relayd/example -vg -sT
    ----r-- example relayd/example
r-flag indicates table is referred by rule only. In the next
step relayd(8) creates and populates table example. It asks
pf(4) to add a persistent flag (PFR_TFLAG_PERSIST), so table
survives flush operation of relayd/example ruleset on behalf
of 'relayctl host dis ...' command. relayd(8) exits via abort()
when table is gone with disable operation.

Giannis was patient enough so we could debug and fix issue.
The committed change has been tested by Giannis too.

OK kn@, bluhm@

14 months agoAdd the missing ".Nm X509_STORE_CTX_check_issued_fn" to the NAME section
schwarze [Thu, 10 Aug 2023 16:15:42 +0000 (16:15 +0000)]
Add the missing ".Nm X509_STORE_CTX_check_issued_fn" to the NAME section
such that `man X509_STORE_CTX_check_issued_fn` works.
While here, add a Copyright notice for Job Snijders because
he added a significant amount of text to this file in March 2023.
OK job@

14 months agoAllow libpcap to read files with some additional link-layer type values
sashan [Thu, 10 Aug 2023 15:47:05 +0000 (15:47 +0000)]
Allow libpcap to read files with some additional link-layer type values

patch has been contributed by Guy Harris from libpcap/tcpdump. It
resolves collision between DLT_* values on various OSes. The issue
prevents correct interpretation of link layer information in capture
files which might come from another OS. To resolve this libpcap/tcpdump
community introduced a LINKTYPE_* values. The patch provides translation
between DLT_* and LINKTYPE_* for OpenBSD. More details can be found
here: https://www.tcpdump.org/linktypes.html

No objection from OpenBSD community.

OK sthen@

14 months agoClean up {dh,dsa}_pub_encode()
tb [Thu, 10 Aug 2023 15:11:16 +0000 (15:11 +0000)]
Clean up {dh,dsa}_pub_encode()

This brings these two messy functions into more usual shape. There is a
lot more that can be done in here. It is a step in the right direction.

ok jsing

14 months agoFix a leak in rsa_pub_encode()
tb [Thu, 10 Aug 2023 15:05:28 +0000 (15:05 +0000)]
Fix a leak in rsa_pub_encode()

rsa_param_encode() allocates the PSS parameters in an ASN1_STRING which
is leaked if any error occurs later in rsa_pub_encode(). Convert the rest
of the code to follow our ordinary idioms more closely.

ok jsing

14 months agodrop a wayward comma, ok jmc@
naddy [Thu, 10 Aug 2023 14:37:32 +0000 (14:37 +0000)]
drop a wayward comma, ok jmc@

14 months agoIn x509_vfy.h rev. 1.60 and rev. 1.62 (April 2023), tb@ provided
schwarze [Thu, 10 Aug 2023 14:15:16 +0000 (14:15 +0000)]
In x509_vfy.h rev. 1.60 and rev. 1.62 (April 2023), tb@ provided
X509_STORE_CTX_get1_certs(3) and X509_STORE_CTX_get1_crls(3).
Document them and mark their aliases as deprecated.

14 months agoRemove now unnecessary 'do {} while (0);' and move variable declaration.
jsing [Thu, 10 Aug 2023 14:04:54 +0000 (14:04 +0000)]
Remove now unnecessary 'do {} while (0);' and move variable declaration.

No functional change.

14 months agoExpand HASH_MAKE_STRING.
jsing [Thu, 10 Aug 2023 14:03:47 +0000 (14:03 +0000)]
Expand HASH_MAKE_STRING.

No change to generated assembly.

14 months agoRemove MD32_XARRAY remnants.
jsing [Thu, 10 Aug 2023 13:59:31 +0000 (13:59 +0000)]
Remove MD32_XARRAY remnants.

14 months agoReorder functions.
jsing [Thu, 10 Aug 2023 13:58:34 +0000 (13:58 +0000)]
Reorder functions.

No functional change.

14 months agoImplement MD5_{Update,Transform,Final}() directly in md5.c.
jsing [Thu, 10 Aug 2023 13:54:21 +0000 (13:54 +0000)]
Implement MD5_{Update,Transform,Final}() directly in md5.c.

Copy the update, transform and final functions from md32_common.h, manually
expanding the macros for MD5. This will allow for further clean up to
occur.

No change in generated assembly.

14 months agoTidy includes.
jsing [Thu, 10 Aug 2023 13:41:56 +0000 (13:41 +0000)]
Tidy includes.

14 months agoTidy includes.
jsing [Thu, 10 Aug 2023 13:41:18 +0000 (13:41 +0000)]
Tidy includes.

14 months agoMop up the last MD32_XARRAY.
jsing [Thu, 10 Aug 2023 12:27:35 +0000 (12:27 +0000)]
Mop up the last MD32_XARRAY.

MD32_XARRAY was added as a workaround for a broken HP C compiler (circa
1999). Clean it up to simplify the code.

No change in generated assembly.

14 months agoInline the remaining 10 lines from rmdconst.h.
jsing [Thu, 10 Aug 2023 11:06:36 +0000 (11:06 +0000)]
Inline the remaining 10 lines from rmdconst.h.

Discussed with tb@

14 months agoInline X variables definitions.
jsing [Thu, 10 Aug 2023 11:04:30 +0000 (11:04 +0000)]
Inline X variables definitions.

Inline the WL and WR defines, which only add yet another layer of
abstraction and make the code harder to follow.

No change to generated assembly.

Discussed with tb@

14 months agoInline shift values.
jsing [Thu, 10 Aug 2023 11:00:46 +0000 (11:00 +0000)]
Inline shift values.

Inline the SL and SR defines, which only makes the code harder to follow.

No change to generated assembly.

Discussed with tb@

14 months agodocument .VARIABLES
espie [Thu, 10 Aug 2023 10:56:34 +0000 (10:56 +0000)]
document .VARIABLES

14 months agoAdd support for .VARIABLES, to which I have use.
espie [Thu, 10 Aug 2023 10:52:43 +0000 (10:52 +0000)]
Add support for .VARIABLES, to which I have use.
This is an extension but also exists in gnu-make.
okay millert@, kn@, thfr@
(I've added an XXX comment on top of the patch you've seen,
no actual further code change)

14 months agoApply some more style(9).
jsing [Thu, 10 Aug 2023 10:21:37 +0000 (10:21 +0000)]
Apply some more style(9).

No change in generated assembly.

14 months agoVarious fixes in {dh,dsa}_priv_encode()
tb [Thu, 10 Aug 2023 09:43:51 +0000 (09:43 +0000)]
Various fixes in {dh,dsa}_priv_encode()

Avoid creating an ASN1_STRING with negative length, set type, data
and length via ASN1_STRING_type_new() and ASN1_STRING_set0() instead
of doing this manually. Check return value for i2d_ASN1_INTEGER()
and use an intermediate ASN1_OBJECT instead of nested function calls.
Finally, clear sensitive data with freezero().

ok jsing

14 months agorsa_priv_encode: plug leak on PKCS8_pkey_set0() failure
tb [Thu, 10 Aug 2023 09:36:37 +0000 (09:36 +0000)]
rsa_priv_encode: plug leak on PKCS8_pkey_set0() failure

Change the code to use safer idioms and avoid nested function calls.

ok jsing

14 months agoMake stopped ldom utilization appear as zero
kn [Thu, 10 Aug 2023 07:50:45 +0000 (07:50 +0000)]
Make stopped ldom utilization appear as zero

ldomctl(8) 'status' updated the value only on running guests,
i.e. stopped ones repeated the last ones instead of showing zero.

Always reset per guest before updating it, From Koakuma, thanks!

14 months agoImprove byte order handling in gcm128.
jsing [Thu, 10 Aug 2023 07:18:43 +0000 (07:18 +0000)]
Improve byte order handling in gcm128.

Replace a pile of byte order handling mess with htobe*() and be*toh().

ok tb@

14 months agoRemove MD32_REG_T.
jsing [Thu, 10 Aug 2023 07:15:23 +0000 (07:15 +0000)]
Remove MD32_REG_T.

This is a hack that is only enabled on a handful of 64 bit platforms, as
a workaround for poor compiler optimisation. If you're running an archiac
compiler on an archiac architecture, then you can deal with slightly lower
performance.

ok tb@

14 months agoopenssh-9.4
djm [Thu, 10 Aug 2023 01:01:07 +0000 (01:01 +0000)]
openssh-9.4

14 months agoregen
kmos [Wed, 9 Aug 2023 21:28:30 +0000 (21:28 +0000)]
regen

14 months agoAdd Crucial as a vendor and the P5 Plus NVMe as a product
kmos [Wed, 9 Aug 2023 21:27:47 +0000 (21:27 +0000)]
Add Crucial as a vendor and the P5 Plus NVMe as a product

ok and tweak jsg@

14 months agoAdd the forgotten .In line
schwarze [Wed, 9 Aug 2023 17:34:39 +0000 (17:34 +0000)]
Add the forgotten .In line
and fix a typo: s/content objects/content octets/.

14 months agoIn objects.h rev. 1.14 and 1.15 (Jan 2022), tb@ provided
schwarze [Wed, 9 Aug 2023 17:27:26 +0000 (17:27 +0000)]
In objects.h rev. 1.14 and 1.15 (Jan 2022), tb@ provided
OBJ_get0_data(3) and OBJ_length(3).  Document them.
Feedback and OK tb@.

14 months agoRework BN_BLINDING to use pthread_t directly
tb [Wed, 9 Aug 2023 12:09:06 +0000 (12:09 +0000)]
Rework BN_BLINDING to use pthread_t directly

Instead of CRYPTO_THREADID, which passes pthread_via through unsigned long,
we can use pthread_self() and pthread_equal() directly. This commit keeps
using the awkward 'local' nomenclature as that is used throughout the rsa
code. This will be changed after the blinding code will have been fully
merged into rsa_blinding.c.

ok jsing

14 months agoMerge remainder of rsa_crpt.c into rsa_eay.c
tb [Wed, 9 Aug 2023 09:32:22 +0000 (09:32 +0000)]
Merge remainder of rsa_crpt.c into rsa_eay.c

Most of these are one line wrappers around methods implemented in rsa_eay.c
by default.

14 months agoMove RSA blinding API from rsa_crpt.c to rsa_blinding.c
tb [Wed, 9 Aug 2023 09:26:43 +0000 (09:26 +0000)]
Move RSA blinding API from rsa_crpt.c to rsa_blinding.c

14 months agoMove RSA_blinding_{on,off}() to the bottom of the file
tb [Wed, 9 Aug 2023 09:25:13 +0000 (09:25 +0000)]
Move RSA_blinding_{on,off}() to the bottom of the file

14 months agoMove bn_blind.c to rsa_blinding.c
tb [Wed, 9 Aug 2023 09:23:03 +0000 (09:23 +0000)]
Move bn_blind.c to rsa_blinding.c

discussed with jsing

14 months agoMake declaration and definition of BN_BLINDING_new() match.
tb [Wed, 9 Aug 2023 09:20:00 +0000 (09:20 +0000)]
Make declaration and definition of BN_BLINDING_new() match.
Also, make mod const.

14 months agoMerge BN_BLINDING_create_param() into BN_BLINDING_new()
tb [Wed, 9 Aug 2023 09:09:24 +0000 (09:09 +0000)]
Merge BN_BLINDING_create_param() into BN_BLINDING_new()

14 months agoSet up the blinding factors on first use
tb [Wed, 9 Aug 2023 08:39:46 +0000 (08:39 +0000)]
Set up the blinding factors on first use

Only call BN_BLINDING_setup() from BN_BLINDING_update(). This allows
another simplification of the counter logic.

ok jsing

14 months agoRemove retry loop in BN_BLINDING_setup()
tb [Wed, 9 Aug 2023 08:35:59 +0000 (08:35 +0000)]
Remove retry loop in BN_BLINDING_setup()

If we generate a non-invertible blinding, we have accidentally factored
the modulus. This won't happen, so get rid of this ugly complication.

ok jsing

14 months agoCompute a square using BN_mod_sqr() instead of BN_mod_mul()
tb [Wed, 9 Aug 2023 08:31:13 +0000 (08:31 +0000)]
Compute a square using BN_mod_sqr() instead of BN_mod_mul()

ok jsing

14 months agoSimplify BN_BLINDING_invert()
tb [Wed, 9 Aug 2023 08:29:23 +0000 (08:29 +0000)]
Simplify BN_BLINDING_invert()

If the blinding is non-NULL, Ai is set on it, so no need to check for
that. Also, we can get away with a single call to BN_mod_mul().

ok jsing

14 months agoUnwrap a line
tb [Wed, 9 Aug 2023 08:27:02 +0000 (08:27 +0000)]
Unwrap a line

14 months agocorrect platform id mask, it is 3 bits 52:50
jsg [Wed, 9 Aug 2023 02:59:41 +0000 (02:59 +0000)]
correct platform id mask, it is 3 bits 52:50

14 months agoremove some uneeded includes
jsg [Wed, 9 Aug 2023 02:08:14 +0000 (02:08 +0000)]
remove some uneeded includes
ok dlg@

14 months agoshow x86 cpu patch level in dmesg
jsg [Wed, 9 Aug 2023 00:01:44 +0000 (00:01 +0000)]
show x86 cpu patch level in dmesg
ok guenther@ deraadt@

14 months agoMerge SO_BINDANY cases from both switch blocks within sosetopt(). This
mvs [Tue, 8 Aug 2023 22:07:25 +0000 (22:07 +0000)]
Merge SO_BINDANY cases from both switch blocks within sosetopt(). This
time SO_LINGER case is separated, so there is no reason for dedicated
switch block.

ok bluhm

14 months agoMerge SO_SND* with corresponding SO_RCV* cases within sosetopt(). The
mvs [Tue, 8 Aug 2023 22:06:27 +0000 (22:06 +0000)]
Merge SO_SND* with corresponding SO_RCV* cases within sosetopt(). The
only difference is the socket buffer.

As bonus, in the future solock() will be easily replaced by sblock()
instead pushing it down to each SO_SND* and SO_RCV* case.

ok bluhm

14 months agoUnwrap a line
tb [Tue, 8 Aug 2023 15:24:02 +0000 (15:24 +0000)]
Unwrap a line

14 months agoDrop the unused BN_BLINDING argument of BN_BLINDING_create_param()
tb [Tue, 8 Aug 2023 15:18:24 +0000 (15:18 +0000)]
Drop the unused BN_BLINDING argument of BN_BLINDING_create_param()

14 months agoRename ret into b in BN_BLINDING_setup()
tb [Tue, 8 Aug 2023 15:10:34 +0000 (15:10 +0000)]
Rename ret into b in BN_BLINDING_setup()

14 months agoFactor the actual setup step for the blinding into a helper
tb [Tue, 8 Aug 2023 14:40:56 +0000 (14:40 +0000)]
Factor the actual setup step for the blinding into a helper

ok jsing

14 months agoX509_STORE_CTX_get_check_issued(3) is weird.
schwarze [Tue, 8 Aug 2023 13:59:23 +0000 (13:59 +0000)]
X509_STORE_CTX_get_check_issued(3) is weird.
Both the function return type and the function name are so long
that for displaying the function prototype,
a line break is needed after the function return type.

14 months agoMake BN_BLINDING respect some invariants
tb [Tue, 8 Aug 2023 13:59:04 +0000 (13:59 +0000)]
Make BN_BLINDING respect some invariants

Pass e and mod into BN_BLINDING_new() for now and unconditionally allocate
A and Ai. This way non-NULL blindings always have these four members set.
This allows removing several unnecessary checks in the update, convert and
parameter creation code paths.

Fix exit BN_BLINDING_create_param() so as to signal errors to the caller
if a non-NULL blinding was passed. This fixes a long standing bug.

ok jsing

14 months agoSimplify RSA_setup_blinding()
tb [Tue, 8 Aug 2023 13:49:45 +0000 (13:49 +0000)]
Simplify RSA_setup_blinding()

Make this look a bit more like other code we cleaned up avoiding nesting
and unnecessary else branches.

ok jsing

14 months agoRemove ECDSA nonce padding kludge
tb [Tue, 8 Aug 2023 13:09:28 +0000 (13:09 +0000)]
Remove ECDSA nonce padding kludge

This was a workaround due to the historically non-constant time scalar
multiplication in the EC code. Since Brumley and Tuveri implemented the
Montgomery ladder, this is no longer useful and should have been removed
a long time ago, as it now does more harm than good.

Keep the preallocations as they still help hiding some timing info.

ok jsing

14 months agoIn objects.h rev. 1.17 (Jan 14, 2022),
schwarze [Tue, 8 Aug 2023 12:55:08 +0000 (12:55 +0000)]
In objects.h rev. 1.17 (Jan 14, 2022),
tb@ removed the following macros from the public API:
_DECLARE_OBJ_BSEARCH_CMP_FN
DECLARE_OBJ_BSEARCH_CMP_FN DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN
IMPLEMENT_OBJ_BSEARCH_CMP_FN IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN
OBJ_bsearch OBJ_bsearch_ex

In objects.h rev. 1.20 (Nov 11, 2022), jsing@ unifdef'ed USE_OBJ_MAC.

Stop marking these names as intentionally undocumented.

14 months agodocument new diagnostic
espie [Tue, 8 Aug 2023 12:46:56 +0000 (12:46 +0000)]
document new diagnostic

14 months agohave a go at documenting the Interface config statement.
dlg [Tue, 8 Aug 2023 10:31:03 +0000 (10:31 +0000)]
have a go at documenting the Interface config statement.

im not really happy with this, but it's a start.

14 months agoif sec is being destroyed, prevent it from being brought up again.
dlg [Tue, 8 Aug 2023 10:19:15 +0000 (10:19 +0000)]
if sec is being destroyed, prevent it from being brought up again.

14 months agoadapt more functions to the i915_gem_phys hack
jsg [Tue, 8 Aug 2023 10:16:51 +0000 (10:16 +0000)]
adapt more functions to the i915_gem_phys hack

linux stashes a dma va in the vm_page pointer part of the scatterlist.
We use a pointer to a struct with the dma tag and map.

14 months agotry to avoid a deadlock between sec_down and sec_send.
dlg [Tue, 8 Aug 2023 10:14:29 +0000 (10:14 +0000)]
try to avoid a deadlock between sec_down and sec_send.

sec_send runs in the systq (because it calls ipsec stuff which uses
crypto, which is not mpsafe) and takes the net lock (because ipsec
output calls ip_output and other stuff). sec_down is called with
NET_LOCK held and tries to run a barrier for send task. if the send
task is running but is waiting for the net lock while sec_down is
holding the net lock while waiting for the task to finish, we're
deadlocked.

this copies the sc_up thing from pfsync, which hopefuly avoids this.

pointed out by mvs@

14 months agoAdd flag to next-prompt/previous-prompt to go to command output instead,
nicm [Tue, 8 Aug 2023 08:21:29 +0000 (08:21 +0000)]
Add flag to next-prompt/previous-prompt to go to command output instead,
from Magnus Gross.

14 months agoAdd options and flags for menu styles similar to those existing for
nicm [Tue, 8 Aug 2023 08:08:47 +0000 (08:08 +0000)]
Add options and flags for menu styles similar to those existing for
popups, from Alexis Hildebrandt. GitHub issue 3650.

14 months agoExtend the menu drawing function to support custom characters and
nicm [Tue, 8 Aug 2023 07:41:04 +0000 (07:41 +0000)]
Extend the menu drawing function to support custom characters and
styles, from Alexis Hildebrandt.

14 months agoFix a couple of rounded border characters, from Alexis Hildebrandt.
nicm [Tue, 8 Aug 2023 07:19:48 +0000 (07:19 +0000)]
Fix a couple of rounded border characters, from Alexis Hildebrandt.

14 months agoReplace use of the old BSD st_*timensec members in struct stat with
guenther [Tue, 8 Aug 2023 04:45:44 +0000 (04:45 +0000)]
Replace use of the old BSD st_*timensec members in struct stat with
the POSIX-standard st_*tim.tv_nsec members.

ok millert@

14 months agosync
deraadt [Tue, 8 Aug 2023 02:42:35 +0000 (02:42 +0000)]
sync

14 months agoNo need to mark BN_options() as intentionally undocumented any longer.
schwarze [Mon, 7 Aug 2023 23:10:03 +0000 (23:10 +0000)]
No need to mark BN_options() as intentionally undocumented any longer.
In bn.h rev. 1.75 (July 31, 2023), tb@ removed it from the public API.

While here, stop marking BN_prime_checks as obsolete.
In BN_generate_prime.3 rev. 1.23 (May 11, 2023), tb@ documented
the constant BN_prime_checks in that manual page.

14 months agoMark asn1_ps_func as obsolete and intentionally undocumented.
schwarze [Mon, 7 Aug 2023 22:39:49 +0000 (22:39 +0000)]
Mark asn1_ps_func as obsolete and intentionally undocumented.
In bio.h rev. 1.59 (July 28, 2023), tb@ removed the last four functions
that took function pointers of this type from the public API.

14 months agoMark BIT_STRING_BITNAME as obsolete and intentionally undocumented.
schwarze [Mon, 7 Aug 2023 22:22:15 +0000 (22:22 +0000)]
Mark BIT_STRING_BITNAME as obsolete and intentionally undocumented.
In asn1.h rev. 1.80 (July 28, 2023), tb@ removed the last three
functions that were using this data type from the public API.

15 months agoRaise transmit threshold to 512 bytes. This makes dwqe(4) work at
kettenis [Mon, 7 Aug 2023 20:28:47 +0000 (20:28 +0000)]
Raise transmit threshold to 512 bytes.  This makes dwqe(4) work at
1000baseT.  We still see a small number of underflow errors when hammering
the interface with packets, but it is defenitely usable.

While there, make sure we count transmit errors.

ok jmatthew@

15 months agoRevert 1.43 and always make our own mapping of the Mostek chip. Trying to
miod [Mon, 7 Aug 2023 17:11:13 +0000 (17:11 +0000)]
Revert 1.43 and always make our own mapping of the Mostek chip. Trying to
reuse the prom mapping here is a bad idea because we alter its writeability
and the prom will not always expect this.

Repairs powerdown on Tapdole Ultrabook IIe.

discussed with and ok kettenis@

15 months agosome readability tweaks; ok dlg
jmc [Mon, 7 Aug 2023 16:29:36 +0000 (16:29 +0000)]
some readability tweaks; ok dlg

15 months agoAdd a regress test exercising BIO_dup_chain() and triggering the leak
tb [Mon, 7 Aug 2023 11:00:54 +0000 (11:00 +0000)]
Add a regress test exercising BIO_dup_chain() and triggering the leak
fixed in bio_lib.c r1.47 as confirmed by ASAN.

15 months agoFix two leaks in BIO_dup_chain()
tb [Mon, 7 Aug 2023 10:58:56 +0000 (10:58 +0000)]
Fix two leaks in BIO_dup_chain()

If CRYPTO_dup_ex_data() fails, the new_bio is leaked. If an error occurs
after the first iteration, all members of the new chain except the head
are leaked.

ok jsing

15 months agoAdd missing space before =
tb [Mon, 7 Aug 2023 10:54:14 +0000 (10:54 +0000)]
Add missing space before =

15 months agoFree title earlier, from Alexis Hildebrandt.
nicm [Mon, 7 Aug 2023 10:52:00 +0000 (10:52 +0000)]
Free title earlier, from Alexis Hildebrandt.

15 months agoTrim can generate strings longer than the original if there are many #s,
nicm [Mon, 7 Aug 2023 10:04:29 +0000 (10:04 +0000)]
Trim can generate strings longer than the original if there are many #s,
so create a bigger buffer. Reported by Robert Morris.