openbsd
3 years agoAdjust HTTP client code a bit. Add support for 304 Not Modified responses,
claudio [Thu, 25 Mar 2021 12:18:45 +0000 (12:18 +0000)]
Adjust HTTP client code a bit. Add support for 304 Not Modified responses,
remove handling of 206 Partial Content (the client does not use range
headers). Report the Last-Modified timestamp back to the requestor and
switch OK to a enum value for (FAIL, OK and NOT MODIFIED).
OK tb@

3 years agoProvide apm(4/arm64) with battery information
kn [Thu, 25 Mar 2021 12:18:27 +0000 (12:18 +0000)]
Provide apm(4/arm64) with battery information

apm merely provides an all zero/unknown stub for those values, e.g. apm(8)
output is useless.

Hardware sensors however provide this information:

hw.sensors.cwfg0.volt0=3.76 VDC (battery voltage)
hw.sensors.cwfg0.raw0=259 (battery remaining minutes)
hw.sensors.cwfg0.percent0=58.00% (battery percent)

Make cwfg(4) copy those over using apm_setinfohook() for apm to show it:

Battery state: high, 58% remaining, 259 minutes life estimate
A/C adapter state: not known
Performance adjustment mode: auto (408 MHz)

In cwfg's update routine, to keep values coherent, always reset them to
zero/unknown and only set those that came from a valid reading.

Input OK jca

3 years agoAdjust base64_decode() to just take a base64 string as input instead of
claudio [Thu, 25 Mar 2021 09:27:38 +0000 (09:27 +0000)]
Adjust base64_decode() to just take a base64 string as input instead of
a string plus length. Preparation work for RRDP.
OK tb@

3 years agoAvoid mangled output in BIO_debug_callback
tb [Thu, 25 Mar 2021 09:26:17 +0000 (09:26 +0000)]
Avoid mangled output in BIO_debug_callback

Instead of blindly skipping 14 characters, we can use the return
value of snprintf() to determine how much we should skip.

From Martin Vahlensieck with minor tweaks by me

3 years agoremove uneeded includes in md armv7 files
jsg [Thu, 25 Mar 2021 04:12:00 +0000 (04:12 +0000)]
remove uneeded includes in md armv7 files

based on include-what-you-use suggestions

3 years agoSync correct ROUNDUP() from net/route.c
tobhe [Thu, 25 Mar 2021 01:39:09 +0000 (01:39 +0000)]
Sync correct ROUNDUP() from net/route.c

3 years agoThe server only sends a cookie during a HRR, not a SH
tb [Wed, 24 Mar 2021 21:36:26 +0000 (21:36 +0000)]
The server only sends a cookie during a HRR, not a SH

3 years agotest HEAD requests, from niklas@
benno [Wed, 24 Mar 2021 21:03:06 +0000 (21:03 +0000)]
test HEAD requests, from niklas@

