openbsd
16 months agoThis diff limits the number of transactions/tickets
sashan [Tue, 4 Jul 2023 14:23:38 +0000 (14:23 +0000)]
This diff limits the number of transactions/tickets
pf_open_trans() can issue for each clone of /dev/pf
to 512. The pf_open_trans() is currently being used
by DIOCGETRULES ioctl(2). The limit avoids processes
to consume all kernel memory by asking DIOCGETRULES
for more tickets. If DIOCGETRULES hits the limit, then
the application will see EBUSY error.

This diff was fine tuned with feedback from cluadio@,
deraadt@ and kn@.

OK kn@

16 months agostop saying the format is "simple" there are so many annotations.
espie [Tue, 4 Jul 2023 14:08:30 +0000 (14:08 +0000)]
stop saying the format is "simple" there are so many annotations.
"straightforward" is a better description at this point.

16 months agoadd some more fluff to documentation
espie [Tue, 4 Jul 2023 14:03:16 +0000 (14:03 +0000)]
add some more fluff to documentation

16 months agoexplain why NO_TS_IN_PLIST exists
espie [Tue, 4 Jul 2023 14:00:18 +0000 (14:00 +0000)]
explain why NO_TS_IN_PLIST exists

16 months agofix some very minor syntactic nits
espie [Tue, 4 Jul 2023 13:58:01 +0000 (13:58 +0000)]
fix some very minor syntactic nits

16 months agoCheck for interface type ethernet before call ether_brport_isset()
jan [Tue, 4 Jul 2023 13:37:47 +0000 (13:37 +0000)]
Check for interface type ethernet before call ether_brport_isset()

Pointed out by bluhm.

ok bluhm@

16 months agoenable dwqe(4)
kettenis [Tue, 4 Jul 2023 13:04:08 +0000 (13:04 +0000)]
enable dwqe(4)

16 months agoAdd StarFive JH7110 support.
kettenis [Tue, 4 Jul 2023 12:58:42 +0000 (12:58 +0000)]
Add StarFive JH7110 support.
Based on an initial diff from jsing@

ok jsing@, patrick@

16 months agoHandle rx error.
kettenis [Tue, 4 Jul 2023 12:48:42 +0000 (12:48 +0000)]
Handle rx error.

ok jsing@, patrick@

16 months agoconsistenly name instruction defines
jasper [Tue, 4 Jul 2023 12:27:44 +0000 (12:27 +0000)]
consistenly name instruction defines

16 months agoUnbreak kprobes. Since LLVM emits endbr64 instructions for IBT, dt could no
jasper [Tue, 4 Jul 2023 12:20:10 +0000 (12:20 +0000)]
Unbreak kprobes. Since LLVM emits endbr64 instructions for IBT, dt could no
longer identify function boundaries and as such no kprobes were found anymore.
Adjust the parser accordingly.

ok mpi@

16 months agoThe recent change to DIOCGETRULE allows applications which
sashan [Tue, 4 Jul 2023 11:34:19 +0000 (11:34 +0000)]
The recent change to DIOCGETRULE allows applications which
periodically read rules from pf(4) to consume all kernel
memory. The bug has been discovered and root caused by florian@.
In this particular case it was snmpd(8) what ate all kernel
memory.

This commit introduces DIOCXEND to pf(4) so applications such
as snmpd(8) and systat(1) to close ticket/transaction when
they are done with fetching the rules. This change also
updates snmpd(8) and systat(1) to use newly introduced
DIOCXEND ioctl(2).

OK claudio@, deraadt@, kn@

16 months agoRun Perl tests from our regress tree. It needs a Perl obj directory
bluhm [Tue, 4 Jul 2023 11:27:13 +0000 (11:27 +0000)]
Run Perl tests from our regress tree.  It needs a Perl obj directory
with Makefile.  To create the test environment, use the
Makefile.bsd-wrapper in /usr/src/gnu/usr.bin/perl and build Perl
there if it does not exist.  This allows to test Perl easily and
in a consistent manner.  Do not link tests to regress tree due to
this reach around and the combination of build and test.

16 months agoremove prototypes for removed functions
jsg [Tue, 4 Jul 2023 11:14:00 +0000 (11:14 +0000)]
remove prototypes for removed functions

