sync with OpenBSD -current

This commit is contained in:
purplerain 2024-06-23 03:24:22 +00:00
parent 747d3a4033
commit 7bc640af07
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
19 changed files with 98 additions and 146 deletions

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: sigaltstack.2,v 1.27 2024/03/29 06:48:04 deraadt Exp $
.\" $OpenBSD: sigaltstack.2,v 1.28 2024/06/22 17:19:05 deraadt Exp $
.\" $NetBSD: sigaltstack.2,v 1.3 1995/02/27 10:41:52 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1992, 1993
@ -30,7 +30,7 @@
.\"
.\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93
.\"
.Dd $Mdocdate: March 29 2024 $
.Dd $Mdocdate: June 22 2024 $
.Dt SIGALTSTACK 2
.Os
.Sh NAME
@ -99,7 +99,8 @@ is defined to be the number of bytes/chars that would be used to cover
the usual case when allocating an alternate stack area.
The following code fragment is typically used to allocate an alternate stack.
.Bd -literal -offset indent
if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
if ((sigstk.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
/* error return */
sigstk.ss_size = SIGSTKSZ;
sigstk.ss_flags = 0;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bn_convert.c,v 1.21 2024/04/17 21:55:43 tb Exp $ */
/* $OpenBSD: bn_convert.c,v 1.22 2024/06/22 16:33:00 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -690,32 +690,43 @@ BN_hex2bn(BIGNUM **bnp, const char *s)
LCRYPTO_ALIAS(BN_hex2bn);
int
BN_bn2mpi(const BIGNUM *a, unsigned char *d)
BN_bn2mpi(const BIGNUM *bn, unsigned char *d)
{
int bits;
int num = 0;
int ext = 0;
long l;
uint8_t *out_bin;
size_t out_len, out_bin_len;
int bits, bytes;
int extend;
CBB cbb, cbb_bin;
bits = BN_num_bits(bn);
bytes = (bits + 7) / 8;
extend = (bits != 0) && (bits % 8 == 0);
out_bin_len = extend + bytes;
out_len = 4 + out_bin_len;
bits = BN_num_bits(a);
num = (bits + 7) / 8;
if (bits > 0) {
ext = ((bits & 0x07) == 0);
}
if (d == NULL)
return (num + 4 + ext);
return out_len;
l = num + ext;
d[0] = (unsigned char)(l >> 24) & 0xff;
d[1] = (unsigned char)(l >> 16) & 0xff;
d[2] = (unsigned char)(l >> 8) & 0xff;
d[3] = (unsigned char)(l) & 0xff;
if (ext)
d[4] = 0;
num = BN_bn2bin(a, &(d[4 + ext]));
if (a->neg)
if (!CBB_init_fixed(&cbb, d, out_len))
goto err;
if (!CBB_add_u32_length_prefixed(&cbb, &cbb_bin))
goto err;
if (!CBB_add_space(&cbb_bin, &out_bin, out_bin_len))
goto err;
if (BN_bn2binpad(bn, out_bin, out_bin_len) != out_bin_len)
goto err;
if (!CBB_finish(&cbb, NULL, NULL))
goto err;
if (bn->neg)
d[4] |= 0x80;
return (num + 4 + ext);
return out_len;
err:
CBB_cleanup(&cbb);
return -1;
}
LCRYPTO_ALIAS(BN_bn2mpi);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bs_cbb.c,v 1.5 2024/05/25 15:12:47 tb Exp $ */
/* $OpenBSD: bs_cbb.c,v 1.6 2024/06/22 15:32:51 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@ -328,6 +328,12 @@ CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents)
return cbb_add_length_prefixed(cbb, out_contents, 3);
}
int
CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents)
{
return cbb_add_length_prefixed(cbb, out_contents, 4);
}
int
CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bytestring.h,v 1.4 2022/11/09 19:05:42 jsing Exp $ */
/* $OpenBSD: bytestring.h,v 1.5 2024/06/22 15:32:51 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@ -459,6 +459,13 @@ int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents);
*/
int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents);
/*
* CBB_add_u32_length_prefixed sets |*out_contents| to a new child of |cbb|.
* The data written to |*out_contents| will be prefixed in |cbb| with a 32-bit,
* big-endian length. It returns one on success or zero on error.
*/
int CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents);
/*
* CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an
* ASN.1 object can be written. The |tag| argument will be used as the tag for

View file

@ -1,4 +1,4 @@
/* $OpenBSD: lhash.c,v 1.25 2024/05/07 13:40:42 jsing Exp $ */
/* $OpenBSD: lhash.c,v 1.26 2024/06/22 16:38:31 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -56,44 +56,6 @@
* [including the GNU Public Licence.]
*/
/* Code for dynamic hash table routines
* Author - Eric Young v 2.0
*
* 2.2 eay - added #include "crypto.h" so the memory leak checking code is
* present. eay 18-Jun-98
*
* 2.1 eay - Added an 'error in last operation' flag. eay 6-May-98
*
* 2.0 eay - Fixed a bug that occurred when using lh_delete
* from inside lh_doall(). As entries were deleted,
* the 'table' was 'contract()ed', making some entries
* jump from the end of the table to the start, there by
* skipping the lh_doall() processing. eay - 4/12/95
*
* 1.9 eay - Fixed a memory leak in lh_free, the LHASH_NODEs
* were not being free()ed. 21/11/95
*
* 1.8 eay - Put the stats routines into a separate file, lh_stats.c
* 19/09/95
*
* 1.7 eay - Removed the fputs() for realloc failures - the code
* should silently tolerate them. I have also fixed things
* lint complained about 04/05/95
*
* 1.6 eay - Fixed an invalid pointers in contract/expand 27/07/92
*
* 1.5 eay - Fixed a misuse of realloc in expand 02/03/1992
*
* 1.4 eay - Fixed lh_doall so the function can call lh_delete 28/05/91
*
* 1.3 eay - Fixed a few lint problems 19/3/1991
*
* 1.2 eay - Fixed lh_doall problem 13/3/1991
*
* 1.1 eay - Added lh_doall
*
* 1.0 eay - First version
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bs_cbb.c,v 1.29 2024/05/25 15:14:26 tb Exp $ */
/* $OpenBSD: bs_cbb.c,v 1.30 2024/06/22 15:25:06 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@ -328,6 +328,12 @@ CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents)
return cbb_add_length_prefixed(cbb, out_contents, 3);
}
int
CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents)
{
return cbb_add_length_prefixed(cbb, out_contents, 4);
}
int
CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bytestring.h,v 1.24 2022/11/09 23:14:51 jsing Exp $ */
/* $OpenBSD: bytestring.h,v 1.25 2024/06/22 15:25:06 jsing Exp $ */
/*
* Copyright (c) 2014, Google Inc.
*
@ -459,6 +459,13 @@ int CBB_add_u16_length_prefixed(CBB *cbb, CBB *out_contents);
*/
int CBB_add_u24_length_prefixed(CBB *cbb, CBB *out_contents);
/*
* CBB_add_u32_length_prefixed sets |*out_contents| to a new child of |cbb|.
* The data written to |*out_contents| will be prefixed in |cbb| with a 32-bit,
* big-endian length. It returns one on success or zero on error.
*/
int CBB_add_u32_length_prefixed(CBB *cbb, CBB *out_contents);
/*
* CBB_add_asn sets |*out_contents| to a |CBB| into which the contents of an
* ASN.1 object can be written. The |tag| argument will be used as the tag for

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: pcibios.4,v 1.25 2022/03/31 17:27:21 naddy Exp $
.\" $OpenBSD: pcibios.4,v 1.26 2024/06/22 12:38:32 deraadt Exp $
.\" $NetBSD: pcibios.4,v 1.7 2000/08/03 13:32:39 soda Exp $
.\"
.\" Copyright (c) 2000 Michael Shalayeff, All rights reserved.
@ -29,7 +29,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 31 2022 $
.Dd $Mdocdate: June 22 2024 $
.Dt PCIBIOS 4 i386
.Os
.Sh NAME
@ -143,54 +143,6 @@ In such cases, the PCI Interrupt Configuration Register takes precedence
by default.
If this flag is specified, the PCI Interrupt Routing table takes precedence.
.El
.\" .It Nm PCIBIOS_IRQS_HINT
.\" hint for IRQ use.
.\" When the
.\" .Em PCIBIOS_INTR_FIXUP
.\" cannot guess an adequate IRQ for a device, the hint is used.
.\" .Pp
.\" The value is a logical or of power-of-2s of allowable interrupts:
.\" .Bl -column "XX-0xffff" "XX-0xffff" "XX-0xffff" "XX-0xffff" -compact -offset 2n
.\" .It Em "IRQ Value" Em "\tIRQ Value" Em "\tIRQ Value" Em "\tIRQ Value"
.\" .It "\& 0 0x0001" "\t 4 0x0010" "\t 8 0x0100" "\t12 0x1000"
.\" .It "\& 1 0x0002" "\t 5 0x0020" "\t 9 0x0200" "\t13 0x2000"
.\" .It "\& 2 0x0004" "\t 6 0x0040" "\t10 0x0400" "\t14 0x4000"
.\" .It "\& 3 0x0008" "\t 7 0x0080" "\t11 0x0800" "\t15 0x8000"
.\" .El
.\" For example,
.\" .Qq Sy option PCIBIOS_IRQS_HINT=0x0a00
.\" allows IRQ 9 and IRQ 11.
.\"
.\" The kernel global variable
.\" .Va pcibios_irqs_hint
.\" holds this value,
.\" so a user can override this value without kernel recompilation.
.\" For example:
.\" .Bl -bullet -compact
.\" .It
.\" To specify this value on the fly, type the following command
.\" at the boot prompt to drop into DDB (the in-kernel debugger;
.\" you have to specify
.\" .Qq Sy option DDB
.\" to make kernel with DDB):
.\" .Dl Ic boot -d
.\" And type the following command on
.\" .Qq Sy db>
.\" prompt:
.\" .Dl Ic write pcibios_irqs_hint 0x0a00
.\" Then type the following to continue to boot:
.\" .Dl Ic c
.\" .It
.\" To modify kernel image without kernel recompilation,
.\" run the following command on shell:
.\" .Dl Ic gdb --write /netbsd
.\" And type the following commands at the
.\" .Qq Sy (gdb)
.\" prompt:
.\" .Dl Ic set pcibios_irqs_hint=0xa00
.\" .Dl Ic quit
.\" .El
.\"
.Sh SEE ALSO
.Xr bios 4 ,
.Xr intro 4 ,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: atapiscsi.c,v 1.121 2024/05/26 10:01:01 jsg Exp $ */
/* $OpenBSD: atapiscsi.c,v 1.122 2024/06/22 10:22:29 jsg Exp $ */
/*
* This code is derived from code with the copyright below.
@ -409,7 +409,7 @@ wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer)
}
int
wdc_atapi_ioctl (struct scsi_link *sc_link, u_long cmd, caddr_t addr, int flag)
wdc_atapi_ioctl(struct scsi_link *sc_link, u_long cmd, caddr_t addr, int flag)
{
struct atapiscsi_softc *as = sc_link->bus->sb_adapter_softc;
struct channel_softc *chp = as->chp;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: trm.c,v 1.45 2024/05/13 01:15:50 jsg Exp $
/* $OpenBSD: trm.c,v 1.46 2024/06/22 10:22:29 jsg Exp $
* ------------------------------------------------------------
* O.S : OpenBSD
* File Name : trm.c
@ -550,7 +550,7 @@ trm_RecoverSRB(struct trm_softc *sc)
* ------------------------------------------------------------
*/
void
trm_reset (struct trm_softc *sc)
trm_reset(struct trm_softc *sc)
{
const bus_space_handle_t ioh = sc->sc_iohandle;
const bus_space_tag_t iot = sc->sc_iotag;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: gus.c,v 1.56 2024/05/28 09:27:08 jsg Exp $ */
/* $OpenBSD: gus.c,v 1.57 2024/06/22 10:22:29 jsg Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
@ -3366,7 +3366,7 @@ gus_subattach(struct gus_softc *sc, struct isa_attach_args *ia)
*/
int
gus_test_iobase (bus_space_tag_t iot, int iobase)
gus_test_iobase(bus_space_tag_t iot, int iobase)
{
bus_space_handle_t ioh1, ioh2, ioh3, ioh4;
u_char s1, s2;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ex.c,v 1.49 2023/05/30 08:30:01 jsg Exp $ */
/* $OpenBSD: if_ex.c,v 1.50 2024/06/22 10:22:29 jsg Exp $ */
/*
* Copyright (c) 1997, Donald A. Schmidt
* Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es)
@ -917,7 +917,7 @@ ex_get_media(struct ex_softc *sc)
}
int
ex_ifmedia_upd (struct ifnet *ifp)
ex_ifmedia_upd(struct ifnet *ifp)
{
struct ex_softc *sc = ifp->if_softc;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bktr_core.c,v 1.43 2022/01/09 05:42:58 jsg Exp $ */
/* $OpenBSD: bktr_core.c,v 1.44 2024/06/22 10:22:29 jsg Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */
/*
@ -2367,7 +2367,7 @@ dump_bt848( bktr_ptr_t bktr )
#define BKTR_TEST_RISC_STATUS_BIT3 (1U << 31)
static bool_t
notclipped (bktr_reg_t * bktr, int x, int width) {
notclipped(bktr_reg_t * bktr, int x, int width) {
int i;
bktr_clip_t * clip_node;
bktr->clip_start = -1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: sv.c,v 1.44 2024/05/24 06:02:58 jsg Exp $ */
/* $OpenBSD: sv.c,v 1.45 2024/06/22 10:22:29 jsg Exp $ */
/*
* Copyright (c) 1998 Constantine Paul Sapuntzakis
@ -170,19 +170,19 @@ static __inline__ void sv_write_indirect(struct sv_softc *, u_int8_t, u_int8_t )
static void sv_init_mixer(struct sv_softc *);
static __inline__ void
sv_write (struct sv_softc *sc, u_int8_t reg, u_int8_t val)
sv_write(struct sv_softc *sc, u_int8_t reg, u_int8_t val)
{
bus_space_write_1(sc->sc_iot, sc->sc_ioh, reg, val);
}
static __inline__ u_int8_t
sv_read (struct sv_softc *sc, u_int8_t reg)
sv_read(struct sv_softc *sc, u_int8_t reg)
{
return (bus_space_read_1(sc->sc_iot, sc->sc_ioh, reg));
}
static __inline__ u_int8_t
sv_read_indirect (struct sv_softc *sc, u_int8_t reg)
sv_read_indirect(struct sv_softc *sc, u_int8_t reg)
{
u_int8_t iaddr = 0;
@ -196,7 +196,7 @@ sv_read_indirect (struct sv_softc *sc, u_int8_t reg)
}
static __inline__ void
sv_write_indirect (struct sv_softc *sc, u_int8_t reg, u_int8_t val)
sv_write_indirect(struct sv_softc *sc, u_int8_t reg, u_int8_t val)
{
u_int8_t iaddr = 0;
#ifdef DIAGNOSTIC

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tga.c,v 1.43 2022/07/15 17:57:26 kettenis Exp $ */
/* $OpenBSD: tga.c,v 1.44 2024/06/22 10:22:29 jsg Exp $ */
/* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */
/*
@ -549,7 +549,7 @@ tgaattach(parent, self, aux)
}
void
tga_config_interrupts (d)
tga_config_interrupts(d)
struct device *d;
{
struct tga_softc *sc = (struct tga_softc *)d;
@ -1435,7 +1435,7 @@ tga_eraserows(c, row, num, attr)
}
int
tga_erasecols (c, row, col, num, attr)
tga_erasecols(c, row, col, num, attr)
void *c;
int row, col, num;
uint32_t attr;

View file

@ -657,7 +657,7 @@ vesagtf_mode(unsigned x, unsigned y, unsigned refresh, struct videomode *vmp)
#ifndef _KERNEL
void
print_xf86_mode (struct videomode *vmp)
print_xf86_mode(struct videomode *vmp)
{
float vf, hf;
@ -678,7 +678,7 @@ print_xf86_mode (struct videomode *vmp)
}
int
main (int argc, char *argv[])
main(int argc, char *argv[])
{
struct videomode m;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_descrip.c,v 1.207 2022/12/05 23:18:37 deraadt Exp $ */
/* $OpenBSD: kern_descrip.c,v 1.208 2024/06/22 10:22:29 jsg Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@ -94,7 +94,7 @@ filedesc_init(void)
}
static __inline int
find_next_zero (u_int *bitmap, int want, u_int bits)
find_next_zero(u_int *bitmap, int want, u_int bits)
{
int i, off, maxoff;
u_int sub;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_spppsubr.c,v 1.193 2024/05/13 01:15:53 jsg Exp $ */
/* $OpenBSD: if_spppsubr.c,v 1.194 2024/06/22 10:22:29 jsg Exp $ */
/*
* Synchronous PPP link level subroutines.
*
@ -1496,7 +1496,7 @@ sppp_close_event(const struct cp *cp, struct sppp *sp)
}
void
sppp_increasing_timeout (const struct cp *cp, struct sppp *sp)
sppp_increasing_timeout(const struct cp *cp, struct sppp *sp)
{
int timo;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_elf.h,v 1.103 2024/01/17 22:22:25 kurt Exp $ */
/* $OpenBSD: exec_elf.h,v 1.104 2024/06/22 12:26:17 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
@ -676,9 +676,9 @@ typedef struct {
struct elfcore_procinfo {
/* Version 1 fields start here. */
uint32_t cpi_version; /* netbsd_elfcore_procinfo version */
uint32_t cpi_version; /* elfcore_procinfo version */
#define ELFCORE_PROCINFO_VERSION 1
uint32_t cpi_cpisize; /* sizeof(netbsd_elfcore_procinfo) */
uint32_t cpi_cpisize; /* sizeof(elfcore_procinfo) */
uint32_t cpi_signo; /* killing signal */
uint32_t cpi_sigcode; /* signal code */
uint32_t cpi_sigpend; /* pending signals */