3 years agoResponses to HEAD requests must not have a message body (even though they have
benno [Wed, 24 Mar 2021 20:59:53 +0000 (20:59 +0000)]
Responses to HEAD requests must not have a message body (even though they have
a Content-Length header).  HTTP RFC 7231 section 4.3.2.
found by niklas@, claudio@ agrees.

3 years agoUpdate regress for new_cipher rename.
jsing [Wed, 24 Mar 2021 19:02:35 +0000 (19:02 +0000)]
Update regress for new_cipher rename.

3 years agoAdd mouse.tp.tapping example.
bru [Wed, 24 Mar 2021 18:50:54 +0000 (18:50 +0000)]
Add mouse.tp.tapping example.

ok kn@

3 years agosync
sthen [Wed, 24 Mar 2021 18:49:40 +0000 (18:49 +0000)]
sync

3 years agoremove vendor name (Dell) repeated in product name
sthen [Wed, 24 Mar 2021 18:49:25 +0000 (18:49 +0000)]
remove vendor name (Dell) repeated in product name

3 years agoRename new_cipher to cipher.
jsing [Wed, 24 Mar 2021 18:43:59 +0000 (18:43 +0000)]
Rename new_cipher to cipher.

This is in the SSL_HANDSHAKE struct and is what we're currently
negotiating, so there is really nothing more "new" about the cipher
than there is the key block or other parts of the handshake data.

ok inoguchi@ tb@

3 years agoAdd SSL_HANDSHAKE_TLS12 for TLSv1.2 specific handshake data.
jsing [Wed, 24 Mar 2021 18:40:03 +0000 (18:40 +0000)]
Add SSL_HANDSHAKE_TLS12 for TLSv1.2 specific handshake data.

Move TLSv1.2 specific components over from SSL_HANDSHAKE.

ok inoguchi@ tb@

3 years agoImprove the tap detection mechanism.
bru [Wed, 24 Mar 2021 18:28:24 +0000 (18:28 +0000)]
Improve the tap detection mechanism.

Revision 1.29 of wstpad.c has removed the 'maxdist' checks
for multi-finger taps.  While this change makes tap detection
more reliable, and does not affect inputs intended for pointer
movement, it might interfere with short scroll gestures.
This version reorganizes the filtering code, and reintroduces
a weaker version of those checks for MT touchpads.

3 years agocd9660, mfs: do not hide generic vop functions behind #define
semarie [Wed, 24 Mar 2021 16:17:05 +0000 (16:17 +0000)]
cd9660, mfs: do not hide generic vop functions behind #define

It makes clearer which vop functions are real fileystem-implementations and which one are only stubs.

No functional changes are intented.

ok visa@

3 years agomake some `struct vops' members explicitly NULL instead of implicitly NULL
semarie [Wed, 24 Mar 2021 16:11:32 +0000 (16:11 +0000)]
make some `struct vops' members explicitly NULL instead of implicitly NULL

ok mpi@

3 years agoMore timespec conversions. Less 'seconds' arithmetic.
krw [Wed, 24 Mar 2021 16:04:10 +0000 (16:04 +0000)]
More timespec conversions. Less 'seconds' arithmetic.

3 years agoThe logic in mmrw() to check whether an address is within direct
bluhm [Wed, 24 Mar 2021 14:26:39 +0000 (14:26 +0000)]
The logic in mmrw() to check whether an address is within direct
map was the wrong way around.  The && prevented an EFAULT error and
could pass userland addresses as kernel source to copyout(9).  The
kernel could crash with protection fault due to an invalid offset
when reading /dev/kmem.
Also make the range checks stricter.  Not only the start address
must be valid, but also the end address must be within the region
to be copied.
Note that sysctl kern.allowkmem=0 makes the bug unreachable by
default.
OK deraadt@

3 years agoConvert openssl(1) x509 option handling
inoguchi [Wed, 24 Mar 2021 12:09:16 +0000 (12:09 +0000)]
Convert openssl(1) x509 option handling

Apply new option handling to openssl(1) x509.
To handle incremental order value, using newly added OPTION_ORDER.

I left the descriptions for -CAform, -inform, and -outform as it was,
for now. These description would be fixed.
And digest option handler could be consolidated to one between
some subcommands in the future.

ok and comments from tb@,
and "I'd move forward with your current plan." from jsing@

3 years agoAdd option type OPTION_ORDER
inoguchi [Wed, 24 Mar 2021 12:07:39 +0000 (12:07 +0000)]
Add option type OPTION_ORDER

To handle incremental order value, added new option type OPTION_ORDER.
openssl(1) x509 requires this option handling, since,
- -CA and -signkey require to set both filename and incremental 'num'.
- -dates requires to set two variables in a row, startdate and enddate.
and this couldn't be solved by OPTION_FLAG_ORD.

ok tb@ and "I'd move forward with your current plan." from jsing@

3 years agoMake tap detection less restrictive for multi-finger taps.
bru [Wed, 24 Mar 2021 07:40:37 +0000 (07:40 +0000)]
Make tap detection less restrictive for multi-finger taps.

In order to distinguish tap gestures from short movements, the mechanism
checks whether the distance between the first and the last position of a
touch exceeds the 'maxdist' limit.  Some touchpads provide unreliable
coordinates when more than one contact is being made simultaneously, and
in this case the filter may be too strong - and superfluous, because only
one-finger contacts should trigger pointer movement.

3 years agoDefine a USB quirk for devices that need to keep their pipes open at
jcs [Wed, 24 Mar 2021 02:49:57 +0000 (02:49 +0000)]
Define a USB quirk for devices that need to keep their pipes open at
all times, before the device is enabled and after the device is
disabled by wscons.

This was originally needed by umt for the Microsoft Surface Type
Cover to avoid it resetting (or at least detaching and reattaching)
when the touchpad was touched while at the console.

A similar problem occurs with the Pinebook Pro's keyboard when
switching from X to the console due to the touchpad getting
disabled, so add it to ums as well.

with and ok kurt

3 years agoregen
jcs [Wed, 24 Mar 2021 02:21:40 +0000 (02:21 +0000)]
regen

3 years agoadd HAILUCK Keyboard
jcs [Wed, 24 Mar 2021 02:20:44 +0000 (02:20 +0000)]
add HAILUCK Keyboard

from kurt

3 years agoensure the long-name version of ld is in the base set (rather than the
deraadt [Wed, 24 Mar 2021 00:27:34 +0000 (00:27 +0000)]
ensure the long-name version of ld is in the base set (rather than the
comp set), as it is supposed to be hard-linked.
found by Yoshihiro Kawamata

3 years agoFix some ranges and type handling.
martijn [Tue, 23 Mar 2021 22:07:36 +0000 (22:07 +0000)]
Fix some ranges and type handling.

OK sthen@

3 years agoAdd DisplayString/SnmpAdminString in accordance with recent OPENBSD-PF-MIB
martijn [Tue, 23 Mar 2021 22:05:21 +0000 (22:05 +0000)]
Add DisplayString/SnmpAdminString in accordance with recent OPENBSD-PF-MIB
changes.

OK sthen@

3 years agoDon't send DELETE notify if IKE SA is replaced because of
tobhe [Tue, 23 Mar 2021 21:31:29 +0000 (21:31 +0000)]
Don't send DELETE notify if IKE SA is replaced because of
'enforcesingleikesa'.  Fixes an interop problem with strongswan
if make-before-break is enabled.

ok patrick@

3 years agoOCSP_basic_verify() doesn't set errno, so use tls_set_errorx()
tb [Tue, 23 Mar 2021 20:04:29 +0000 (20:04 +0000)]
OCSP_basic_verify() doesn't set errno, so use tls_set_errorx()

ok inoguchi

3 years agochange pfIfDescr and pfLogIfName from plain OCTET STRING (which has no
sthen [Tue, 23 Mar 2021 19:37:51 +0000 (19:37 +0000)]
change pfIfDescr and pfLogIfName from plain OCTET STRING (which has no
textual-convention so is sometimes printed as hex dump) to DisplayString
(ascii).

likewise change pfLabelName and pfTblName to SnmpAdminString (UTF-8
textual-convention).

feedback/tweaks (notably pointing out UTF-8)/ok martijn@

3 years agoUse a pointer called bufp to point to a buffer called bufn
lum [Tue, 23 Mar 2021 18:40:29 +0000 (18:40 +0000)]
Use a pointer called bufp to point to a buffer called bufn
consistantly.

3 years agoCorrect how many arguments some functions take for interpreter.c.
lum [Tue, 23 Mar 2021 18:33:05 +0000 (18:33 +0000)]
Correct how many arguments some functions take for interpreter.c.

3 years agoUse time_t for intermediate lease time values when calculating human
florian [Tue, 23 Mar 2021 17:46:20 +0000 (17:46 +0000)]
Use time_t for intermediate lease time values when calculating human
readable output for very long timeouts to prevent overflow.
While here add years and days.
Days might actually show up in normal leases. Years is to catch
"infinity" which is encoded as UINT32_MAX and used by vmd(8).
Previously we would overflow, wrap to negative which then got
transformed to 0s.
Pointed out by Dave Voutila while working on the vmd(8) dhcp code.

3 years agoTimed out RSA key ops, may leave uncalled for responses in the imsg return
claudio [Tue, 23 Mar 2021 16:34:31 +0000 (16:34 +0000)]
Timed out RSA key ops, may leave uncalled for responses in the imsg return
path.  These have to be dropped or every subsequent call will cause decrypt
errors. Use a sequence number cookie to keep the systems in sync.
Diff from niklas@ with some minor adjustments by myself.

3 years agoDocument SIOCGIFADDR and SIOCSIFADDR ioctls for tap devices.
claudio [Tue, 23 Mar 2021 16:26:53 +0000 (16:26 +0000)]
Document SIOCGIFADDR and SIOCSIFADDR ioctls for tap devices.
OK kn@

3 years agoMake a parameter to an mg function not throw an error just
lum [Tue, 23 Mar 2021 15:22:25 +0000 (15:22 +0000)]
Make a parameter to an mg function not throw an error just
because it is numerical.

3 years agoDocument the @version suffix that can be added when running 'portgen go'
abieber [Tue, 23 Mar 2021 13:22:16 +0000 (13:22 +0000)]
Document the @version suffix that can be added when running 'portgen go'

Patch from Josh Rickmar. Ty jrick!

3 years agoFix a corner case bug in Rx block ack window gap-wait timeout handling.
stsp [Tue, 23 Mar 2021 12:03:44 +0000 (12:03 +0000)]
Fix a corner case bug in Rx block ack window gap-wait timeout handling.

If ieee80211_input_ba_flush() was called when there was nothing to flush,
the (already pending) gap wait timeout was re-armed.
This is only correct if we flush at least one packet. Otherwise packets
that arrive at a constant rate of about 4-5 packets per second would
extend the gap-wait timeout until the block ack window fills up.
In extreme cases this can result in packets being queued for almost 20s.

Fix this by returning immediately from ieee80211_input_ba_flush() if
the first packet in the reordering buffer is missing.
This prevents the timeout from being re-armed.

Patch by Christian Ehrhardt. Tested by me on iwm(4) 7265.

3 years agoWhen moving the Rx block ack window forward do not implicitly rely on
stsp [Tue, 23 Mar 2021 11:58:38 +0000 (11:58 +0000)]
When moving the Rx block ack window forward do not implicitly rely on
ieee80211_input_ba_flush() for updating ba->ba_winend.

Required for an upcoming ieee80211_input_ba_flush() fix.

Patch by Christian Ehrhardt who found one instance of this problem in
ieee80211_input_ba_seq(). I spotted another in ieee80211_ba_move_window().

3 years agoMake a child execute fork_return() only if PTRACE_FORK has been specified.
mpi [Tue, 23 Mar 2021 10:30:40 +0000 (10:30 +0000)]
Make a child execute fork_return() only if PTRACE_FORK has been specified.

fork_return() does an additional check to send a SIGTRAP (for a debugger)
but this signal might overwrite the SIGSTOP generated by the parent doing
a PT_ATTACH before the child has a change to execute any instruction.

Prevent a race visible only on SP system with regress/sys/kern/ptrace2.

ok kettenis@

3 years agoSkip first frame when saving stacktraces, it's always witness_checkorder().
mpi [Tue, 23 Mar 2021 10:22:20 +0000 (10:22 +0000)]
Skip first frame when saving stacktraces, it's always witness_checkorder().

ok visa@

3 years agoPack the SPCR struct definition since the struct isn't naturally aligned
patrick [Tue, 23 Mar 2021 09:41:12 +0000 (09:41 +0000)]
Pack the SPCR struct definition since the struct isn't naturally aligned
or padded, and hence e. g. the access to the PCI vendor/device id would be
broken.  The structs for the other tables all seem to be packed as well.

ok kettenis@

3 years agoNow that MSI pages are properly mapped, all that debug code in smmu(4)
patrick [Mon, 22 Mar 2021 20:34:45 +0000 (20:34 +0000)]
Now that MSI pages are properly mapped, all that debug code in smmu(4)
can be removed.  The only thing left to implement for smmu(4) to work
out of the box with PCIe devices is to reserve the PCIe MMIO windows.
Let's see how we can do this properly.

3 years agoDon't leak ca in test_cms_sign_verify().
tb [Mon, 22 Mar 2021 20:31:34 +0000 (20:31 +0000)]
Don't leak ca in test_cms_sign_verify().

Reported by Ilya Shipitsin

3 years agoLoad MSI pages through bus_dma(9). Our interrupt controllers for MSIs
patrick [Mon, 22 Mar 2021 20:30:21 +0000 (20:30 +0000)]
Load MSI pages through bus_dma(9).  Our interrupt controllers for MSIs
typically pass the physical address, however retrieved, to our PCIe
controller code.  This physical address can in practise be directly
given to the PCIe, but it is not a given that the CPU and the PCIe
controller are able to use the same physical addresses.

This is even more obvious with an smmu(4) inbetween, which can change
the world view by introducing I/O virtual addresses.  Hence for this
it is indeed necessary to map those pages, which thanks to integration
with bus_dma(9) works easily.

For this we remember the PCI devices' DMA tag in the interrupt handle
during the MSI map, so that we can use the smmu(4)-hooked DMA tag to
load the physical address.

While some systems might prefer to implement "trapping" pages for MSIs,
to make sure devices cannot trigger other devices' interrupts, we only
make sure the whole page is mapped.

Having the IOMMU create a mapping for each MSI is a bit wasteful, but
for now it's the simplest way to implement it.

Discussed with and ok kettenis@

3 years agoPlug a few memory leaks reported by Ilya Shipitsin
tb [Mon, 22 Mar 2021 20:05:21 +0000 (20:05 +0000)]
Plug a few memory leaks reported by Ilya Shipitsin

3 years agoProperly reflect stopping state
kn [Mon, 22 Mar 2021 18:50:11 +0000 (18:50 +0000)]
Properly reflect stopping state

Diff from Preben Guldberg < preben at guldberg dot org>, thanks!

In "vmctl status", VMs that are being stopped but are still running
will simply show up as "running".

Give preference to showing the "stopping" state akin to how a paused
VM is handled.

Tested by Dave Voutila
OK tb

3 years agoUpdate device-tree bindings
kn [Mon, 22 Mar 2021 18:37:26 +0000 (18:37 +0000)]
Update device-tree bindings

Using the DTB from our dtb package this driver no longer attaches
(on a Pinebook Pro)due to renamed bindings:
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml

Thanks to kettenis and patrick for pointing this out.

Follow upstream's rename and acccount for the monitor interval now being
milliseconds not seconds anymore.

This makes cwfg(4) export values under hw.sensors as expected when using
/usr/local/share/dtb/arm64/rockchip/rk3399-pinebook-pro.dtb .

Input patrick kettenis
OK kettenis

3 years agoBOOTP has a minimum packet length of 300 bytes. Since DHCP is
florian [Mon, 22 Mar 2021 16:28:25 +0000 (16:28 +0000)]
BOOTP has a minimum packet length of 300 bytes. Since DHCP is
interoperable with BOOTP we should also send packets that have a
minimum size of 300.
I haven't seen a DHCP server that actually enforces this except the
one in vmd(8), but it doesn't cost us much and prevents hair pulling
later on when we find one in the wild.
OK deraadt

3 years agoAvoid overflow by writing x = (y * 7) / 8 as x = y - (y / 8); ok florian
otto [Mon, 22 Mar 2021 15:34:07 +0000 (15:34 +0000)]
Avoid overflow by writing x = (y * 7) / 8 as x = y - (y / 8); ok florian

3 years agoRemove unveil() from the rsync_sender() and flist_gen(). The sender is
claudio [Mon, 22 Mar 2021 11:49:15 +0000 (11:49 +0000)]
Remove unveil() from the rsync_sender() and flist_gen(). The sender is
not able to properly unveil itself because you can request many files
as arguments. At the same time the sender is read-only and uses rpath
pledge() so the gain from unveil() is less of an issue.
On the receiver side all files land in one directory and this part still
uses unveil() to protect rsync to somehow walk out of the destination
directory.
From kristaps@

3 years agoAdjust function name in error strings.
claudio [Mon, 22 Mar 2021 11:26:44 +0000 (11:26 +0000)]
Adjust function name in error strings.
From kristaps@

3 years agoAdjust a type to unsigned since the io function works on unsigned ints.
claudio [Mon, 22 Mar 2021 11:25:29 +0000 (11:25 +0000)]
Adjust a type to unsigned since the io function works on unsigned ints.
Also the id is a strictly positve integer so this make sense.
Cleanup comments and a spacing while there.
From kristaps@

3 years agoPut comment where it belongs also remove an assert() that checks for an
claudio [Mon, 22 Mar 2021 11:20:04 +0000 (11:20 +0000)]
Put comment where it belongs also remove an assert() that checks for an
impossible condition. The map argument is from a pread() call and can never
be MAP_FAILED.
From kristaps@

3 years agoCompare explicitly against NULL.
claudio [Mon, 22 Mar 2021 11:16:05 +0000 (11:16 +0000)]
Compare explicitly against NULL.
From kristaps@

3 years agoMake fmt argument const. Format local vars a bit.
claudio [Mon, 22 Mar 2021 11:14:42 +0000 (11:14 +0000)]
Make fmt argument const. Format local vars a bit.
From kristaps@

3 years agoLet iwn(4) simply clear frames before the firmware's BA window, instead
stsp [Mon, 22 Mar 2021 09:52:49 +0000 (09:52 +0000)]
Let iwn(4) simply clear frames before the firmware's BA window, instead
of trying to be smart and clearing already acknowledged frames which are
still within the firmware's BA window.

This matches what the Linux driver does and makes our driver code simpler.

Also, Tx rate control code relies on sequence numbers falling into the
BA window so let's skip Tx rate control for frames before this window.

Tested by:
myself on 6205 and 6300
afresh1, bluhm, and paco on 6300
jmatthew on 5100
Balder Oddson on 6205

3 years agoStart the move to TAILQ for expressions instead of an SLIST.
lum [Mon, 22 Mar 2021 09:26:23 +0000 (09:26 +0000)]
Start the move to TAILQ for expressions instead of an SLIST.

3 years agodocument NEVER_CLEAN
espie [Mon, 22 Mar 2021 07:34:34 +0000 (07:34 +0000)]
document NEVER_CLEAN

3 years agoThe tag comes after iface in iked.conf(5).
tobhe [Sun, 21 Mar 2021 22:18:00 +0000 (22:18 +0000)]
The tag comes after iface in iked.conf(5).

3 years agoFully initialize rrec in tls12_record_layer_open_record_protected
tb [Sun, 21 Mar 2021 19:08:22 +0000 (19:08 +0000)]
Fully initialize rrec in tls12_record_layer_open_record_protected

The CBC code path initializes rrec.padding_length in an indirect fashion
and later makes use of it for copying the MAC. This is confusing some
static analyzers as well as people investigating the whining. Avoid this
confusion and add a bit of robustness by clearing the stack variable up
front.

ok jsing

3 years agoRevise regress to match handshake struct changes.
jsing [Sun, 21 Mar 2021 18:37:26 +0000 (18:37 +0000)]
Revise regress to match handshake struct changes.

3 years agoMove the TLSv1.3 handshake struct inside the shared handshake struct.
jsing [Sun, 21 Mar 2021 18:36:34 +0000 (18:36 +0000)]
Move the TLSv1.3 handshake struct inside the shared handshake struct.

There are currently three different handshake structs that are in use -
the SSL_HANDSHAKE struct (as S3I(s)->hs), the SSL_HANDSHAKE_TLS13 struct
(as S3I(s)->hs_tls13 or ctx->hs in the TLSv1.3 code) and the infamous
'tmp' embedded in SSL3_STATE_INTERNAL (as S3I(s)->tmp)).

This is the first step towards cleaning up the handshake structs so that
shared data is in the SSL_HANDSHAKE struct, with sub-structs for TLSv1.2
and TLSv1.3 specific information. Place SSL_HANDSHAKE_TLS13 inside
SSL_HANDSHAKE and change ctx->hs to refer to the SSL_HANDSHAKE struct
instead of the SSL_HANDSHAKE_TLS13 struct. This allows the TLSv1.3 code
to access the shared handshake data without needing the SSL struct.

ok inoguchi@ tb@

3 years agoUse new terminology of RFC 8981 and (mechanically) replace "privacy"
florian [Sun, 21 Mar 2021 18:25:24 +0000 (18:25 +0000)]
Use new terminology of RFC 8981 and (mechanically) replace "privacy"
with "temporary".

3 years agowg(4): fix race between tx/rx handshakes, from Matt Dunwoodie, ok mpi@
sthen [Sun, 21 Mar 2021 18:13:59 +0000 (18:13 +0000)]
wg(4): fix race between tx/rx handshakes, from Matt Dunwoodie, ok mpi@

"There is a race between sending/receiving handshake packets. This
occurs if we consume an initiation, then send an initiation prior to
replying to the consumed initiation.

In particular, when consuming an initiation, we don't generate the
index until creating the response (which is incorrect). If we attempt
to create an initiation between these processes, we drop any
outstanding handshake which in this case has index 0 as set when
consuming the initiation.

The fix attached is to generate the index when consuming the initiation
so that any spurious initiation creation can drop a valid index. The
patch also consolidates setting fields on the handshake."

3 years agoSplit TLSv1.3 record protection from record layer.
jsing [Sun, 21 Mar 2021 17:25:17 +0000 (17:25 +0000)]
Split TLSv1.3 record protection from record layer.

This makes the TLSv1.2 and TLSv1.3 record layers more consistent and while
it is not currently necessary from a functionality perspective, it makes
for more readable and simpler code.

ok inoguchi@ tb@

3 years agoBuild options regress with -DLIBRESSL_INTERNAL.
jsing [Sun, 21 Mar 2021 17:22:37 +0000 (17:22 +0000)]
Build options regress with -DLIBRESSL_INTERNAL.

This is currently needed for DTLS1_2_VERSION, however it should be used
here regardless.

3 years agoAvoid a use-after-scope in tls13_cert_add().
jsing [Sun, 21 Mar 2021 16:56:42 +0000 (16:56 +0000)]
Avoid a use-after-scope in tls13_cert_add().

A parent CBB retains a reference to a child CBB until CBB_flush() or
CBB_cleanup() is called. As such, the cert_exts CBB must be at function
scope.

Reported by Ilya Shipitsin.

ok tb@

3 years agoInclude wstpad allocations when cleaning up wsmouse resources.
bru [Sun, 21 Mar 2021 16:20:49 +0000 (16:20 +0000)]
Include wstpad allocations when cleaning up wsmouse resources.

ok gnezdo@

3 years agoDisambiguate expressions.
visa [Sun, 21 Mar 2021 14:18:37 +0000 (14:18 +0000)]
Disambiguate expressions.

3 years agoPlug memory leak reported by Ilya Shipitsin
tb [Sun, 21 Mar 2021 14:06:29 +0000 (14:06 +0000)]
Plug memory leak reported by Ilya Shipitsin

Since r1.7, input in base64_decoding_test() is allocated unconditionally,
so free it unconditionally.

3 years agoDon't warn that we can't form a temporary address when a router
florian [Sun, 21 Mar 2021 13:59:22 +0000 (13:59 +0000)]
Don't warn that we can't form a temporary address when a router
deprecates a prefix by sending a pltime of 0, this is normal.
Continue warning when the pltime is smaller than 5 as this is almost
certainly a configuration error.
Found the hard way by & OK otto.

3 years agoAdd quoted strings capability in list values, no special chars
lum [Sun, 21 Mar 2021 12:56:16 +0000 (12:56 +0000)]
Add quoted strings capability in list values, no special chars
detection in between them though.  Add limitation to characters
allowed in symbol names, equivalent to mg function names (A-Za-z-),
quite restrictive but can grow of course. If value is not quoted and
is not a variable, give an error.

3 years agomakes `struct execsw' to:
semarie [Sun, 21 Mar 2021 11:29:38 +0000 (11:29 +0000)]
makes `struct execsw' to:

- use C99-style initialization (grep works better with that)
- use const as execsw is not modified during runtime

ok mpi@

3 years agoUse uppercases for defines.
mpi [Sun, 21 Mar 2021 10:24:36 +0000 (10:24 +0000)]
Use uppercases for defines.

No functional change.

ok semarie@

3 years agoadd -n to SYNOPSIS;
jmc [Sun, 21 Mar 2021 06:44:24 +0000 (06:44 +0000)]
add -n to SYNOPSIS;

3 years agoAdd -n (no action) mode, which just parses the program and exits.
jmatthew [Sun, 21 Mar 2021 01:24:35 +0000 (01:24 +0000)]
Add -n (no action) mode, which just parses the program and exits.

ok mpi@ kn@

3 years agos/struft/struct/; thanks James Hastings
sthen [Sat, 20 Mar 2021 21:02:56 +0000 (21:02 +0000)]
s/struft/struct/; thanks James Hastings

3 years agoSync with apm(4/macppc) to document which ioctls are not supported
kn [Sat, 20 Mar 2021 19:41:44 +0000 (19:41 +0000)]
Sync with apm(4/macppc) to document which ioctls are not supported

Suspend/resume and other power events are NOT YET SUPPORTED.

3 years agoLooking at loading all expressions initially, working towards multi
lum [Sat, 20 Mar 2021 19:39:30 +0000 (19:39 +0000)]
Looking at loading all expressions initially, working towards multi
line. Next to look at "values" (quotes around values).

Current regress tests pass.

3 years agoEnd sentence and add .Pp after (all) "NOT SUPPORTED" lines
kn [Sat, 20 Mar 2021 19:36:29 +0000 (19:36 +0000)]
End sentence and add .Pp after (all) "NOT SUPPORTED" lines

3 years agoRFC 8981 allows the configuration of only temporary IPv6 addresses.
florian [Sat, 20 Mar 2021 17:11:49 +0000 (17:11 +0000)]
RFC 8981 allows the configuration of only temporary IPv6 addresses.
Keep "temporary" the default when setting inet6 autoconf but make it
possible to disable the "autoconf" flag but keep "temporary" enabled.
The normal usecase to only have temporary autoconf addresses would be
"inet6 temporary" in hostname.if
OK kn

3 years agoRFC 8981 allows the configuration of only temporary IPv6 addresses.
florian [Sat, 20 Mar 2021 17:08:57 +0000 (17:08 +0000)]
RFC 8981 allows the configuration of only temporary IPv6 addresses.
Make the interface come up when the IFXF_AUTOCONF6TEMP is set.
OK kn

3 years agoRFC 8981 allows the configuration of only temporary IPv6 addresses.
florian [Sat, 20 Mar 2021 17:07:49 +0000 (17:07 +0000)]
RFC 8981 allows the configuration of only temporary IPv6 addresses.
Track autoconf and temporary flag individually to be able to support
this.
OK kn

3 years agoFix SMALL build when done from sbin/slaacd
kn [Sat, 20 Mar 2021 16:46:03 +0000 (16:46 +0000)]
Fix SMALL build when done from sbin/slaacd

distrib/special/slaccd is the actual SMALL user but having it build from here
is useful, too;  in fact, it showed some more unused variables under SMALL.

OK florian

3 years agoSKIP_PROPOSAL has been ripped out in 2019
kn [Sat, 20 Mar 2021 16:36:52 +0000 (16:36 +0000)]
SKIP_PROPOSAL has been ripped out in 2019

3 years agotypo
tb [Sat, 20 Mar 2021 12:17:45 +0000 (12:17 +0000)]
typo

3 years agonamei: reorganize a bit the error path for simples cases
semarie [Sat, 20 Mar 2021 11:26:07 +0000 (11:26 +0000)]
namei: reorganize a bit the error path for simples cases

- move 'fail' label to end of function (instead of using the first
  if-condition)

- merge the most simples error code paths idioms from 'cleanup+return'
  to 'goto-fail'

ok mpi@

3 years agoSync some comments in order to reduce the difference with NetBSD.
mpi [Sat, 20 Mar 2021 10:24:21 +0000 (10:24 +0000)]
Sync some comments in order to reduce the difference with NetBSD.

No functionnal change.

ok kettenis@

3 years agoAdd a 'batch' mode to mg via the '-b' command line option which will
lum [Sat, 20 Mar 2021 09:00:49 +0000 (09:00 +0000)]
Add a 'batch' mode to mg via the '-b' command line option which will
initialise a pty, run the specified file of mg commands and then exit.

This is to facilitate mg fitting into the OpenBSD regress test
framework and be able to run via a cron job.

3 years agoAdd new test-tls13-multiple-ccs-messages.py
tb [Sat, 20 Mar 2021 08:12:53 +0000 (08:12 +0000)]
Add new test-tls13-multiple-ccs-messages.py

This is a test that checks for NSS's CCS flood DoS CVE-2020-25648.
The test script currently fails on LibreSSL and OpenSSL 1.1.1j because
it sends invalid records with version 0x0300 instead of 0x0303.
We have the ccs_seen logic corresponding to NSS's fix:
https://hg.mozilla.org/projects/nss/rev/57bbefa793232586d27cee83e74411171e128361
but we do allow up to two CCS due to an interop issue with Fizz, so
at least one of the tests will likey be broken once the record version
is fixed.

3 years agouse m_dup_pkthdr in ip_fragment to copy pkthdr info to fragments.
dlg [Sat, 20 Mar 2021 01:15:28 +0000 (01:15 +0000)]
use m_dup_pkthdr in ip_fragment to copy pkthdr info to fragments.

this ensures more stuff is copied, in particular the flowid
information. this is also how v6 does it, which makes things more
consistent.

ok bluhm@

3 years agoRemove libLLVM.so.2.0 on upgrade
kn [Fri, 19 Mar 2021 23:52:55 +0000 (23:52 +0000)]
Remove libLLVM.so.2.0 on upgrade

It is over a year old and corresponds to LLVM 8.0.0 after the
"-msvr4-struct-return" ABI change;  saves 47M (on amd64).

OK deraadt

3 years agoPrepare documenting SSL_use_certificate_chain_file
tb [Fri, 19 Mar 2021 20:31:49 +0000 (20:31 +0000)]
Prepare documenting SSL_use_certificate_chain_file

3 years agoUndo previous. As pointed out by jsing I clearly wasn't fully awake...
tb [Fri, 19 Mar 2021 19:52:55 +0000 (19:52 +0000)]
Undo previous. As pointed out by jsing I clearly wasn't fully awake...

3 years agoPrepare to provide SSL_use_certificate_chain_file()
tb [Fri, 19 Mar 2021 19:51:07 +0000 (19:51 +0000)]
Prepare to provide SSL_use_certificate_chain_file()

This is the same as SSL_CTX_use_certificate_chain_file() but for an
SSL object instead of an SSL_CTX object. remi found this in a recent
librelp update, so we need to provide it. The function will be exposed
in an upcoming library bump.

ok inoguchi on an earlier version, input/ok jsing

3 years agoEdit wireguard for concision. Remove some background covered by wg(4).
procter [Fri, 19 Mar 2021 19:36:10 +0000 (19:36 +0000)]
Edit wireguard for concision. Remove some background covered by wg(4).
Swap -wgpeerall and wgpeer in synopsis to ease parsing.
"I'm good" - Matt Dunwoodie. "just commit" - jmc
suggestions and ok sthen@

3 years agoFix copy-paste error in previous
tb [Fri, 19 Mar 2021 18:52:14 +0000 (18:52 +0000)]
Fix copy-paste error in previous

Found the hard way by lists y42 org via an OCSP validation failure that
in turn caused pkg_add over TLS to fail. Detailed report by sthen.

ok sthen