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 $ .\" $NetBSD: sigaltstack.2,v 1.3 1995/02/27 10:41:52 cgd Exp $
.\" .\"
.\" Copyright (c) 1983, 1991, 1992, 1993 .\" Copyright (c) 1983, 1991, 1992, 1993
@ -30,7 +30,7 @@
.\" .\"
.\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93 .\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93
.\" .\"
.Dd $Mdocdate: March 29 2024 $ .Dd $Mdocdate: June 22 2024 $
.Dt SIGALTSTACK 2 .Dt SIGALTSTACK 2
.Os .Os
.Sh NAME .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 usual case when allocating an alternate stack area.
The following code fragment is typically used to allocate an alternate stack. The following code fragment is typically used to allocate an alternate stack.
.Bd -literal -offset indent .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 */ /* error return */
sigstk.ss_size = SIGSTKSZ; sigstk.ss_size = SIGSTKSZ;
sigstk.ss_flags = 0; 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) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -690,32 +690,43 @@ BN_hex2bn(BIGNUM **bnp, const char *s)
LCRYPTO_ALIAS(BN_hex2bn); LCRYPTO_ALIAS(BN_hex2bn);
int int
BN_bn2mpi(const BIGNUM *a, unsigned char *d) BN_bn2mpi(const BIGNUM *bn, unsigned char *d)
{ {
int bits; uint8_t *out_bin;
int num = 0; size_t out_len, out_bin_len;
int ext = 0; int bits, bytes;
long l; 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) if (d == NULL)
return (num + 4 + ext); return out_len;
l = num + ext; if (!CBB_init_fixed(&cbb, d, out_len))
d[0] = (unsigned char)(l >> 24) & 0xff; goto err;
d[1] = (unsigned char)(l >> 16) & 0xff; if (!CBB_add_u32_length_prefixed(&cbb, &cbb_bin))
d[2] = (unsigned char)(l >> 8) & 0xff; goto err;
d[3] = (unsigned char)(l) & 0xff; if (!CBB_add_space(&cbb_bin, &out_bin, out_bin_len))
if (ext) goto err;
d[4] = 0; if (BN_bn2binpad(bn, out_bin, out_bin_len) != out_bin_len)
num = BN_bn2bin(a, &(d[4 + ext])); goto err;
if (a->neg) if (!CBB_finish(&cbb, NULL, NULL))
goto err;
if (bn->neg)
d[4] |= 0x80; d[4] |= 0x80;
return (num + 4 + ext);
return out_len;
err:
CBB_cleanup(&cbb);
return -1;
} }
LCRYPTO_ALIAS(BN_bn2mpi); 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. * 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); 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 int
CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag) 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. * 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); 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 * 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 * 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) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -56,44 +56,6 @@
* [including the GNU Public Licence.] * [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 <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.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. * 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); 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 int
CBB_add_asn1(CBB *cbb, CBB *out_contents, unsigned int tag) 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. * 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); 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 * 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 * 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 $ .\" $NetBSD: pcibios.4,v 1.7 2000/08/03 13:32:39 soda Exp $
.\" .\"
.\" Copyright (c) 2000 Michael Shalayeff, All rights reserved. .\" 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 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: March 31 2022 $ .Dd $Mdocdate: June 22 2024 $
.Dt PCIBIOS 4 i386 .Dt PCIBIOS 4 i386
.Os .Os
.Sh NAME .Sh NAME
@ -143,54 +143,6 @@ In such cases, the PCI Interrupt Configuration Register takes precedence
by default. by default.
If this flag is specified, the PCI Interrupt Routing table takes precedence. If this flag is specified, the PCI Interrupt Routing table takes precedence.
.El .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 .Sh SEE ALSO
.Xr bios 4 , .Xr bios 4 ,
.Xr intro 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. * This code is derived from code with the copyright below.

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 * O.S : OpenBSD
* File Name : trm.c * File Name : trm.c

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 $ */ /* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*- /*-

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) 1997, Donald A. Schmidt
* Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es)

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 $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */
/* /*

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 * Copyright (c) 1998 Constantine Paul Sapuntzakis

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 $ */ /* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */
/* /*

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 $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/* /*

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. * Synchronous PPP link level subroutines.
* *

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. * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
* *
@ -676,9 +676,9 @@ typedef struct {
struct elfcore_procinfo { struct elfcore_procinfo {
/* Version 1 fields start here. */ /* 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 #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_signo; /* killing signal */
uint32_t cpi_sigcode; /* signal code */ uint32_t cpi_sigcode; /* signal code */
uint32_t cpi_sigpend; /* pending signals */ uint32_t cpi_sigpend; /* pending signals */