16 months agoExtract private key and group order in s computation
tb [Tue, 4 Jul 2023 10:53:42 +0000 (10:53 +0000)]
Extract private key and group order in s computation

This pushes a few variables no longer needed in ossl_ecdsa_sign_sig() into
ecdsa_compute_s() separating API logic and pure computation a bit more.

ok beck

16 months agoRemove redundant code when calculating checksum.
bluhm [Tue, 4 Jul 2023 10:48:19 +0000 (10:48 +0000)]
Remove redundant code when calculating checksum.
OK jmatthew@

16 months agoAdd a bunch of clocks for GMAC0 and GMAC1 on the JH7110 SoC.
kettenis [Tue, 4 Jul 2023 10:34:03 +0000 (10:34 +0000)]
Add a bunch of clocks for GMAC0 and GMAC1 on the JH7110 SoC.
Based on an initial diff from jsing@

ok jsing@

16 months agoUse key for the EC_KEY everywhere
tb [Tue, 4 Jul 2023 10:31:57 +0000 (10:31 +0000)]
Use key for the EC_KEY everywhere

16 months agoSome more consistency in variable names
tb [Tue, 4 Jul 2023 10:26:47 +0000 (10:26 +0000)]
Some more consistency in variable names

16 months agoNormalize ECDSA_SIG to be sig everywhere
tb [Tue, 4 Jul 2023 10:23:34 +0000 (10:23 +0000)]
Normalize ECDSA_SIG to be sig everywhere

16 months agoMake the hardware counters available on BCM5705 and newer available as
jmatthew [Tue, 4 Jul 2023 10:22:39 +0000 (10:22 +0000)]
Make the hardware counters available on BCM5705 and newer available as
kstats.  Some of the hardware counters are already used in
bge_stats_update_regs() to update interface counters and work around
hardware bugs, and all counters reset on read, so to keep things simple
the work is split between that function and bge_kstat_read(), which
reads the rest of the counters.

tested by bluhm@ on BCM5720 (with counters) and BCM5704 (without), and
by me on BCM5720 A0 (with counters and hardware bugs)
ok bluhm@ dlg@

16 months agoNormalize on digest and digest_len rather than dgst dlen dgstlen, etc.
tb [Tue, 4 Jul 2023 10:14:37 +0000 (10:14 +0000)]
Normalize on digest and digest_len rather than dgst dlen dgstlen, etc.

16 months agoRework ecdsa_prepare_digest()
tb [Tue, 4 Jul 2023 10:06:36 +0000 (10:06 +0000)]
Rework ecdsa_prepare_digest()

Make it take an EC_KEY instead of a group order in preparation for further
cleanup. Rename m into e to match the standard better. Also buy some vowels
for jsing.

ok beck jsing

16 months agoRemove mbuf low watermark vars. Unused since uipc_mbuf.c rev 1.244.
jsg [Tue, 4 Jul 2023 09:47:51 +0000 (09:47 +0000)]
Remove mbuf low watermark vars.  Unused since uipc_mbuf.c rev 1.244.
ok kn@ bluhm@

16 months agoAdd some extra parenthesis for consistency.
kettenis [Tue, 4 Jul 2023 09:00:24 +0000 (09:00 +0000)]
Add some extra parenthesis for consistency.

stolen from jsing@

16 months agoPlug leak in the ssltest
tb [Tue, 4 Jul 2023 08:47:01 +0000 (08:47 +0000)]
Plug leak in the ssltest

Removing -tls1 moved some tests from the legacy stack to the TLSv1.3 stack.
On a HRR, the alpn callback would be called twice and allocate the global
twice, thereby leaking. So free it up front.

Joint suffering with bcook and beck

16 months agoFactor the computation of ECDSA s into a function
tb [Tue, 4 Jul 2023 07:38:31 +0000 (07:38 +0000)]
Factor the computation of ECDSA s into a function

ossl_ecdsa_sign_sig() is already complicated enough. The math bit is
entirely self contained and does not need to obfuscate control flow
and logic.

with feedback from and ok jsing

16 months agodocument the recent addition of "Building from scratch" and what it means.
espie [Tue, 4 Jul 2023 07:04:11 +0000 (07:04 +0000)]
document the recent addition of "Building from scratch" and what it means.

16 months agoadd support for unix domain sockets to ssh -W
dlg [Tue, 4 Jul 2023 03:59:21 +0000 (03:59 +0000)]
add support for unix domain sockets to ssh -W

ok djm@ dtucker@

16 months agom_reclaim() was removed in uipc_mbuf.c rev 1.195
jsg [Tue, 4 Jul 2023 03:56:07 +0000 (03:56 +0000)]
m_reclaim() was removed in uipc_mbuf.c rev 1.195

16 months agoa little knf, no functional change
dlg [Tue, 4 Jul 2023 02:56:11 +0000 (02:56 +0000)]
a little knf, no functional change

16 months agoremove unused global var
jsg [Tue, 4 Jul 2023 02:01:55 +0000 (02:01 +0000)]
remove unused global var
ok sashan@

16 months agorecord when pkg_add is actually doing something.
espie [Mon, 3 Jul 2023 19:12:08 +0000 (19:12 +0000)]
record when pkg_add is actually doing something.
details of rc code to be set in stone later (currently as an option)

16 months agofavor REGRESS_EXPECTED_FAILURES
anton [Mon, 3 Jul 2023 17:55:51 +0000 (17:55 +0000)]
favor REGRESS_EXPECTED_FAILURES

16 months agoalso make things 5.36 if not used
espie [Mon, 3 Jul 2023 17:01:59 +0000 (17:01 +0000)]
also make things 5.36 if not used

16 months agoAdd support for marking lines with a shell prompt based on the OSC 133
nicm [Mon, 3 Jul 2023 16:47:43 +0000 (16:47 +0000)]
Add support for marking lines with a shell prompt based on the OSC 133
extension, from Munif Tanjim in GitHub issue 3596.

16 months agoEnable mouse.tp.mtbuttons for apldcms
tobhe [Mon, 3 Jul 2023 15:54:07 +0000 (15:54 +0000)]
Enable mouse.tp.mtbuttons for apldcms

ok bru@

16 months agouse consistent queue(9) example for LIST removal; OK bluhm mvs
kn [Mon, 3 Jul 2023 15:52:51 +0000 (15:52 +0000)]
use consistent queue(9) example for LIST removal;  OK bluhm mvs

16 months agoAn empty string indicates there is no NXTNUM().
krw [Mon, 3 Jul 2023 15:27:07 +0000 (15:27 +0000)]
An empty string indicates there is no NXTNUM().

Fixes segfault in -e if you happen to delete everything after
a partition line's ":".

16 months agosign_sig: drop ckinv
tb [Mon, 3 Jul 2023 14:51:09 +0000 (14:51 +0000)]
sign_sig: drop ckinv

The only reason ckinv exists is to be able to avoid a copy. This copy
leaks some timing info, that will be mitigated in a subsequent step.
It is an unused or at least uncommonly used codepath.

ok jsing

16 months agoRework the logic in ECDSA sign_sig()
tb [Mon, 3 Jul 2023 13:53:54 +0000 (13:53 +0000)]
Rework the logic in ECDSA sign_sig()

If the caller supplied both kinv and r, we don't loop but rather throw
an undocumented error code that no one uses, which is intended to tell
the caller to run ECDSA_sign_setup() and try again.

Use a boolean that indicates this situation so that the logic becomes
a bit more transparent.

ok jsing

16 months agoadd regress tests for the remainder of the function provided by our uuid.h
jasper [Mon, 3 Jul 2023 13:51:55 +0000 (13:51 +0000)]
add regress tests for the remainder of the function provided by our uuid.h

16 months agoadd a few tests related to --cflags and --libs in combination with Requires.private.
jasper [Mon, 3 Jul 2023 13:44:45 +0000 (13:44 +0000)]
add a few tests related to --cflags and --libs in combination with Requires.private.

skipping one (currently failing) test which exhibits the behaviour described
by humm@ljabl.com on bugs@

16 months agoUse new ibuf API. Use ibuf_data() and ibuf_size() instead of direct
claudio [Mon, 3 Jul 2023 11:51:27 +0000 (11:51 +0000)]
Use new ibuf API. Use ibuf_data() and ibuf_size() instead of direct
struct access and use ibuf_set_n16() to update the length field.
OK tb@

16 months agoDelete some more references to dead policy code.
tobhe [Mon, 3 Jul 2023 11:43:15 +0000 (11:43 +0000)]
Delete some more references to dead policy code.
Fixes -DNAMESPACE

ok tb@

16 months agosign_sig: test on assignment
tb [Mon, 3 Jul 2023 11:10:28 +0000 (11:10 +0000)]
sign_sig: test on assignment

16 months agosign_setup: split another check into two
tb [Mon, 3 Jul 2023 11:06:28 +0000 (11:06 +0000)]
sign_setup: split another check into two

16 months agotypo
tobhe [Mon, 3 Jul 2023 10:59:16 +0000 (10:59 +0000)]
typo

16 months agoDo not risk writing over the end of the buffer when it ends in #
nicm [Mon, 3 Jul 2023 10:48:26 +0000 (10:48 +0000)]
Do not risk writing over the end of the buffer when it ends in #
(because strchr \0 will be non-NULL), reported by Robert Morris in
GitHub issue 3610.

16 months agoUse ibuf_data() and ibuf_size() instead of accessing struct ibuf.
claudio [Mon, 3 Jul 2023 10:34:31 +0000 (10:34 +0000)]
Use ibuf_data() and ibuf_size() instead of accessing struct ibuf.
OK tb@

16 months agoUse ibuf_data() and ibuf_size() instead of accessing struct ibuf.
claudio [Mon, 3 Jul 2023 10:34:08 +0000 (10:34 +0000)]
Use ibuf_data() and ibuf_size() instead of accessing struct ibuf.
OK tb@

16 months agoSplit range checks for ECDSA r and ECDSA s
tb [Mon, 3 Jul 2023 10:21:25 +0000 (10:21 +0000)]
Split range checks for ECDSA r and ECDSA s

requested by jsing

16 months agoSwitch a couple of test from ucmp to cmp
tb [Mon, 3 Jul 2023 10:19:52 +0000 (10:19 +0000)]
Switch a couple of test from ucmp to cmp

This is confusing, as both sides involved should be unsigned. The ec
code is undecided on whether the group order can be negative. It should
never be, so lets see what happen with this slightly stricter check.

discussed with jsing

16 months agoossl_ecdsa_verify_sig(): simplify range checks
tb [Mon, 3 Jul 2023 10:16:14 +0000 (10:16 +0000)]
ossl_ecdsa_verify_sig(): simplify range checks

The checks whether r and s lie in the interval [1, order) were a bit
uglier than necessary. Clean this up.

ok beck jsing

16 months agoList variables in a somewhat more sensible order
tb [Mon, 3 Jul 2023 10:10:58 +0000 (10:10 +0000)]
List variables in a somewhat more sensible order

16 months agoIn ossl_ecdsa_verify_sig() use BN_CTX more idiomatically
tb [Mon, 3 Jul 2023 10:09:12 +0000 (10:09 +0000)]
In ossl_ecdsa_verify_sig() use BN_CTX more idiomatically

ok beck jsing

16 months agoSplit a bunch of unrelated checks
tb [Mon, 3 Jul 2023 10:06:00 +0000 (10:06 +0000)]
Split a bunch of unrelated checks

ok beck jsing

16 months agoMake ossl_ecdsa_verify_sig() single exit
tb [Mon, 3 Jul 2023 10:04:05 +0000 (10:04 +0000)]
Make ossl_ecdsa_verify_sig() single exit

ok beck jsing

16 months agoSwitch ossl_ecdsa_verify() to timingsafe_memcmp()
tb [Mon, 3 Jul 2023 09:59:20 +0000 (09:59 +0000)]
Switch ossl_ecdsa_verify() to timingsafe_memcmp()

Requested by jsing

16 months agoStreamline ossl_ecdsa_verify()
tb [Mon, 3 Jul 2023 09:55:42 +0000 (09:55 +0000)]
Streamline ossl_ecdsa_verify()

Make it single exit and use API more idiomatically and some other
cosmetics.

ok beck jsing

16 months agoUse ibuf_data() instead of direct access to ibuf->buf,
claudio [Mon, 3 Jul 2023 09:51:38 +0000 (09:51 +0000)]
Use ibuf_data() instead of direct access to ibuf->buf,
use ibuf_size() instead of direct access to ibuf->wpos,
use ibuf_left() in places where the code checks if there is enough
space left in the ibuf.
OK tb@

16 months agoUse ibuf_data() instead of directly accessing ibuf->buf.
claudio [Mon, 3 Jul 2023 09:40:47 +0000 (09:40 +0000)]
Use ibuf_data() instead of directly accessing ibuf->buf.
OK tb@

16 months agoUse ibuf_data() instead of accessing ibuf->buf directly.
claudio [Mon, 3 Jul 2023 09:38:08 +0000 (09:38 +0000)]
Use ibuf_data() instead of accessing ibuf->buf directly.
OK tb@

16 months agoExplicit parameter printing can also use get0_order()
tb [Mon, 3 Jul 2023 09:37:30 +0000 (09:37 +0000)]
Explicit parameter printing can also use get0_order()

ok beck jsing

16 months agoConvert ossl_ec_key_gen() and EC_KEY_check_key()
tb [Mon, 3 Jul 2023 09:35:26 +0000 (09:35 +0000)]
Convert ossl_ec_key_gen() and EC_KEY_check_key()

These also get the EC_GROUP_get0_order() treatment

ok beck jsing

16 months agoConvert EC_GROUP_check() to EC_GROUP_get0_order()
tb [Mon, 3 Jul 2023 09:29:55 +0000 (09:29 +0000)]
Convert EC_GROUP_check() to EC_GROUP_get0_order()

ok beck jsing

16 months agoInline two copies of EC_GROUP_order_bits()
tb [Mon, 3 Jul 2023 09:25:44 +0000 (09:25 +0000)]
Inline two copies of EC_GROUP_order_bits()

This code is way more complicated than it needs to be. Simplify. ec_bits()
was particularly stupid.

ok beck jsing

16 months agouse semicolon not comma at eol
jsg [Mon, 3 Jul 2023 09:12:05 +0000 (09:12 +0000)]
use semicolon not comma at eol
ok stsp@

16 months agofix uuid_dec_{b,l}e prototypes
jasper [Mon, 3 Jul 2023 08:53:27 +0000 (08:53 +0000)]
fix uuid_dec_{b,l}e prototypes

ok jmc@

16 months agosome minor fix up;
jmc [Mon, 3 Jul 2023 08:37:22 +0000 (08:37 +0000)]
some minor fix up;

16 months agoAnother warning fix for GCC from Thomas Klausner.
nicm [Mon, 3 Jul 2023 08:37:14 +0000 (08:37 +0000)]
Another warning fix for GCC from Thomas Klausner.

16 months agowhen shutting down a vm, handle the VM id in the same way as a VM name argument
jasper [Mon, 3 Jul 2023 08:32:20 +0000 (08:32 +0000)]
when shutting down a vm, handle the VM id in the same way as a VM name argument

ok dv@

16 months agoNuke unused label 'next:'.
krw [Mon, 3 Jul 2023 08:16:36 +0000 (08:16 +0000)]
Nuke unused label 'next:'.

16 months agoBring back no_tls1 and no_tls1_1 as undocumented silently discarded opitons
beck [Mon, 3 Jul 2023 08:03:56 +0000 (08:03 +0000)]
Bring back no_tls1 and no_tls1_1 as undocumented silently discarded opitons

While I'm here, change the no_ssl2 and no_ssl3 options to use
OPTION_DISCARD as well instead of continuing to set a no-op
option flag.

ok jsing@ tb@

16 months agotypofix lladdr in function names; OK deraadt jan
kn [Mon, 3 Jul 2023 07:40:52 +0000 (07:40 +0000)]
typofix lladdr in function names;  OK deraadt jan

16 months agoSwitch ECDSA code to using EC_GROUP_get0_order()
tb [Mon, 3 Jul 2023 07:28:05 +0000 (07:28 +0000)]
Switch ECDSA code to using EC_GROUP_get0_order()

ok jsing

16 months agoProvide internal-only EC_GROUP_get0_order()
tb [Mon, 3 Jul 2023 07:26:40 +0000 (07:26 +0000)]
Provide internal-only EC_GROUP_get0_order()

ok jsing

16 months agoBring malloc(9) and <sys/malloc.h> into sync for M_* entries, such
guenther [Mon, 3 Jul 2023 06:45:44 +0000 (06:45 +0000)]
Bring malloc(9) and <sys/malloc.h> into sync for M_* entries, such
that the former's text comes from the latter's comments.  Rationalize
capitalization, whitespace, and plural-vs-singular.  Mark things for
for automation in the future.

Prompted by loss of sync from the addition of M_IFGROUP and M_PF
Previously worked up in discussion with schwarze@ and jmc@

ok deraadt@, miod@, jmc@

16 months agoRemove the tls1.0 and 1.1 related options from the openssl(1) toolkit
beck [Mon, 3 Jul 2023 06:22:07 +0000 (06:22 +0000)]
Remove the tls1.0 and 1.1 related options from the openssl(1) toolkit

ok tb@

16 months agoThe only thing worse than treating 'return' as a function call is
krw [Mon, 3 Jul 2023 06:07:40 +0000 (06:07 +0000)]
The only thing worse than treating 'return' as a function call is
randomly mixing 'return (blah)' and 'return blah' idioms.

Nuke the '()'s. No intentional functional change.

16 months agoAnother empty line did not want to go in
tb [Mon, 3 Jul 2023 05:48:18 +0000 (05:48 +0000)]
Another empty line did not want to go in

16 months agoStop caring about tls 1.0 and 1.1.
beck [Mon, 3 Jul 2023 05:45:53 +0000 (05:45 +0000)]
Stop caring about tls 1.0 and 1.1.

Syslogd is not a tls protocol tester in any case. These tests
should not care what version of tls they use

16 months agoStop testing tls 1.0 and 1.1
beck [Mon, 3 Jul 2023 05:31:56 +0000 (05:31 +0000)]
Stop testing tls 1.0 and 1.1

They have gone behind the barn.

16 months agoTrade a pair of extra braces for a missing empty line
tb [Mon, 3 Jul 2023 05:29:03 +0000 (05:29 +0000)]
Trade a pair of extra braces for a missing empty line

16 months agoAdd button mappings for two- and three-finger clicks on clickpads.
bru [Sun, 2 Jul 2023 21:44:04 +0000 (21:44 +0000)]
Add button mappings for two- and three-finger clicks on clickpads.

Based on a proposal of tobhe@.

ok tobhe@

16 months agoSimplify allocation checks
tb [Sun, 2 Jul 2023 20:16:47 +0000 (20:16 +0000)]
Simplify allocation checks

Instead of attempting to allocate a few times and only then check all the
returned pointers for NULL, allocate and check one after the othre. This
is easier on the eyes and what we usually do.

Prompted by a report by Ilya Shipitsin

ok beck

16 months agoUse TSO and LRO on the loopback interface to transfer TCP faster.
bluhm [Sun, 2 Jul 2023 19:59:15 +0000 (19:59 +0000)]
Use TSO and LRO on the loopback interface to transfer TCP faster.

If tcplro is activated on lo(4), ignore the MTU with TCP packets.
They are passed along with the information that they have to be
chopped in case they are forwarded later.  New netstat(1) counter
shows that software LRO is in effect.  The feature is currently
turned off by default.

tested by jan@; OK claudio@ jan@

16 months agoClean up dynamic tables in OPENSSL_cleanup()
tb [Sun, 2 Jul 2023 19:52:01 +0000 (19:52 +0000)]
Clean up dynamic tables in OPENSSL_cleanup()

This is not currently done in OpenSSL, but it looks more like something
that was mised rather than desired behavior. There are some thread safety
issues here, but those are rife in this codebase anyway (although I heard
claims on some versions of this lib being "fully threadsafe").

no objection jsing

16 months agoall platforms, kernel: remove __HAVE_CLOCKINTR symbol
cheloha [Sun, 2 Jul 2023 19:02:27 +0000 (19:02 +0000)]
all platforms, kernel: remove __HAVE_CLOCKINTR symbol

Every platform made the clockintr switch at least six months ago.
The __HAVE_CLOCKINTR symbol is now redundant.  Remove it.

Prompted by claudio@.

Link: https://marc.info/?l=openbsd-tech&m=168826181015032&w=2
"makes sense" mlarkin@

16 months agoDisable TLS 1.0 and TLS 1.1 in libssl
beck [Sun, 2 Jul 2023 17:21:32 +0000 (17:21 +0000)]
Disable TLS 1.0 and TLS 1.1 in libssl

Their time has long since past, and they should not be used.
This change restricts ssl to versions 1.2 and 1.3, and changes
the regression tests to understand we no longer speak the legacy
protocols.

For the moment the magical "golden" byte for byte comparison
tests of raw handshake values are disabled util jsing fixes them.

ok jsing@ tb@

16 months agoConvert some tables to C99 initializers
tb [Sun, 2 Jul 2023 17:12:17 +0000 (17:12 +0000)]
Convert some tables to C99 initializers

ok & "happy pirate day" beck

16 months agoFix return values of ecx methods
tb [Sun, 2 Jul 2023 15:02:52 +0000 (15:02 +0000)]
Fix return values of ecx methods

It is hard to get your return values right if you choose them to be a
random subset of {-2, ..., 3}. The item_verify() and the digestverify()
methods don't return 0 on error, but -1. Here 0 means "failed to verify",
obviously.

ok jsing

16 months agoDemacro SHA-512.
jsing [Sun, 2 Jul 2023 14:57:58 +0000 (14:57 +0000)]
Demacro SHA-512.

Use static inline functions instead of macros to implement SHA-512. At
the same time, make two key changes - firstly, rather than trying to
outsmart the compiler and shuffle variables around, write the algorithm
the way it is documented and actually swap the variable contents. Secondly,
instead of interleaving the message schedule update and the round, do the
full message schedule update first, then process the round.

Overall, we get safer and more readable code. Additionally, the compiler
can generate smaller and faster code (with a gain of 5-10% across a range
of architectures).

ok beck@ tb@

16 months agoFix typo in previous
tb [Sun, 2 Jul 2023 14:54:37 +0000 (14:54 +0000)]
Fix typo in previous

16 months agoUse asprintf() to avoid repetition in string constants
tb [Sun, 2 Jul 2023 14:53:18 +0000 (14:53 +0000)]
Use asprintf() to avoid repetition in string constants

... since ASN1_bn_print() is stupid.

ok jsing

16 months agoSplit ECPKParameters_print()
tb [Sun, 2 Jul 2023 13:48:47 +0000 (13:48 +0000)]
Split ECPKParameters_print()

This function has two entirely independent parts, so instead of a huge
if/else just use two functions. In ecpk_print_explicity parameters() do
some additional boring cleanup such as switching to actually using the
local BN_CTX and shuffling things into a slightly more sensible order.

ok jsing

16 months agoSwitch sign_sig() and sign_setup() to using BN_CTX
tb [Sun, 2 Jul 2023 13:37:09 +0000 (13:37 +0000)]
Switch sign_sig() and sign_setup() to using BN_CTX

Both these functions use a BN_CTX internally to deal with the EC API
that usually requires one. However, they don't actually make use of it.
Get the BIGNUMs from the BN_CTX instead, which simplifies the cleanup.
Also defer allocation of the ECDSA_SIG to the very end. Instead of using
its internal r and s, use two local r and s variables and transfer those
to the ECDSA_SIG on success.

ok beck jsing

16 months agolost silence_children behavior by accident
espie [Sun, 2 Jul 2023 13:33:10 +0000 (13:33 +0000)]
lost silence_children behavior by accident
add a hook to compute the exit_code in more fun ways

16 months agoRevert hunk accidentally committed in r1.39
tb [Sun, 2 Jul 2023 13:26:36 +0000 (13:26 +0000)]
Revert hunk accidentally committed in r1.39

16 months agoRework handling of the out_kinv and out_r pointers
tb [Sun, 2 Jul 2023 13:18:54 +0000 (13:18 +0000)]
Rework handling of the out_kinv and out_r pointers

suggested by jsing