sync with OpenBSD -current

This commit is contained in:
purplerain 2024-07-16 03:02:11 +00:00
parent bc7421a947
commit 4cca26dc5a
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
120 changed files with 4168 additions and 640 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ar_subs.c,v 1.52 2024/05/18 05:21:38 guenther Exp $ */
/* $OpenBSD: ar_subs.c,v 1.53 2024/07/14 14:32:02 jca Exp $ */
/* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */
/*-
@ -172,7 +172,7 @@ cmp_file_times(int mtime_flag, int ctime_flag, ARCHD *arcn, const char *path)
else if (timespeccmp(&arcn->sb.st_mtim, &sb.st_mtim, <=))
return 1;
/*
/*
* If we got here then the target arcn > sb for mtime *and* that's
* the deciding factor. Check whether they're equal after rounding
* down the arcn mtime to the precision of the target path.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: file_subs.c,v 1.56 2023/11/26 16:04:17 espie Exp $ */
/* $OpenBSD: file_subs.c,v 1.57 2024/07/14 14:32:02 jca Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-

View file

@ -727,7 +727,7 @@
./usr/lib/crtendS.o
./usr/lib/gcrt0.o
./usr/lib/libagentx.so.1.1
./usr/lib/libc.so.100.1
./usr/lib/libc.so.100.2
./usr/lib/libcbor.so.2.0
./usr/lib/libcrypto.so.54.0
./usr/lib/libcurses.so.15.0
@ -2975,7 +2975,7 @@
./usr/share/relink/usr/bin/ssh-agent
./usr/share/relink/usr/bin/ssh-agent/ssh-agent.tar
./usr/share/relink/usr/lib
./usr/share/relink/usr/lib/libc.so.100.1.a
./usr/share/relink/usr/lib/libc.so.100.2.a
./usr/share/relink/usr/lib/libcrypto.so.54.0.a
./usr/share/relink/usr/libexec
./usr/share/relink/usr/libexec/ld.so.a

View file

@ -22,6 +22,7 @@
./usr/include/amd64/disklabel.h
./usr/include/amd64/efifbvar.h
./usr/include/amd64/efivar.h
./usr/include/amd64/elf.h
./usr/include/amd64/endian.h
./usr/include/amd64/exec.h
./usr/include/amd64/fenv.h

View file

@ -17,6 +17,7 @@
./usr/include/arm64/db_machdep.h
./usr/include/arm64/disklabel.h
./usr/include/arm64/efivar.h
./usr/include/arm64/elf.h
./usr/include/arm64/endian.h
./usr/include/arm64/exec.h
./usr/include/arm64/fdt.h

View file

@ -17,6 +17,7 @@
./usr/include/arm/cpufunc.h
./usr/include/arm/db_machdep.h
./usr/include/arm/disklabel.h
./usr/include/arm/elf.h
./usr/include/arm/endian.h
./usr/include/arm/exec.h
./usr/include/arm/fdt.h

View file

@ -23,6 +23,7 @@
./usr/include/i386/cpuvar.h
./usr/include/i386/db_machdep.h
./usr/include/i386/disklabel.h
./usr/include/i386/elf.h
./usr/include/i386/endian.h
./usr/include/i386/exec.h
./usr/include/i386/fenv.h

View file

@ -1160,8 +1160,6 @@
./usr/include/openssl/sm4.h
./usr/include/openssl/srtp.h
./usr/include/openssl/ssl.h
./usr/include/openssl/ssl2.h
./usr/include/openssl/ssl23.h
./usr/include/openssl/ssl3.h
./usr/include/openssl/stack.h
./usr/include/openssl/tls1.h
@ -1291,6 +1289,7 @@
./usr/include/sys/ataio.h
./usr/include/sys/atomic.h
./usr/include/sys/audioio.h
./usr/include/sys/auxv.h
./usr/include/sys/blist.h
./usr/include/sys/buf.h
./usr/include/sys/cdefs.h
@ -2451,6 +2450,7 @@
./usr/share/man/man3/eddsa_pk_new.3
./usr/share/man/man3/editline.3
./usr/share/man/man3/elf.3
./usr/share/man/man3/elf_aux_info.3
./usr/share/man/man3/elf_begin.3
./usr/share/man/man3/elf_cntl.3
./usr/share/man/man3/elf_end.3

View file

@ -1,4 +1,4 @@
# $OpenBSD: BSD.x11.dist,v 1.56 2021/10/27 21:31:31 matthieu Exp $
# $OpenBSD: BSD.x11.dist,v 1.57 2024/07/14 09:39:15 matthieu Exp $
/set type=dir uname=root gname=wheel mode=0755
.
@ -89,6 +89,8 @@
..
pixman-1
..
va
..
vulkan
..
xcb

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wchar.h,v 1.31 2017/09/05 03:16:13 schwarze Exp $ */
/* $OpenBSD: wchar.h,v 1.32 2024/07/14 10:04:17 jca Exp $ */
/* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */
/*-
@ -166,6 +166,7 @@ int wcscoll_l(const wchar_t *, const wchar_t *, locale_t);
wchar_t *wcsdup(const wchar_t *);
int wcscasecmp(const wchar_t *, const wchar_t *);
int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t);
size_t wcsnlen(const wchar_t *, size_t);
int wcsncasecmp(const wchar_t *, const wchar_t *, size_t);
int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t);
size_t wcsxfrm_l(wchar_t *, const wchar_t *, size_t, locale_t);

View file

@ -608,6 +608,7 @@ daemon
devname
dirfd
dirname
elf_aux_info
endfsent
endgrent
endnetgrent
@ -1665,6 +1666,7 @@ wcsncasecmp_l
wcsncat
wcsncmp
wcsncpy
wcsnlen
wcspbrk
wcsrchr
wcsspn

View file

@ -1,4 +1,4 @@
/* $OpenBSD: init.c,v 1.22 2024/01/21 17:18:13 kettenis Exp $ */
/* $OpenBSD: init.c,v 1.23 2024/07/14 09:48:48 jca Exp $ */
/*
* Copyright (c) 2014,2015 Philip Guenther <guenther@openbsd.org>
*
@ -49,6 +49,8 @@ char ***_csu_finish(char **_argv, char **_envp, void (*_cleanup)(void));
/* provide definitions for these */
int _pagesize = 0;
struct timekeep *_timekeep;
unsigned long _hwcap, _hwcap2;
int _hwcap_avail, _hwcap2_avail;
/*
* In dynamically linked binaries environ and __progname are overridden by
@ -96,6 +98,14 @@ _libc_preinit(int argc, char **argv, char **envp, dl_cb_cb *cb)
;
for (aux = (void *)envp; aux->au_id != AUX_null; aux++) {
switch (aux->au_id) {
case AUX_hwcap:
_hwcap = aux->au_v;
_hwcap_avail = 1;
break;
case AUX_hwcap2:
_hwcap2 = aux->au_v;
_hwcap2_avail = 1;
break;
case AUX_pagesz:
_pagesize = aux->au_v;
break;

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.82 2019/09/02 21:18:40 deraadt Exp $
# $OpenBSD: Makefile.inc,v 1.83 2024/07/14 09:48:48 jca Exp $
# gen sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen
@ -6,8 +6,8 @@
SRCS+= alarm.c assert.c auth_subr.c authenticate.c \
basename.c clock.c clock_getcpuclockid.c \
closedir.c confstr.c ctermid.c ctype_.c \
daemon.c devname.c dirfd.c dirname.c disklabel.c err.c \
errc.c errx.c errlist.c errno.c exec.c \
daemon.c devname.c dirfd.c dirname.c disklabel.c elf_aux_info.c \
err.c errc.c errx.c errlist.c errno.c exec.c \
fdatasync.c fnmatch.c fpclassify.c frexp.c \
fstab.c ftok.c fts.c ftw.c getbsize.c getcap.c getcwd.c \
getdomainname.c getgrent.c getgrouplist.c gethostname.c \
@ -36,7 +36,7 @@ SRCS+= alarm.c assert.c auth_subr.c authenticate.c \
MAN+= __tfork_thread.3 alarm.3 auth_subr.3 authenticate.3 basename.3 clock.3 \
clock_getcpuclockid.3 confstr.3 \
ctermid.3 daemon.3 devname.3 opendir.3 dirname.3 err.3 \
ctermid.3 daemon.3 devname.3 opendir.3 dirname.3 elf_aux_info.3 err.3 \
execv.3 fabs.3 fnmatch.3 fpclassify.3 fpgetmask.3 frexp.3 ftok.3 fts_open.3 \
ftw.3 getbsize.3 cgetent.3 getcwd.3 getdomainname.3 getdiskbyname.3 \
getfsent.3 getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \

View file

@ -0,0 +1,74 @@
.\" $OpenBSD: elf_aux_info.3,v 1.1 2024/07/14 09:48:48 jca Exp $
.\"
.\" Origin: FreeBSD auxv.3
.\"
.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 14 2024 $
.Dt ELF_AUX_INFO 3
.Os
.Sh NAME
.Nm elf_aux_info
.Nd extract data from the elf auxiliary vector of the current process
.Sh SYNOPSIS
.In sys/auxv.h
.Ft int
.Fn elf_aux_info "int aux" "void *buf" "int buflen"
.Sh DESCRIPTION
The
.Fn elf_aux_info
function retrieves the auxiliary info vector requested in
.Va aux .
The information is stored into the provided buffer if it will fit.
The following values can be requested (corresponding buffer sizes are
specified in parenthesis):
.Bl -tag -width AT_HWCAP2
.It AT_HWCAP
CPU / hardware feature flags
.Dv (sizeof(unsigned long)) .
.It AT_HWCAP2
CPU / hardware feature flags
.Dv (sizeof(unsigned long)) .
.It AT_PAGESZ
Page size in bytes
.Dv (sizeof(int)) .
.El
.Sh RETURN VALUES
Returns zero on success, or an error number on failure.
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EINVAL
An unknown item was requested.
.It Bq Er EINVAL
The provided buffer was not the right size for the requested item.
.It Bq Er ENOENT
The requested item is not available.
.El
.Sh HISTORY
The
.Fn elf_aux_info
function appeared in
.Fx 12.0
and was first available in
.Ox 7.6 .

View file

@ -0,0 +1,70 @@
/* $OpenBSD: elf_aux_info.c,v 1.1 2024/07/14 09:48:48 jca Exp $ */
/*
* Copyright (c) 2024 Jeremie Courreges-Anglas <jca@wxcvbn.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/types.h>
#include <sys/auxv.h>
#include <errno.h>
extern int _pagesize;
extern unsigned long _hwcap, _hwcap2;
extern int _hwcap_avail, _hwcap2_avail;
int
elf_aux_info(int request, void *buf, int buflen)
{
int ret = 0;
if (buflen < 0)
return EINVAL;
switch (request) {
case AT_HWCAP:
if (buflen != sizeof(unsigned long))
ret = EINVAL;
else if (!_hwcap_avail)
ret = ENOENT;
else
*(unsigned long *)buf = _hwcap;
break;
case AT_HWCAP2:
if (buflen != sizeof(unsigned long))
ret = EINVAL;
else if (!_hwcap2_avail)
ret = ENOENT;
else
*(unsigned long *)buf = _hwcap2;
break;
case AT_PAGESZ:
if (buflen != sizeof(int))
ret = EINVAL;
else if (!_pagesize)
ret = ENOENT;
else
*(int *)buf = _pagesize;
break;
default:
if (request < 0 || request >= AT_COUNT)
ret = EINVAL;
else
ret = ENOENT;
break;
}
return ret;
}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: signal.3,v 1.58 2024/07/12 11:01:40 deraadt Exp $
.\" $OpenBSD: signal.3,v 1.59 2024/07/14 03:47:44 jsg Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 12 2024 $
.Dd $Mdocdate: July 14 2024 $
.Dt SIGNAL 3
.Os
.Sh NAME
@ -248,7 +248,7 @@ which is inspected by an event loop.
Other variables accessed inside the handler must be either const, or
local to the handler.
More complicated global variables (such as strings, structs, or lists)
will require external methods to gaurantee consistancy, such as
will require external methods to guarantee consistency, such as
signal-blocking with
.Xr sigprocmask 2 .
.Pp

View file

@ -0,0 +1,26 @@
/* $OpenBSD: auxv.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
/*
* Copyright (c) 2024 Jeremie Courreges-Anglas <jca@wxcvbn.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBC_SYS_AUXV_H_
#define _LIBC_SYS_AUXV_H_
#include_next <sys/auxv.h>
PROTO_DEPRECATED(elf_aux_info);
#endif /* !_LIBC_SYS_AUXV_H_ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wchar.h,v 1.4 2017/09/05 03:16:13 schwarze Exp $ */
/* $OpenBSD: wchar.h,v 1.5 2024/07/14 09:51:18 jca Exp $ */
/*
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
*
@ -65,6 +65,7 @@ PROTO_NORMAL(wcsncasecmp);
PROTO_NORMAL(wcsncat);
PROTO_NORMAL(wcsncmp);
PROTO_NORMAL(wcsncpy);
PROTO_DEPRECATED(wcsnlen);
PROTO_NORMAL(wcsnrtombs);
PROTO_NORMAL(wcspbrk);
PROTO_NORMAL(wcsrchr);

View file

@ -1,4 +1,4 @@
major=100
minor=1
minor=2
# note: If changes were made to include/thread_private.h or if system calls
# were added/changed then librthread/shlib_version must also be updated.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vfprintf.c,v 1.82 2023/10/06 16:41:02 millert Exp $ */
/* $OpenBSD: vfprintf.c,v 1.83 2024/07/14 13:31:50 millert Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@ -56,6 +56,10 @@
#include "local.h"
#include "fvwrite.h"
#define PRINTF_PAGESIZE (1 << _MAX_PAGE_SHIFT)
#define PRINTF_PAGEMASK (PRINTF_PAGESIZE - 1)
#define PAGEROUND(x) (((x) + (PRINTF_PAGEMASK)) & ~PRINTF_PAGEMASK)
union arg {
int intarg;
unsigned int uintarg;
@ -153,12 +157,13 @@ __sbprintf(FILE *fp, const char *fmt, va_list ap)
* string is null-terminated.
*/
static char *
__wcsconv(wchar_t *wcsarg, int prec)
__wcsconv(wchar_t *wcsarg, int prec, char **convbufp, size_t *convbufsizp)
{
char *convbuf = *convbufp;
size_t convbufsiz = *convbufsizp;
mbstate_t mbs;
char buf[MB_LEN_MAX];
wchar_t *p;
char *convbuf;
size_t clen, nbytes;
/* Allocate space for the maximum number of bytes we could output. */
@ -191,15 +196,26 @@ __wcsconv(wchar_t *wcsarg, int prec)
return (NULL);
}
}
if ((convbuf = malloc(nbytes + 1)) == NULL)
return (NULL);
if (nbytes + 1 > convbufsiz) {
if (convbuf != NULL)
munmap(convbuf, convbufsiz);
convbufsiz = PAGEROUND(nbytes + 1);
convbuf = mmap(NULL, convbufsiz, PROT_WRITE|PROT_READ,
MAP_ANON|MAP_PRIVATE, -1, 0);
if (convbuf == MAP_FAILED) {
*convbufp = NULL;
*convbufsizp = 0;
return (NULL);
}
*convbufp = convbuf;
*convbufsizp = convbufsiz;
}
/* Fill the output buffer. */
p = wcsarg;
memset(&mbs, 0, sizeof(mbs));
if ((nbytes = wcsrtombs(convbuf, (const wchar_t **)&p,
nbytes, &mbs)) == (size_t)-1) {
free(convbuf);
return (NULL);
}
convbuf[nbytes] = '\0';
@ -328,6 +344,7 @@ __vfprintf(FILE *fp, const char *fmt0, __va_list ap)
va_list orgap; /* original argument pointer */
#ifdef PRINTF_WIDE_CHAR
char *convbuf; /* buffer for wide to multi-byte conversion */
size_t convbufsiz; /* size of convbuf, for munmap() */
#endif
/*
@ -475,6 +492,7 @@ __vfprintf(FILE *fp, const char *fmt0, __va_list ap)
ret = 0;
#ifdef PRINTF_WIDE_CHAR
convbuf = NULL;
convbufsiz = 0;
#endif
/*
@ -840,8 +858,6 @@ fp_common:
if (flags & LONGINT) {
wchar_t *wcp;
free(convbuf);
convbuf = NULL;
if ((wcp = GETARG(wchar_t *)) == NULL) {
struct syslog_data sdata = SYSLOG_DATA_INIT;
int save_errno = errno;
@ -852,12 +868,12 @@ fp_common:
cp = "(null)";
} else {
convbuf = __wcsconv(wcp, prec);
if (convbuf == NULL) {
cp = __wcsconv(wcp, prec, &convbuf,
&convbufsiz);
if (cp == NULL) {
ret = -1;
goto error;
}
cp = convbuf;
}
} else
#endif /* PRINTF_WIDE_CHAR */
@ -1072,7 +1088,8 @@ overflow:
finish:
#ifdef PRINTF_WIDE_CHAR
free(convbuf);
if (convbuf != NULL)
munmap(convbuf, convbufsiz);
#endif
#ifdef FLOATING_POINT
if (dtoaresult)

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.39 2017/09/05 03:16:13 schwarze Exp $
# $OpenBSD: Makefile.inc,v 1.40 2024/07/14 09:51:18 jca Exp $
# string sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string
@ -9,9 +9,9 @@ SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \
strndup.c strnlen.c strsignal.c strtok.c strxfrm.c strxfrm_l.c \
timingsafe_bcmp.c timingsafe_memcmp.c \
wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \
wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c \
wcsstr.c wcstok.c wcswcs.c wcswidth.c wmemchr.c wmemcmp.c wmemcpy.c \
wmemmove.c wmemset.c wcsdup.c wcscasecmp.c wcscasecmp_l.c
wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcsnlen.c wcspbrk.c wcsrchr.c \
wcsspn.c wcsstr.c wcstok.c wcswcs.c wcswidth.c wmemchr.c wmemcmp.c \
wmemcpy.c wmemmove.c wmemset.c wcsdup.c wcscasecmp.c wcscasecmp_l.c
# machine-dependent net sources
# ../arch/ARCH/Makefile.inc must include sources for:

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: wcslen.3,v 1.3 2013/06/05 03:39:23 tedu Exp $
.\" $OpenBSD: wcslen.3,v 1.4 2024/07/14 09:51:18 jca Exp $
.\"
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
@ -31,26 +31,50 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: July 14 2024 $
.Dt WCSLEN 3
.Os
.Sh NAME
.Nm wcslen
.Nm wcslen ,
.Nm wcsnlen
.Nd find length of a wide string
.Sh SYNOPSIS
.In wchar.h
.Ft size_t
.Fn wcslen "const wchar_t *s"
.Ft size_t
.Fn wcsnlen "const wchar_t *s" "size_t maxlen"
.Sh DESCRIPTION
The
.Fn wcslen
function computes the length of the wide string
.Fa s .
The
.Fn wcsnlen
function computes the length of the wide string
.Fa s ,
up to
.Fa maxlen
wide characters.
The
.Fn wcsnlen
function will never attempt to address more than
.Fa maxlen
wide characters, making it suitable for use with wide character arrays
that are not guaranteed to be NUL-terminated.
.Sh RETURN VALUES
The
.Fn wcslen
function returns the number of wide characters that precede the terminating
null wide character.
.Pp
The
.Fn wcsnlen
function returns the number of wide characters that precede the terminating
null wide character
or
.Fa maxlen ,
whichever is smaller.
.Sh SEE ALSO
.Xr strlen 3 ,
.Xr wcswidth 3
@ -61,6 +85,10 @@ function conforms to
.St -isoC-99
and was first introduced in
.St -isoC-amd1 .
The
.Fn wcsnlen
function conforms to
.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn wcslen
@ -68,3 +96,7 @@ function was ported from
.Nx
and first appeared in
.Ox 3.8 .
The
.Fn wcsnlen
function first appeared in
.Ox 7.6 .

45
lib/libc/string/wcsnlen.c Normal file
View file

@ -0,0 +1,45 @@
/* $OpenBSD: wcsnlen.c,v 1.1 2024/07/14 09:51:18 jca Exp $ */
/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
*/
#include <wchar.h>
size_t
wcsnlen(const wchar_t *s, size_t maxlen)
{
const wchar_t *p;
p = s;
while (maxlen-- && *p)
p++;
return p - s;
}

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: sigaction.2,v 1.78 2024/07/12 11:01:40 deraadt Exp $
.\" $OpenBSD: sigaction.2,v 1.79 2024/07/14 03:53:18 jsg Exp $
.\" $NetBSD: sigaction.2,v 1.7 1995/10/12 15:41:16 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@ -30,7 +30,7 @@
.\"
.\" @(#)sigaction.2 8.2 (Berkeley) 4/3/94
.\"
.Dd $Mdocdate: July 12 2024 $
.Dd $Mdocdate: July 14 2024 $
.Dt SIGACTION 2
.Os
.Sh NAME
@ -479,7 +479,7 @@ which is inspected by an event loop.
Other variables accessed inside the handler must be either const, or
local to the handler.
More complicated global variables (such as strings, structs, or lists)
will require external methods to gaurantee consistancy, such as
will require external methods to guarantee consistency, such as
signal-blocking with
.Xr sigprocmask 2 .
.Pp

View file

@ -1,4 +1,4 @@
/* $OpenBSD: conf_api.c,v 1.18 2024/03/02 11:11:11 tb Exp $ */
/* $OpenBSD: conf_api.c,v 1.19 2024/07/14 14:32:45 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -69,8 +69,6 @@
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include "lhash_local.h"
static void value_free_hash_doall_arg(CONF_VALUE *a,
LHASH_OF(CONF_VALUE) *conf);
static void value_free_stack_doall(CONF_VALUE *a);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_pkey.c,v 1.28 2024/04/09 13:55:02 beck Exp $ */
/* $OpenBSD: evp_pkey.c,v 1.30 2024/07/14 16:06:31 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999.
*/
@ -141,19 +141,63 @@ error:
}
LCRYPTO_ALIAS(EVP_PKEY2PKCS8);
/* EVP_PKEY attribute functions */
/*
* XXX - This is only used by openssl(1) pkcs12 for the Microsoft-specific
* NID_ms_csp_name and NID_LocalKeySet. This turns out to be the only reason
* why attributes hangs off the EVP_PKEY struct.
*/
int
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *pkey, int nid, int type,
const unsigned char *bytes, int len)
{
STACK_OF(X509_ATTRIBUTE) *attrs = NULL;
X509_ATTRIBUTE *attr = NULL;
int ret = 0;
if ((attr = X509_ATTRIBUTE_create_by_NID(NULL, nid, type,
bytes, len)) == NULL)
goto err;
if ((attrs = pkey->attributes) == NULL)
attrs = sk_X509_ATTRIBUTE_new_null();
if (attrs == NULL)
goto err;
if (sk_X509_ATTRIBUTE_push(attrs, attr) <= 0)
goto err;
attr = NULL;
pkey->attributes = attrs;
attrs = NULL;
ret = 1;
err:
X509_ATTRIBUTE_free(attr);
if (attrs != pkey->attributes)
sk_X509_ATTRIBUTE_pop_free(attrs, X509_ATTRIBUTE_free);
return ret;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
/*
* XXX - delete all the garbage below in the next bump.
*/
int
EVP_PKEY_get_attr_count(const EVP_PKEY *key)
{
return X509at_get_attr_count(key->attributes);
EVPerror(ERR_R_DISABLED);
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_get_attr_count);
int
EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos)
{
return X509at_get_attr_by_NID(key->attributes, nid, lastpos);
EVPerror(ERR_R_DISABLED);
return -1;
}
LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID);
@ -161,29 +205,31 @@ int
EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,
int lastpos)
{
return X509at_get_attr_by_OBJ(key->attributes, obj, lastpos);
EVPerror(ERR_R_DISABLED);
return -1;
}
LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ);
X509_ATTRIBUTE *
EVP_PKEY_get_attr(const EVP_PKEY *key, int loc)
{
return X509at_get_attr(key->attributes, loc);
EVPerror(ERR_R_DISABLED);
return NULL;
}
LCRYPTO_ALIAS(EVP_PKEY_get_attr);
X509_ATTRIBUTE *
EVP_PKEY_delete_attr(EVP_PKEY *key, int loc)
{
return X509at_delete_attr(key->attributes, loc);
EVPerror(ERR_R_DISABLED);
return NULL;
}
LCRYPTO_ALIAS(EVP_PKEY_delete_attr);
int
EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr)
{
if (X509at_add1_attr(&key->attributes, attr))
return 1;
EVPerror(ERR_R_DISABLED);
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr);
@ -192,29 +238,16 @@ int
EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type,
const unsigned char *bytes, int len)
{
if (X509at_add1_attr_by_OBJ(&key->attributes, obj, type, bytes, len))
return 1;
EVPerror(ERR_R_DISABLED);
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ);
int
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, int nid, int type,
const unsigned char *bytes, int len)
{
if (X509at_add1_attr_by_NID(&key->attributes, nid, type, bytes, len))
return 1;
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
int
EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type,
const unsigned char *bytes, int len)
{
if (X509at_add1_attr_by_txt(&key->attributes, attrname, type,
bytes, len))
return 1;
EVPerror(ERR_R_DISABLED);
return 0;
}
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509.h,v 1.7 2024/07/08 17:01:54 beck Exp $ */
/* $OpenBSD: x509.h,v 1.8 2024/07/15 18:50:42 tb Exp $ */
/*
* Copyright (c) 2022 Bob Beck <beck@openbsd.org>
*
@ -442,15 +442,15 @@ LCRYPTO_USED(X509_ocspid_print);
LCRYPTO_USED(X509_CRL_print);
LCRYPTO_USED(X509_REQ_print_ex);
LCRYPTO_USED(X509_REQ_print);
LCRYPTO_USED(EVP_PKEY_get_attr_count);
LCRYPTO_USED(EVP_PKEY_get_attr_by_NID);
LCRYPTO_USED(EVP_PKEY_get_attr_by_OBJ);
LCRYPTO_USED(EVP_PKEY_get_attr);
LCRYPTO_USED(EVP_PKEY_delete_attr);
LCRYPTO_USED(EVP_PKEY_add1_attr);
LCRYPTO_USED(EVP_PKEY_add1_attr_by_OBJ);
LCRYPTO_USED(EVP_PKEY_add1_attr_by_NID);
LCRYPTO_USED(EVP_PKEY_add1_attr_by_txt);
LCRYPTO_UNUSED(EVP_PKEY_get_attr_count);
LCRYPTO_UNUSED(EVP_PKEY_get_attr_by_NID);
LCRYPTO_UNUSED(EVP_PKEY_get_attr_by_OBJ);
LCRYPTO_UNUSED(EVP_PKEY_get_attr);
LCRYPTO_UNUSED(EVP_PKEY_delete_attr);
LCRYPTO_UNUSED(EVP_PKEY_add1_attr);
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_OBJ);
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_NID);
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_txt);
LCRYPTO_USED(PKCS8_PRIV_KEY_INFO_new);
LCRYPTO_USED(PKCS8_PRIV_KEY_INFO_free);
LCRYPTO_USED(d2i_PKCS8_PRIV_KEY_INFO);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: lhash.c,v 1.27 2024/06/30 14:13:08 jsing Exp $ */
/* $OpenBSD: lhash.c,v 1.28 2024/07/14 14:32:45 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -65,13 +65,34 @@
#include <openssl/crypto.h>
#include <openssl/lhash.h>
#include "lhash_local.h"
#undef MIN_NODES
#define MIN_NODES 16
#define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */
#define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */
typedef struct lhash_node_st {
void *data;
struct lhash_node_st *next;
#ifndef OPENSSL_NO_HASH_COMP
unsigned long hash;
#endif
} LHASH_NODE;
struct lhash_st {
LHASH_NODE **b;
LHASH_COMP_FN_TYPE comp;
LHASH_HASH_FN_TYPE hash;
unsigned int num_nodes;
unsigned int num_alloc_nodes;
unsigned int p;
unsigned int pmax;
unsigned long up_load; /* load times 256 */
unsigned long down_load; /* load times 256 */
unsigned long num_items;
int error;
} /* _LHASH */;
static void
expand(_LHASH *lh)
{

View file

@ -1,91 +0,0 @@
/* $OpenBSD: lhash_local.h,v 1.2 2024/06/30 14:13:08 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
/* Header for dynamic hash table routines
* Author - Eric Young
*/
#include <openssl/opensslconf.h>
#ifndef HEADER_LHASH_LOCAL_H
#define HEADER_LHASH_LOCAL_H
typedef struct lhash_node_st {
void *data;
struct lhash_node_st *next;
#ifndef OPENSSL_NO_HASH_COMP
unsigned long hash;
#endif
} LHASH_NODE;
struct lhash_st {
LHASH_NODE **b;
LHASH_COMP_FN_TYPE comp;
LHASH_HASH_FN_TYPE hash;
unsigned int num_nodes;
unsigned int num_alloc_nodes;
unsigned int p;
unsigned int pmax;
unsigned long up_load; /* load times 256 */
unsigned long down_load; /* load times 256 */
unsigned long num_items;
int error;
} /* _LHASH */;
#endif

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: EC_KEY_new.3,v 1.19 2024/02/16 06:09:36 tb Exp $
.\" $OpenBSD: EC_KEY_new.3,v 1.20 2024/07/14 05:53:09 jsg Exp $
.\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500
.\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
.\"
@ -49,7 +49,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: February 16 2024 $
.Dd $Mdocdate: July 14 2024 $
.Dt EC_KEY_NEW 3
.Os
.Sh NAME
@ -377,7 +377,7 @@ and
.Fn EC_KEY_set_conv_form
get and set the point_conversion_form for the
.Fa key .
For a description of point_conversion_form please refer to
For a description of point_conversion_form refer to
.Xr EC_GROUP_copy 3 .
.Pp
.Fn EC_KEY_set_flags

View file

@ -1,4 +1,4 @@
/* $OpenBSD: obj_dat.c,v 1.90 2024/05/08 16:35:05 tb Exp $ */
/* $OpenBSD: obj_dat.c,v 1.91 2024/07/14 14:32:45 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -71,7 +71,6 @@
#include <openssl/objects.h>
#include "asn1_local.h"
#include "lhash_local.h"
/* obj_dat.h is generated from objects.h by obj_dat.pl */
#include "obj_dat.h"

View file

@ -1,4 +1,4 @@
/* $OpenBSD: p12_crt.c,v 1.24 2024/03/24 06:48:03 tb Exp $ */
/* $OpenBSD: p12_crt.c,v 1.25 2024/07/15 15:43:25 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@ -60,8 +60,11 @@
#include <openssl/err.h>
#include <openssl/pkcs12.h>
#include <openssl/x509.h>
#include "evp_local.h"
#include "pkcs12_local.h"
#include "x509_local.h"
static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
PKCS12_SAFEBAG *bag);
@ -69,13 +72,25 @@ static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
static int
copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid)
{
int idx;
X509_ATTRIBUTE *attr;
X509_ATTRIBUTE *attr = NULL;
const ASN1_OBJECT *obj;
int i;
idx = EVP_PKEY_get_attr_by_NID(pkey, nid, -1);
if (idx < 0)
if ((obj = OBJ_nid2obj(nid)) == NULL) {
/* XXX - this seems wrong but preserves behavior. */
return 1;
attr = EVP_PKEY_get_attr(pkey, idx);
}
for (i = 0; i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) {
attr = sk_X509_ATTRIBUTE_value(pkey->attributes, i);
if (OBJ_cmp(attr->object, obj) == 0)
break;
attr = NULL;
}
if (attr == NULL)
return 1;
if (!X509at_add1_attr(&bag->attrib, attr))
return 0;
return 1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl.h,v 1.6 2024/03/02 11:48:55 tb Exp $ */
/* $OpenBSD: ssl.h,v 1.7 2024/07/14 15:39:36 tb Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
@ -377,5 +377,6 @@ LSSL_USED(SSL_get_peer_quic_transport_params);
LSSL_USED(SSL_set_quic_use_legacy_codepoint);
LSSL_USED(ERR_load_SSL_strings);
LSSL_USED(OPENSSL_init_ssl);
LSSL_USED(SSL_CIPHER_get_handshake_digest);
#endif /* _LIBSSL_SSL_H */

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.14 2022/07/17 08:51:07 jsg Exp $
.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.16 2024/07/15 00:11:59 jsg Exp $
.\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
.\"
@ -52,7 +52,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 17 2022 $
.Dd $Mdocdate: July 15 2024 $
.Dt SSL_CIPHER_GET_NAME 3
.Os
.Sh NAME
@ -61,6 +61,7 @@
.Nm SSL_CIPHER_get_version ,
.Nm SSL_CIPHER_get_cipher_nid ,
.Nm SSL_CIPHER_get_digest_nid ,
.Nm SSL_CIPHER_get_handshake_digest ,
.Nm SSL_CIPHER_get_kx_nid ,
.Nm SSL_CIPHER_get_auth_nid ,
.Nm SSL_CIPHER_is_aead ,
@ -80,6 +81,8 @@
.Fn SSL_CIPHER_get_cipher_nid "const SSL_CIPHER *cipher"
.Ft int
.Fn SSL_CIPHER_get_digest_nid "const SSL_CIPHER *cipher"
.Ft "const EVP_MD *"
.Fn SSL_CIPHER_get_handshake_digest "const SSL_CIPHER *cipher"
.Ft int
.Fn SSL_CIPHER_get_kx_nid "const SSL_CIPHER *cipher"
.Ft int
@ -132,6 +135,14 @@ If there is no digest (e.g. for AEAD cipher suites), then
.Dv NID_undef
is returned.
.Pp
.Fn SSL_CIPHER_get_handshake_digest
returns the
.Vt EVP_MD
object representing the digest used during a TLS handshake with the cipher
.Fa c ,
which may be different to the digest used in the message authentication code
for encrypted records.
.Pp
.Fn SSL_CIPHER_get_kx_nid
returns the key exchange NID corresponding to the method used by the
.Fa cipher .
@ -307,6 +318,12 @@ and
return an NID constant or
.Dv NID_undef
if an error occurred.
.Fn SSL_CIPHER_get_handshake_digest
returns a valid
.Vt EVP_MD
object or
.Dv NULL
if an error occurred.
.Pp
.Fn SSL_CIPHER_is_aead
returns 1 if the
@ -369,6 +386,9 @@ first appeared in OpenSSL 1.1.0 and have been available since
.Fn SSL_CIPHER_find
first appeared in OpenSSL 1.1.0 and has been available since
.Ox 7.0 .
.Fn SSL_CIPHER_get_handshake_digest
first appeared in OpenSSL 1.1.1 and has been available since
.Ox 7.5 .
.Sh BUGS
If
.Fn SSL_CIPHER_description

View file

@ -1,4 +1,4 @@
/* $OpenBSD: s3_lib.c,v 1.252 2024/05/10 05:08:05 tb Exp $ */
/* $OpenBSD: s3_lib.c,v 1.253 2024/07/15 14:45:15 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -183,7 +183,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_MD5,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 0,
.alg_bits = 0,
},
@ -199,7 +199,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 0,
.alg_bits = 0,
},
@ -215,7 +215,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_MD5,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -231,7 +231,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -247,7 +247,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -267,7 +267,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -283,7 +283,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_MD5,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -299,7 +299,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_SSLV3,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -319,7 +319,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -335,7 +335,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -351,7 +351,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -367,7 +367,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -383,7 +383,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -399,7 +399,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -416,7 +416,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 0,
.alg_bits = 0,
},
@ -432,7 +432,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -448,7 +448,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -467,7 +467,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -483,7 +483,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -499,7 +499,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -517,7 +517,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -533,7 +533,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -549,7 +549,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -565,7 +565,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -584,7 +584,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -600,7 +600,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -616,7 +616,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -637,7 +637,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -653,7 +653,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -669,7 +669,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -685,7 +685,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -701,7 +701,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -717,7 +717,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -736,7 +736,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -752,7 +752,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -768,7 +768,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -784,7 +784,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -800,7 +800,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -816,7 +816,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -887,7 +887,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 0,
.alg_bits = 0,
},
@ -903,7 +903,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -919,7 +919,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -935,7 +935,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -951,7 +951,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -967,7 +967,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 0,
.alg_bits = 0,
},
@ -983,7 +983,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -999,7 +999,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -1015,7 +1015,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1031,7 +1031,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1047,7 +1047,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_STRONG_NONE,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 0,
.alg_bits = 0,
},
@ -1063,7 +1063,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_LOW,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1079,7 +1079,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_MEDIUM,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 112,
.alg_bits = 168,
},
@ -1095,7 +1095,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1111,7 +1111,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA1,
.algorithm_ssl = SSL_TLSV1,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT|TLS1_PRF,
.algorithm2 = SSL_HANDSHAKE_MAC_DEFAULT,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1130,7 +1130,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1146,7 +1146,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA384,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1162,7 +1162,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA256,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1178,7 +1178,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_SHA384,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1196,7 +1196,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1212,7 +1212,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1228,7 +1228,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 128,
.alg_bits = 128,
},
@ -1244,7 +1244,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384|TLS1_PRF_SHA384,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA384,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1260,7 +1260,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1276,7 +1276,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},
@ -1292,7 +1292,7 @@ const SSL_CIPHER ssl3_ciphers[] = {
.algorithm_mac = SSL_AEAD,
.algorithm_ssl = SSL_TLSV1_2,
.algo_strength = SSL_HIGH,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256|TLS1_PRF_SHA256,
.algorithm2 = SSL_HANDSHAKE_MAC_SHA256,
.strength_bits = 256,
.alg_bits = 256,
},

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl.h,v 1.238 2024/07/13 18:33:18 tb Exp $ */
/* $OpenBSD: ssl.h,v 1.239 2024/07/14 15:39:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -1125,6 +1125,9 @@ int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
#if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API)
const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
#endif
int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
int SSL_get_fd(const SSL *s);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_ciph.c,v 1.142 2024/05/09 07:55:48 tb Exp $ */
/* $OpenBSD: ssl_ciph.c,v 1.143 2024/07/14 15:39:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -524,6 +524,7 @@ ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md)
handshake_mac = s->s3->hs.cipher->algorithm2 & SSL_HANDSHAKE_MAC_MASK;
/* XXX - can we simplify this now that TLSv1.0 and TLSv1.1 are gone? */
/* For TLSv1.2 we upgrade the default MD5+SHA1 MAC to SHA256. */
if (SSL_USE_SHA256_PRF(s) && handshake_mac == SSL_HANDSHAKE_MAC_DEFAULT)
handshake_mac = SSL_HANDSHAKE_MAC_SHA256;
@ -1624,6 +1625,21 @@ SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c)
}
LSSL_ALIAS(SSL_CIPHER_get_auth_nid);
const EVP_MD *
SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c)
{
switch (c->algorithm2 & SSL_HANDSHAKE_MAC_MASK) {
case SSL_HANDSHAKE_MAC_DEFAULT:
case SSL_HANDSHAKE_MAC_SHA256:
return EVP_sha256();
case SSL_HANDSHAKE_MAC_SHA384:
return EVP_sha384();
default:
return NULL;
}
}
LSSL_ALIAS(SSL_CIPHER_get_handshake_digest);
int
SSL_CIPHER_is_aead(const SSL_CIPHER *c)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_err.c,v 1.50 2024/07/13 17:42:13 tb Exp $ */
/* $OpenBSD: ssl_err.c,v 1.51 2024/07/14 15:56:08 tb Exp $ */
/* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
@ -476,6 +476,7 @@ ERR_load_SSL_strings(void)
{
#ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(SSL_str_functs[0].error) == NULL) {
/* TMP UGLY CASTS */
ERR_load_strings(0, (ERR_STRING_DATA *)SSL_str_functs);
ERR_load_strings(0, (ERR_STRING_DATA *)SSL_str_reasons);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_local.h,v 1.17 2024/06/25 14:10:45 jsing Exp $ */
/* $OpenBSD: ssl_local.h,v 1.18 2024/07/15 14:45:15 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -255,15 +255,6 @@ __BEGIN_HIDDEN_DECLS
#define SSL3_CK_ID 0x03000000
#define SSL3_CK_VALUE_MASK 0x0000ffff
#define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT)
#define TLS1_PRF_DGST_SHIFT 10
#define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT)
#define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT)
#define TLS1_PRF_SHA256 (SSL_HANDSHAKE_MAC_SHA256 << TLS1_PRF_DGST_SHIFT)
#define TLS1_PRF_SHA384 (SSL_HANDSHAKE_MAC_SHA384 << TLS1_PRF_DGST_SHIFT)
#define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1)
/*
* Cipher strength information.
*/

View file

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.58 2021/08/31 09:58:17 jasper Exp $
# $OpenBSD: Makefile,v 1.59 2024/07/14 09:48:48 jca Exp $
SUBDIR+= _setjmp
SUBDIR+= alloca arc4random-fork atexit
SUBDIR+= basename
SUBDIR+= cephes cxa-atexit
SUBDIR+= db dirname
SUBDIR+= elf_aux_info
SUBDIR+= env explicit_bzero
SUBDIR+= ffs fmemopen fnmatch fpclassify fread
SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob

View file

@ -0,0 +1,5 @@
PROG=elf_aux_info
WARNINGS=yes
.include <bsd.regress.mk>

View file

@ -0,0 +1,53 @@
#include <sys/auxv.h>
#include <errno.h>
#include <stdio.h>
int
main(void)
{
int ret = 0;
int a;
unsigned long b;
/* Should always succeed */
if (elf_aux_info(AT_PAGESZ, &a, sizeof(a)))
ret |= 1;
else
fprintf(stderr, "AT_PAGESZ %d\n", a);
/* Wrong size */
if (elf_aux_info(AT_PAGESZ, &b, sizeof(b)) != EINVAL)
ret |= 2;
/* Invalid request */
if (elf_aux_info(-1, &a, sizeof(a)) != EINVAL)
ret |= 4;
/* Should either succeed or fail with ENOENT if not supported */
switch (elf_aux_info(AT_HWCAP, &b, sizeof(b))) {
case 0:
fprintf(stderr, "AT_HWCAP %lx\n", b);
break;
case ENOENT:
break;
default:
ret |= 8;
}
/* Should either succeed or fail with ENOENT if not supported */
switch (elf_aux_info(AT_HWCAP2, &b, sizeof(b))) {
case 0:
fprintf(stderr, "AT_HWCAP2 %lx\n", b);
break;
case ENOENT:
break;
default:
ret |= 16;
}
if (ret)
fprintf(stderr, "FAILED (status %x)\n", ret);
return ret;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: t_exhaust.c,v 1.3 2012/12/05 23:20:07 deraadt Exp $ */
/* $OpenBSD: t_exhaust.c,v 1.4 2024/07/15 10:11:56 anton Exp $ */
/* $NetBSD: t_exhaust.c,v 1.2 2011/10/21 00:41:34 christos Exp $ */
/*-
@ -158,8 +158,8 @@ static char *(*patterns[])(size_t) = {
p6,
};
main()
int
main(void)
{
regex_t re;
int e, ret = 0;
@ -181,4 +181,3 @@ main()
}
return ret;
}

View file

@ -1,5 +1,7 @@
# $OpenBSD: Makefile,v 1.1.1.1 2024/06/28 21:07:27 bluhm Exp $
# $OpenBSD: Makefile,v 1.2 2024/07/14 18:49:32 anton Exp $
PROG= unp-write-closed
WARNINGS= yes
.include <bsd.regress.mk>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: unp-write-closed.c,v 1.1.1.1 2024/06/28 21:07:27 bluhm Exp $ */
/* $OpenBSD: unp-write-closed.c,v 1.2 2024/07/14 18:49:32 anton Exp $ */
/*
* Copyright (c) 2024 Vitaliy Makkoveev <mvs@openbsd.org>
* Copyright (c) 2024 Alenander Bluhm <bluhm@openbsd.org>
@ -27,7 +27,7 @@
sig_atomic_t done = 0;
void
static void
handler(int sigraised)
{
done = 1;

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: bioctl.8,v 1.114 2023/09/02 09:14:47 kn Exp $
.\" $OpenBSD: bioctl.8,v 1.116 2024/07/15 05:36:08 jmc Exp $
.\"
.\" Copyright (c) 2004, 2005 Marco Peereboom
.\"
@ -23,12 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: September 2 2023 $
.Dd $Mdocdate: July 15 2024 $
.Dt BIOCTL 8
.Os
.Sh NAME
.Nm bioctl
.Nd RAID management interface
.Nd storage management interface
.Sh SYNOPSIS
.Nm bioctl
.Op Fl hiqv
@ -52,33 +52,56 @@
.Op Fl r Ar rounds
.Ar device
.Sh DESCRIPTION
RAID device drivers which support management functionality can
register their services with the
.Xr bio 4
driver.
.Nm bioctl
then can be used to maintain RAID volumes.
is used to interact with device drivers that register with
.Xr bio 4 .
.Pp
In the first synopsis,
RAID controllers are managed.
The
.Fl h ,
.Fl i ,
.Fl q ,
and
.Fl v
options are used to display information about the specified
.Ar device :
.Bl -tag -width disable
.It Fl h
Where appropriate, produce
.Dq human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of
digits to four or less.
.It Fl i
Display default information for the specified device.
For example, for hardware RAID controllers enumerate attached devices.
This is the default if no options are specified.
.It Fl q
If
.Ar device
specifies either a drive (e.g. sd0) or a RAID controller (e.g. ami0).
For operations which will be performed against
is an
.Xr sd 4 ,
display its vendor, product, revision, and serial number.
.It Fl v
Be more verbose in output.
.El
.Pp
The first synopsis shows options used to manage
hardware RAID controllers.
.Ar device
specifies either a drive (e.g. sd1), a hardware RAID controller (e.g. ami0) or a
.Xr ses 4
or
.Xr safte 4
enclosures, it is also possible to directly specify the enclosure name
(e.g. safte0).
enclosure.
.Pp
In the second synopsis,
The second synopsis shows options used to manage
.Xr softraid 4
volumes are managed.
.Ar device
specifies either a volume (e.g. sd0) or the
.Xr softraid 4
controller (always softraid0).
volumes (e.g. sd0)
or the softraid controller itself
(always softraid0).
.Pp
The options for RAID controllers are as follows:
The options for hardware RAID controllers are as follows:
.Bl -tag -width Ds
.It Fl a Ar alarm-function
Control the RAID card's alarm functionality, if supported.
@ -116,29 +139,13 @@ is currently marked
.Dq Unused ,
promote it to being a
.Dq Hot Spare .
.It Fl h
Where necessary, produce
.Dq human-readable
output.
Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of
digits to four or less.
.It Fl i
Enumerate the selected RAID devices.
This is the default if no other option is given.
.It Fl q
Show vendor, product, revision, and serial number for the given disk.
.It Fl R Ar chunk | channel : Ns Ar target Ns Op Pf . Ar lun
Manually kick off a rebuild of a degraded RAID volume, using
.Ar chunk
or
.Ar channel : Ns Ar target Ns Op Pf . Ar lun
as a new chunk (with
.Xr softraid 4 ,
a partition of fstype
.Dq RAID ) ,
replacing the offline chunk in the volume;
it is not possible to change the number of chunks.
as a new chunk replacing the offline chunk in the volume.
It is not possible to change the number of chunks.
The
.Ar chunk
must be specified as a full path to a device file (e.g. /dev/wd0d).
@ -174,12 +181,9 @@ to cease blinking, if there is
or
.Xr safte 4
support in the enclosure.
.It Fl v
Be more verbose in output.
.El
.Pp
In addition to the relevant options listed above,
the options for
The options for
.Xr softraid 4
devices are as follows:
.Bl -tag -width Ds
@ -276,6 +280,21 @@ Change the passphrase on the selected crypto volume.
.It Fl p Ar passfile
Passphrase file used when crypto volumes are brought up.
This file must be root owned and have 0600 permissions.
.It Fl R Ar chunk | channel : Ns Ar target Ns Op Pf . Ar lun
Manually kick off a rebuild of a degraded volume, using
.Ar chunk
or
.Ar channel : Ns Ar target Ns Op Pf . Ar lun
as a new chunk,
replacing the offline chunk in the volume.
It is not possible to change the number of chunks.
The
.Ar chunk
must be specified as a full path to a device file (e.g. /dev/sd0d) which
refers to a partition of fstype RAID.
A
.Xr softraid 4
volume rather than softraid0 is expected as the final argument.
.It Fl r Ar rounds
The number of iterations for the KDF algorithm to use when converting a
passphrase into a key, in order to create a new encrypted volume or change the
@ -336,6 +355,11 @@ using a new chunk on wd0d:
.Bd -literal -offset 3n
# bioctl -R /dev/wd0d sd0
.Ed
.Pp
Show detailed information about the nvme0 controller:
.Bd -literal -offset 3n
# bioctl -v nvme0
.Ed
.Sh SEE ALSO
.Xr bio 4 ,
.Xr scsi 4 ,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bioctl.c,v 1.157 2023/10/07 12:20:10 kn Exp $ */
/* $OpenBSD: bioctl.c,v 1.158 2024/07/15 05:36:08 jmc Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@ -288,13 +288,12 @@ usage(void)
"[-R chunk | channel:target[.lun]]\n"
"\t[-t patrol-function] "
"[-u channel:target[.lun]] "
"device\n"
"device\n\n"
" %s [-dhiPqsv] "
"[-C flag[,...]] [-c raidlevel] [-k keydisk]\n"
"\t[-l chunk[,...]] "
"[-O device | channel:target[.lun]]\n"
"\t[-p passfile] [-R chunk | channel:target[.lun]]\n"
"\t[-r rounds] "
"[-O device | channel:target[.lun]] [-p passfile]\n"
"\t[-R chunk | channel:target[.lun]] [-r rounds] "
"device\n", __progname, __progname);
exit(1);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: log.h,v 1.4 2024/06/03 17:58:33 deraadt Exp $ */
/* $OpenBSD: log.h,v 1.5 2024/07/14 08:45:05 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -47,7 +47,7 @@ __dead void fatalx(const char *, ...)
#define log_init(x...) do {} while (0)
#define log_procinit(x...) do {} while (0)
#define log_setverbose(x...) do {} while (0)
#define log_getverbose(x...) (0)
#define log_getverbose() (0)
#define log_warn(x...) do {} while (0)
#define log_warnx(x...) do {} while (0)
#define log_info(x...) do {} while (0)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: setup.c,v 1.33 2019/07/01 07:13:44 kevlo Exp $ */
/* $OpenBSD: setup.c,v 1.34 2024/07/15 13:32:50 martijn Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
@ -347,6 +347,10 @@ readsb(int listerr)
asblk.b_un.b_fs->e2fs_features_rocompat &= ~EXT2F_ROCOMPAT_LARGE_FILE;
asblk.b_un.b_fs->e2fs_features_rocompat |=
sblk.b_un.b_fs->e2fs_features_rocompat & EXT2F_ROCOMPAT_LARGE_FILE;
memcpy(asblk.b_un.b_fs->e2fs_fsmnt, sblk.b_un.b_fs->e2fs_fsmnt,
sizeof(sblk.b_un.b_fs->e2fs_fsmnt));
asblk.b_un.b_fs->e2fs_kbytes_written = sblk.b_un.b_fs->e2fs_kbytes_written;
if (sblock.e2fs.e2fs_rev > E2FS_REV0 &&
((sblock.e2fs.e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP) ||
(sblock.e2fs.e2fs_features_rocompat & ~EXT2F_ROCOMPAT_SUPP))) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vroute.c,v 1.19 2023/06/13 12:34:12 tb Exp $ */
/* $OpenBSD: vroute.c,v 1.20 2024/07/14 13:13:33 tobhe Exp $ */
/*
* Copyright (c) 2021 Tobias Heider <tobhe@openbsd.org>
@ -631,6 +631,8 @@ vroute_getroute(struct iked *env, struct imsg *imsg)
case IMSG_VROUTE_DEL:
type = RTM_DELETE;
break;
default:
return (-1);
}
if (type == RTM_ADD)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.715 2023/11/02 20:47:31 sthen Exp $ */
/* $OpenBSD: parse.y,v 1.716 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@ -379,6 +379,8 @@ int getservice(char *);
int rule_label(struct pf_rule *, char *);
void mv_rules(struct pf_ruleset *, struct pf_ruleset *);
void mv_tables(struct pfctl *, struct pfr_ktablehead *,
struct pf_anchor *, struct pf_anchor *);
void decide_address_family(struct node_host *, sa_family_t *);
int invalid_redirect(struct node_host *, sa_family_t);
u_int16_t parseicmpspec(char *, sa_family_t);
@ -827,6 +829,7 @@ anchorname : STRING {
pfa_anchorlist : /* empty */
| pfa_anchorlist '\n'
| pfa_anchorlist tabledef '\n'
| pfa_anchorlist pfrule '\n'
| pfa_anchorlist anchorrule '\n'
| pfa_anchorlist include '\n'
@ -853,7 +856,7 @@ pfa_anchor : '{'
snprintf(ta, PF_ANCHOR_NAME_SIZE, "_%d", pf->bn);
rs = pf_find_or_create_ruleset(ta);
if (rs == NULL)
err(1, "pfa_anchor: pf_find_or_create_ruleset");
err(1, "pfa_anchor: pf_find_or_create_ruleset (%s)", ta);
pf->astack[pf->asd] = rs->anchor;
pf->anchor = rs->anchor;
} '\n' pfa_anchorlist '}'
@ -899,6 +902,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto
}
mv_rules(&pf->alast->ruleset,
&r.anchor->ruleset);
mv_tables(pf, &pfr_ktables, r.anchor, pf->alast);
}
pf_remove_if_empty_ruleset(&pf->alast->ruleset);
pf->alast = r.anchor;
@ -3976,6 +3980,7 @@ process_tabledef(char *name, struct table_opts *opts, int popts)
{
struct pfr_buffer ab;
struct node_tinit *ti;
struct pfr_uktable *ukt;
bzero(&ab, sizeof(ab));
ab.pfrb_type = PFRB_ADDRS;
@ -4006,13 +4011,52 @@ process_tabledef(char *name, struct table_opts *opts, int popts)
else if (pf->opts & PF_OPT_VERBOSE)
fprintf(stderr, "%s:%d: skipping duplicate table checks"
" for <%s>\n", file->name, yylval.lineno, name);
/*
* postpone definition of non-root tables to moment
* when path is fully resolved.
*/
if (pf->asd > 0) {
ukt = calloc(1, sizeof(struct pfr_uktable));
if (ukt == NULL) {
DBGPRINT(
"%s:%d: not enough memory for <%s>\n", file->name,
yylval.lineno, name);
goto _error;
}
} else
ukt = NULL;
if (!(pf->opts & PF_OPT_NOACTION) &&
pfctl_define_table(name, opts->flags, opts->init_addr,
pf->anchor->path, &ab, pf->anchor->ruleset.tticket)) {
pf->anchor->path, &ab, pf->anchor->ruleset.tticket, ukt)) {
yyerror("cannot define table %s: %s", name,
pf_strerror(errno));
goto _error;
}
if (ukt != NULL) {
ukt->pfrukt_init_addr = opts->init_addr;
if (RB_INSERT(pfr_ktablehead, &pfr_ktables,
&ukt->pfrukt_kt) != NULL) {
/*
* I think this should not happen, because
* pfctl_define_table() above does the same check
* effectively.
*/
DBGPRINT(
"%s:%d table %s already exists in %s\n",
file->name, yylval.lineno,
ukt->pfrukt_name, pf->anchor->path);
free(ukt);
goto _error;
}
DBGPRINT("%s %s@%s inserted to tree\n",
__func__, ukt->pfrukt_name, pf->anchor->path);
} else
DBGPRINT("%s ukt is null\n", __func__);
pf->tdirty = 1;
pfr_buf_clear(&ab);
return (0);
@ -5555,6 +5599,62 @@ mv_rules(struct pf_ruleset *src, struct pf_ruleset *dst)
TAILQ_CONCAT(dst->rules.inactive.ptr, src->rules.inactive.ptr, entries);
}
void
mv_tables(struct pfctl *pf, struct pfr_ktablehead *ktables,
struct pf_anchor *a, struct pf_anchor *alast)
{
struct pfr_ktable *kt, *kt_safe;
char new_path[PF_ANCHOR_MAXPATH];
char *path_cut;
int sz;
struct pfr_uktable *ukt;
SLIST_HEAD(, pfr_uktable) ukt_list;;
/*
* Here we need to rename anchor path from temporal names such as
* _1/_2/foo to _1/bar/foo etc.
*
* This also means we need to remove and insert table to ktables
* tree as anchor path is being updated.
*/
SLIST_INIT(&ukt_list);
DBGPRINT("%s [ %s ] (%s)\n", __func__, a->path, alast->path);
RB_FOREACH_SAFE(kt, pfr_ktablehead, ktables, kt_safe) {
path_cut = strstr(kt->pfrkt_anchor, alast->path);
if (path_cut != NULL) {
path_cut += strlen(alast->path);
if (*path_cut)
sz = snprintf(new_path, sizeof (new_path),
"%s%s", a->path, path_cut);
else
sz = snprintf(new_path, sizeof (new_path),
"%s", a->path);
if (sz >= sizeof (new_path))
errx(1, "new path is too long for %s@%s\n",
kt->pfrkt_name, kt->pfrkt_anchor);
DBGPRINT("%s %s@%s -> %s@%s\n", __func__,
kt->pfrkt_name, kt->pfrkt_anchor,
kt->pfrkt_name, new_path);
RB_REMOVE(pfr_ktablehead, ktables, kt);
strlcpy(kt->pfrkt_anchor, new_path,
sizeof(kt->pfrkt_anchor));
SLIST_INSERT_HEAD(&ukt_list, (struct pfr_uktable *)kt,
pfrukt_entry);
}
}
while ((ukt = SLIST_FIRST(&ukt_list)) != NULL) {
SLIST_REMOVE_HEAD(&ukt_list, pfrukt_entry);
if (RB_INSERT(pfr_ktablehead, ktables,
(struct pfr_ktable *)ukt) != NULL)
errx(1, "%s@%s exists already\n",
ukt->pfrukt_name,
ukt->pfrukt_anchor);
}
}
void
decide_address_family(struct node_host *n, sa_family_t *af)
{
@ -5711,7 +5811,7 @@ parseport(char *port, struct range *r, int extensions)
}
int
pfctl_load_anchors(int dev, struct pfctl *pf, struct pfr_buffer *trans)
pfctl_load_anchors(int dev, struct pfctl *pf)
{
struct loadanchors *la;
@ -5720,7 +5820,7 @@ pfctl_load_anchors(int dev, struct pfctl *pf, struct pfr_buffer *trans)
fprintf(stderr, "\nLoading anchor %s from %s\n",
la->anchorname, la->filename);
if (pfctl_rules(dev, la->filename, pf->opts, pf->optimize,
la->anchorname, trans) == -1)
la->anchorname, pf->trans) == -1)
return (-1);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl.c,v 1.394 2024/02/02 08:23:29 sashan Exp $ */
/* $OpenBSD: pfctl.c,v 1.395 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -1424,6 +1424,41 @@ pfctl_check_qassignments(struct pf_ruleset *rs)
return (errs);
}
static int
pfctl_load_tables(struct pfctl *pf, char *path, struct pf_anchor *a)
{
struct pfr_ktable *kt, *ktw;
struct pfr_uktable *ukt;
uint32_t ticket;
char anchor_path[PF_ANCHOR_MAXPATH];
int e;
RB_FOREACH_SAFE(kt, pfr_ktablehead, &pfr_ktables, ktw) {
if (strcmp(kt->pfrkt_anchor, a->path) != 0)
continue;
if (path != NULL && *path) {
strlcpy(anchor_path, kt->pfrkt_anchor,
sizeof (anchor_path));
snprintf(kt->pfrkt_anchor, PF_ANCHOR_MAXPATH, "%s/%s",
path, anchor_path);
}
ukt = (struct pfr_uktable *) kt;
ticket = pfctl_get_ticket(pf->trans, PF_TRANS_TABLE, path);
e = pfr_ina_define(&ukt->pfrukt_t, ukt->pfrukt_addrs.pfrb_caddr,
ukt->pfrukt_addrs.pfrb_size, NULL, NULL, ticket,
ukt->pfrukt_init_addr ? PFR_FLAG_ADDRSTOO : 0);
if (e != 0)
err(1, "%s pfr_ina_define() %s@%s", __func__,
kt->pfrkt_name, kt->pfrkt_anchor);
RB_REMOVE(pfr_ktablehead, &pfr_ktables, kt);
pfr_buf_clear(&ukt->pfrukt_addrs);
free(ukt);
}
return (0);
}
int
pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs,
int depth)
@ -1469,6 +1504,8 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs,
if ((error = pfctl_load_ruleset(pf, path,
&r->anchor->ruleset, depth + 1)))
goto error;
if ((error = pfctl_load_tables(pf, path, r->anchor)))
goto error;
} else if (pf->opts & PF_OPT_VERBOSE)
printf("\n");
free(r);
@ -1495,8 +1532,11 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth)
bzero(&pr, sizeof(pr));
/* set up anchor before adding to path for anchor_call */
if ((pf->opts & PF_OPT_NOACTION) == 0)
if ((pf->opts & PF_OPT_NOACTION) == 0) {
if (pf->trans == NULL)
errx(1, "pfctl_load_rule: no transaction");
pr.ticket = pfctl_get_ticket(pf->trans, PF_TRANS_RULESET, path);
}
if (strlcpy(pr.anchor, path, sizeof(pr.anchor)) >= sizeof(pr.anchor))
errx(1, "pfctl_load_rule: strlcpy");
@ -1535,8 +1575,8 @@ int
pfctl_rules(int dev, char *filename, int opts, int optimize,
char *anchorname, struct pfr_buffer *trans)
{
#define ERR(x) do { warn(x); goto _error; } while(0)
#define ERRX(x) do { warnx(x); goto _error; } while(0)
#define ERR(...) do { warn(__VA_ARGS__); goto _error; } while(0)
#define ERRX(...) do { warnx(__VA_ARGS__); goto _error; } while(0)
struct pfr_buffer *t, buf;
struct pfctl pf;
@ -1549,9 +1589,13 @@ pfctl_rules(int dev, char *filename, int opts, int optimize,
RB_INIT(&pf_anchors);
memset(&pf_main_anchor, 0, sizeof(pf_main_anchor));
pf_init_ruleset(&pf_main_anchor.ruleset);
memset(&pf, 0, sizeof(pf));
memset(&trs, 0, sizeof(trs));
if (trans == NULL) {
bzero(&buf, sizeof(buf));
buf.pfrb_type = PFRB_TRANS;
pf.trans = &buf;
t = &buf;
osize = 0;
} else {
@ -1559,20 +1603,18 @@ pfctl_rules(int dev, char *filename, int opts, int optimize,
osize = t->pfrb_size;
}
memset(&pf, 0, sizeof(pf));
memset(&trs, 0, sizeof(trs));
if ((path = calloc(1, PATH_MAX)) == NULL)
ERRX("pfctl_rules: calloc");
ERR("%s: calloc", __func__);
if (strlcpy(trs.pfrt_anchor, anchorname,
sizeof(trs.pfrt_anchor)) >= sizeof(trs.pfrt_anchor))
ERRX("pfctl_rules: strlcpy");
ERRX("%s: strlcpy", __func__);
pf.dev = dev;
pf.opts = opts;
pf.optimize = optimize;
/* non-brace anchor, create without resolving the path */
if ((pf.anchor = calloc(1, sizeof(*pf.anchor))) == NULL)
ERRX("pfctl_rules: calloc");
ERR("%s: calloc", __func__);
rs = &pf.anchor->ruleset;
pf_init_ruleset(rs);
rs->anchor = pf.anchor;
@ -1637,7 +1679,7 @@ pfctl_rules(int dev, char *filename, int opts, int optimize,
/*
* process "load anchor" directives that might have used queues
*/
if (pfctl_load_anchors(dev, &pf, t) == -1)
if (pfctl_load_anchors(dev, &pf) == -1)
ERRX("load anchors");
pfctl_clear_queues(&qspecs);
pfctl_clear_queues(&rootqs);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl.h,v 1.63 2024/05/19 10:39:40 jsg Exp $ */
/* $OpenBSD: pfctl.h,v 1.64 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -33,6 +33,12 @@
#ifndef _PFCTL_H_
#define _PFCTL_H_
#ifdef PFCTL_DEBUG
#define DBGPRINT(...) fprintf(stderr, __VA_ARGS__)
#else
#define DBGPRINT(...) (void)(0)
#endif
enum pfctl_show { PFCTL_SHOW_RULES, PFCTL_SHOW_LABELS, PFCTL_SHOW_NOTHING };
enum { PFRB_TABLES = 1, PFRB_TSTATS, PFRB_ADDRS, PFRB_ASTATS,
@ -54,6 +60,20 @@ struct pfr_anchoritem {
char *pfra_anchorname;
};
struct pfr_uktable {
struct pfr_ktable pfrukt_kt;
struct pfr_buffer pfrukt_addrs;
int pfrukt_init_addr;
SLIST_ENTRY(pfr_uktable)
pfrukt_entry;
};
#define pfrukt_t pfrukt_kt.pfrkt_ts.pfrts_t
#define pfrukt_name pfrukt_kt.pfrkt_t.pfrt_name
#define pfrukt_anchor pfrukt_kt.pfrkt_t.pfrt_anchor
extern struct pfr_ktablehead pfr_ktables;
SLIST_HEAD(pfr_anchors, pfr_anchoritem);
int pfr_clr_tables(struct pfr_table *, int *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl_optimize.c,v 1.49 2022/01/28 05:24:15 guenther Exp $ */
/* $OpenBSD: pfctl_optimize.c,v 1.50 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2004 Mike Frantzen <frantzen@openbsd.org>
@ -1288,7 +1288,8 @@ again:
tablenum++;
if (pfctl_define_table(tbl->pt_name, PFR_TFLAG_CONST | tbl->pt_flags, 1,
pf->astack[0]->path, tbl->pt_buf, pf->astack[0]->ruleset.tticket)) {
pf->astack[0]->path, tbl->pt_buf, pf->astack[0]->ruleset.tticket,
NULL)) {
warn("failed to create table %s in %s",
tbl->pt_name, pf->astack[0]->name);
return (1);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl_parser.h,v 1.119 2024/01/15 07:23:32 sashan Exp $ */
/* $OpenBSD: pfctl_parser.h,v 1.120 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -85,6 +85,7 @@ struct pfctl {
struct pfioc_queue *pqueue;
struct pfr_buffer *trans;
struct pf_anchor *anchor, *alast;
struct pfr_ktablehead pfr_ktlast;
const char *ruleset;
/* 'set foo' options */
@ -211,6 +212,8 @@ struct pfctl_watermarks {
u_int32_t lo;
};
struct pfr_uktable;
void copy_satopfaddr(struct pf_addr *, struct sockaddr *);
int pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *);
@ -234,7 +237,7 @@ int pfctl_set_interface_flags(struct pfctl *, char *, int, int);
int parse_config(char *, struct pfctl *);
int parse_flags(char *);
int pfctl_load_anchors(int, struct pfctl *, struct pfr_buffer *);
int pfctl_load_anchors(int, struct pfctl *);
int pfctl_load_queues(struct pfctl *);
int pfctl_add_queue(struct pfctl *, struct pf_queuespec *);
@ -248,7 +251,7 @@ void print_status(struct pf_status *, struct pfctl_watermarks *, int);
void print_queuespec(struct pf_queuespec *);
int pfctl_define_table(char *, int, int, const char *, struct pfr_buffer *,
u_int32_t);
u_int32_t, struct pfr_uktable *);
void pfctl_expand_label_nr(struct pf_rule *, unsigned int);
void pfctl_clear_fingerprints(int, int);
@ -298,5 +301,8 @@ struct node_host *host(const char *, int);
int append_addr(struct pfr_buffer *, char *, int, int);
int append_addr_host(struct pfr_buffer *,
struct node_host *, int, int);
int pfr_ktable_compare(struct pfr_ktable *,
struct pfr_ktable *);
RB_PROTOTYPE(pfr_ktablehead, pfr_ktable, pfrkt_tree, pfr_ktable_compare);
#endif /* _PFCTL_PARSER_H_ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl_radix.c,v 1.38 2023/09/05 15:37:07 robert Exp $ */
/* $OpenBSD: pfctl_radix.c,v 1.39 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@ -55,6 +55,18 @@ extern int dev;
static int pfr_next_token(char buf[BUF_SIZE], FILE *);
struct pfr_ktablehead pfr_ktables = { 0 };
RB_GENERATE(pfr_ktablehead, pfr_ktable, pfrkt_tree, pfr_ktable_compare);
int
pfr_ktable_compare(struct pfr_ktable *p, struct pfr_ktable *q)
{
int d;
if ((d = strncmp(p->pfrkt_name, q->pfrkt_name, PF_TABLE_NAME_SIZE)))
return (d);
return (strcmp(p->pfrkt_anchor, q->pfrkt_anchor));
}
int
pfr_clr_tables(struct pfr_table *filter, int *ndel, int flags)
@ -352,6 +364,7 @@ pfr_ina_define(struct pfr_table *tbl, struct pfr_addr *addr, int size,
struct pfioc_table io;
if (tbl == NULL || size < 0 || (size && addr == NULL)) {
DBGPRINT("%s %p %d %p\n", __func__, tbl, size, addr);
errno = EINVAL;
return (-1);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pfctl_table.c,v 1.88 2024/05/09 08:35:40 florian Exp $ */
/* $OpenBSD: pfctl_table.c,v 1.89 2024/07/14 19:51:08 sashan Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@ -520,18 +520,48 @@ print_astats(struct pfr_astats *as, int dns)
int
pfctl_define_table(char *name, int flags, int addrs, const char *anchor,
struct pfr_buffer *ab, u_int32_t ticket)
struct pfr_buffer *ab, u_int32_t ticket, struct pfr_uktable *ukt)
{
struct pfr_table tbl;
struct pfr_table tbl_buf;
struct pfr_table *tbl;
bzero(&tbl, sizeof(tbl));
if (strlcpy(tbl.pfrt_name, name, sizeof(tbl.pfrt_name)) >=
sizeof(tbl.pfrt_name) || strlcpy(tbl.pfrt_anchor, anchor,
sizeof(tbl.pfrt_anchor)) >= sizeof(tbl.pfrt_anchor))
errx(1, "pfctl_define_table: strlcpy");
tbl.pfrt_flags = flags;
if (ukt == NULL) {
bzero(&tbl_buf, sizeof(tbl_buf));
tbl = &tbl_buf;
} else {
if (ab->pfrb_size != 0) {
/*
* copy IP addresses which come with table from
* temporal buffer to buffer attached to table.
*/
ukt->pfrukt_addrs = *ab;
ab->pfrb_size = 0;
ab->pfrb_msize = 0;
ab->pfrb_caddr = NULL;
} else
memset(&ukt->pfrukt_addrs, 0,
sizeof(struct pfr_buffer));
return pfr_ina_define(&tbl, ab->pfrb_caddr, ab->pfrb_size, NULL,
tbl = &ukt->pfrukt_t;
}
if (strlcpy(tbl->pfrt_name, name, sizeof(tbl->pfrt_name)) >=
sizeof(tbl->pfrt_name) || strlcpy(tbl->pfrt_anchor, anchor,
sizeof(tbl->pfrt_anchor)) >= sizeof(tbl->pfrt_anchor))
errx(1, "%s: strlcpy", __func__);
tbl->pfrt_flags = flags;
DBGPRINT("%s %s@%s [%x]\n", __func__, tbl->pfrt_name,
tbl->pfrt_anchor, tbl->pfrt_flags);
/*
* non-root anchors processed by parse.y are loaded to kernel later.
* Here we load tables, which are either created for root anchor
* or by 'pfctl -t ... -T ...' command.
*/
if (ukt != NULL)
return (0);
return pfr_ina_define(tbl, ab->pfrb_caddr, ab->pfrb_size, NULL,
NULL, ticket, addrs ? PFR_FLAG_ADDRSTOO : 0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: log.c,v 1.2 2021/03/20 16:46:03 kn Exp $ */
/* $OpenBSD: log.c,v 1.3 2024/07/14 08:57:32 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef SMALL
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -197,4 +197,3 @@ fatalx(const char *emsg, ...)
va_end(ap);
exit(1);
}
#endif /* SMALL */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: log.h,v 1.3 2021/12/13 18:28:40 deraadt Exp $ */
/* $OpenBSD: log.h,v 1.5 2024/07/14 08:41:54 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -20,6 +20,7 @@
#define LOG_H
#include <stdarg.h>
#include <stdlib.h>
#ifndef SMALL
void log_init(int, int);
@ -43,15 +44,16 @@ __dead void fatal(const char *, ...)
__dead void fatalx(const char *, ...)
__attribute__((__format__ (printf, 1, 2)));
#else
#define log_init(x...) do {} while(0)
#define log_procinit(x...) do {} while(0)
#define log_setverbose(x...) do {} while(0)
#define log_warn(x...) do {} while(0)
#define log_warnx(x...) do {} while(0)
#define log_info(x...) do {} while(0)
#define log_debug(x...) do {} while(0)
#define logit(x...) do {} while(0)
#define vlog(x...) do {} while(0)
#define log_init(x...) do {} while (0)
#define log_procinit(x...) do {} while (0)
#define log_setverbose(x...) do {} while (0)
#define log_getverbose() (0)
#define log_warn(x...) do {} while (0)
#define log_warnx(x...) do {} while (0)
#define log_info(x...) do {} while (0)
#define log_debug(x...) do {} while (0)
#define logit(x...) do {} while (0)
#define vlog(x...) do {} while (0)
#define fatal(x...) exit(1)
#define fatalx(x...) exit(1)
#endif /* SMALL */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmm_machdep.c,v 1.28 2024/06/26 01:40:49 jsg Exp $ */
/* $OpenBSD: vmm_machdep.c,v 1.29 2024/07/14 07:57:42 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -126,7 +126,7 @@ int svm_fault_page(struct vcpu *, paddr_t);
int vmx_fault_page(struct vcpu *, paddr_t);
int vmx_handle_np_fault(struct vcpu *);
int svm_handle_np_fault(struct vcpu *);
int vmx_mprotect_ept(vm_map_t, paddr_t, paddr_t, int);
int vmx_mprotect_ept(struct vcpu *, vm_map_t, paddr_t, paddr_t, int);
pt_entry_t *vmx_pmap_find_pte_ept(pmap_t, paddr_t);
int vmm_alloc_vpid(uint16_t *);
void vmm_free_vpid(uint16_t);
@ -777,7 +777,8 @@ vm_mprotect_ept(struct vm_mprotect_ept_params *vmep)
}
if (vmm_softc->mode == VMM_MODE_EPT)
ret = vmx_mprotect_ept(vm->vm_map, sgpa, sgpa + size, prot);
ret = vmx_mprotect_ept(vcpu, vm->vm_map, sgpa, sgpa + size,
prot);
else if (vmm_softc->mode == VMM_MODE_RVI) {
pmap_write_protect(vm->vm_map->pmap, sgpa, sgpa + size, prot);
/* XXX requires a invlpga */
@ -799,7 +800,8 @@ out_nolock:
* required.
*/
int
vmx_mprotect_ept(vm_map_t vm_map, paddr_t sgpa, paddr_t egpa, int prot)
vmx_mprotect_ept(struct vcpu *vcpu, vm_map_t vm_map, paddr_t sgpa, paddr_t egpa,
int prot)
{
struct vmx_invept_descriptor vid;
pmap_t pmap;
@ -859,7 +861,7 @@ vmx_mprotect_ept(vm_map_t vm_map, paddr_t sgpa, paddr_t egpa, int prot)
vid.vid_eptp = pmap->eptp;
DPRINTF("%s: flushing EPT TLB for EPTP 0x%llx\n", __func__,
vid.vid_eptp);
invept(IA32_VMX_INVEPT_SINGLE_CTX, &vid);
invept(vcpu->vc_vmx_invept_op, &vid);
}
KERNEL_UNLOCK();
@ -2948,6 +2950,10 @@ vcpu_init_vmx(struct vcpu *vcpu)
ret = EINVAL;
goto exit;
}
if (msr & IA32_EPT_VPID_CAP_INVEPT_CONTEXT)
vcpu->vc_vmx_invept_op = IA32_VMX_INVEPT_SINGLE_CTX;
else
vcpu->vc_vmx_invept_op = IA32_VMX_INVEPT_GLOBAL_CTX;
if (msr & IA32_EPT_VPID_CAP_WB) {
/* WB cache type supported */
@ -3896,6 +3902,7 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
struct schedstate_percpu *spc;
struct vmx_msr_store *msr_store;
struct vmx_invvpid_descriptor vid;
struct vmx_invept_descriptor vid_ept;
uint64_t cr0, eii, procbased, int_st;
u_long s;
@ -3940,14 +3947,6 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
}
memset(&vcpu->vc_exit, 0, sizeof(vcpu->vc_exit));
/* Host CR3 */
cr3 = rcr3();
if (vmwrite(VMCS_HOST_IA32_CR3, cr3)) {
printf("%s: vmwrite(0x%04X, 0x%llx)\n", __func__,
VMCS_HOST_IA32_CR3, cr3);
return (EINVAL);
}
/* Handle vmd(8) injected interrupts */
/* Is there an interrupt pending injection? */
if (vcpu->vc_inject.vie_type == VCPU_INJECT_INTR) {
@ -4001,6 +4000,22 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
ci = curcpu();
vcpu->vc_last_pcpu = ci;
/* Invalidate EPT cache. */
vid_ept.vid_reserved = 0;
vid_ept.vid_eptp = vcpu->vc_parent->vm_map->pmap->eptp;
if (invept(vcpu->vc_vmx_invept_op, &vid_ept)) {
printf("%s: invept\n", __func__);
return (EINVAL);
}
/* Host CR3 */
cr3 = rcr3();
if (vmwrite(VMCS_HOST_IA32_CR3, cr3)) {
printf("%s: vmwrite(0x%04X, 0x%llx)\n", __func__,
VMCS_HOST_IA32_CR3, cr3);
return (EINVAL);
}
setregion(&gdt, ci->ci_gdt, GDT_SIZE - 1);
if (gdt.rd_base == 0) {
printf("%s: setregion\n", __func__);

View file

@ -0,0 +1,7 @@
/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
/*
* This file is in the public domain.
*/
/* Nothing for now */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: specialreg.h,v 1.113 2024/06/24 21:22:14 bluhm Exp $ */
/* $OpenBSD: specialreg.h,v 1.114 2024/07/14 07:57:42 dv Exp $ */
/* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */
/* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */
@ -1117,6 +1117,8 @@
#define IA32_EPT_VPID_CAP_PAGE_WALK_4 (1ULL << 6)
#define IA32_EPT_VPID_CAP_WB (1ULL << 14)
#define IA32_EPT_VPID_CAP_AD_BITS (1ULL << 21)
#define IA32_EPT_VPID_CAP_INVEPT_CONTEXT (1ULL << 25)
#define IA32_EPT_VPID_CAP_INVEPT_ALL (1ULL << 26)
#define IA32_EPT_PAGING_CACHE_TYPE_UC 0x0
#define IA32_EPT_PAGING_CACHE_TYPE_WB 0x6

View file

@ -1,4 +1,4 @@
/* $OpenBSD: vmmvar.h,v 1.103 2024/07/10 09:27:32 dv Exp $ */
/* $OpenBSD: vmmvar.h,v 1.104 2024/07/14 07:57:42 dv Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@ -886,6 +886,7 @@ struct vcpu {
uint32_t vc_vmx_vmcs_state; /* [a] */
#define VMCS_CLEARED 0
#define VMCS_LAUNCHED 1
uint64_t vc_vmx_invept_op;
/* SVM only (all requiring [v]) */
vaddr_t vc_svm_hsa_va;

View file

@ -0,0 +1,77 @@
/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 David E. O'Brien
* Copyright (c) 1996-1997 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _MACHINE_ELF_H_
#define _MACHINE_ELF_H_
/*
* ELF definitions for the ARM architecture.
*/
#ifdef _KERNEL
# define __HAVE_CPU_HWCAP
# define __HAVE_CPU_HWCAP2
extern unsigned long hwcap, hwcap2;
#endif /* _KERNEL */
/* Flags passed in AT_HWCAP. */
#define HWCAP_SWP 0x00000001 /* Unsupported, never set. */
#define HWCAP_HALF 0x00000002 /* Always set. */
#define HWCAP_THUMB 0x00000004
#define HWCAP_26BIT 0x00000008 /* Unsupported, never set. */
#define HWCAP_FAST_MULT 0x00000010 /* Always set. */
#define HWCAP_FPA 0x00000020 /* Unsupported, never set. */
#define HWCAP_VFP 0x00000040
#define HWCAP_EDSP 0x00000080 /* Always set for ARMv6+. */
#define HWCAP_JAVA 0x00000100 /* Unsupported, never set. */
#define HWCAP_IWMMXT 0x00000200 /* Unsupported, never set. */
#define HWCAP_CRUNCH 0x00000400 /* Unsupported, never set. */
#define HWCAP_THUMBEE 0x00000800
#define HWCAP_NEON 0x00001000
#define HWCAP_VFPv3 0x00002000
#define HWCAP_VFPv3D16 0x00004000
#define HWCAP_TLS 0x00008000 /* Always set for ARMv6+. */
#define HWCAP_VFPv4 0x00010000
#define HWCAP_IDIVA 0x00020000
#define HWCAP_IDIVT 0x00040000
#define HWCAP_VFPD32 0x00080000
#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
#define HWCAP_LPAE 0x00100000
#define HWCAP_EVTSTRM 0x00200000 /* Not implemented yet. */
/* Flags passed in AT_HWCAP2. */
#define HWCAP2_AES 0x00000001
#define HWCAP2_PMULL 0x00000002
#define HWCAP2_SHA1 0x00000004
#define HWCAP2_SHA2 0x00000008
#define HWCAP2_CRC32 0x00000010
#endif /* !_MACHINE_ELF_H_ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.125 2024/07/11 12:07:39 kettenis Exp $ */
/* $OpenBSD: cpu.c,v 1.126 2024/07/14 09:48:48 jca Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@ -32,6 +32,7 @@
#include <uvm/uvm.h>
#include <machine/fdt.h>
#include <machine/elf.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_clock.h>
@ -741,6 +742,10 @@ cpu_identify(struct cpu_info *ci)
printf("%sAtomic", sep);
sep = ",";
arm64_has_lse = 1;
/*
* XXX should be populated and sanitized like cpu_sysctl() does
*/
hwcap |= HWCAP_ATOMICS;
}
if (ID_AA64ISAR0_CRC32(id) >= ID_AA64ISAR0_CRC32_BASE) {

View file

@ -0,0 +1,121 @@
/*-
* Copyright (c) 1996-1997 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _MACHINE_ELF_H_
#define _MACHINE_ELF_H_
/*
* ELF definitions for the AArch64 architecture.
*/
#ifdef _KERNEL
# define __HAVE_CPU_HWCAP
# define __HAVE_CPU_HWCAP2
extern unsigned long hwcap, hwcap2;
#endif /* _KERNEL */
/* HWCAP */
#define HWCAP_FP 0x00000001
#define HWCAP_ASIMD 0x00000002
#define HWCAP_EVTSTRM 0x00000004
#define HWCAP_AES 0x00000008
#define HWCAP_PMULL 0x00000010
#define HWCAP_SHA1 0x00000020
#define HWCAP_SHA2 0x00000040
#define HWCAP_CRC32 0x00000080
#define HWCAP_ATOMICS 0x00000100
#define HWCAP_FPHP 0x00000200
#define HWCAP_ASIMDHP 0x00000400
#define HWCAP_CPUID 0x00000800
#define HWCAP_ASIMDRDM 0x00001000
#define HWCAP_JSCVT 0x00002000
#define HWCAP_FCMA 0x00004000
#define HWCAP_LRCPC 0x00008000
#define HWCAP_DCPOP 0x00010000
#define HWCAP_SHA3 0x00020000
#define HWCAP_SM3 0x00040000
#define HWCAP_SM4 0x00080000
#define HWCAP_ASIMDDP 0x00100000
#define HWCAP_SHA512 0x00200000
#define HWCAP_SVE 0x00400000
#define HWCAP_ASIMDFHM 0x00800000
#define HWCAP_DIT 0x01000000
#define HWCAP_USCAT 0x02000000
#define HWCAP_ILRCPC 0x04000000
#define HWCAP_FLAGM 0x08000000
#define HWCAP_SSBS 0x10000000
#define HWCAP_SB 0x20000000
#define HWCAP_PACA 0x40000000
#define HWCAP_PACG 0x80000000
/* HWCAP2 */
#define HWCAP2_DCPODP 0x0000000000000001ul
#define HWCAP2_SVE2 0x0000000000000002ul
#define HWCAP2_SVEAES 0x0000000000000004ul
#define HWCAP2_SVEPMULL 0x0000000000000008ul
#define HWCAP2_SVEBITPERM 0x0000000000000010ul
#define HWCAP2_SVESHA3 0x0000000000000020ul
#define HWCAP2_SVESM4 0x0000000000000040ul
#define HWCAP2_FLAGM2 0x0000000000000080ul
#define HWCAP2_FRINT 0x0000000000000100ul
#define HWCAP2_SVEI8MM 0x0000000000000200ul
#define HWCAP2_SVEF32MM 0x0000000000000400ul
#define HWCAP2_SVEF64MM 0x0000000000000800ul
#define HWCAP2_SVEBF16 0x0000000000001000ul
#define HWCAP2_I8MM 0x0000000000002000ul
#define HWCAP2_BF16 0x0000000000004000ul
#define HWCAP2_DGH 0x0000000000008000ul
#define HWCAP2_RNG 0x0000000000010000ul
#define HWCAP2_BTI 0x0000000000020000ul
#define HWCAP2_MTE 0x0000000000040000ul
#define HWCAP2_ECV 0x0000000000080000ul
#define HWCAP2_AFP 0x0000000000100000ul
#define HWCAP2_RPRES 0x0000000000200000ul
#define HWCAP2_MTE3 0x0000000000400000ul
#define HWCAP2_SME 0x0000000000800000ul
#define HWCAP2_SME_I16I64 0x0000000001000000ul
#define HWCAP2_SME_F64F64 0x0000000002000000ul
#define HWCAP2_SME_I8I32 0x0000000004000000ul
#define HWCAP2_SME_F16F32 0x0000000008000000ul
#define HWCAP2_SME_B16F32 0x0000000010000000ul
#define HWCAP2_SME_F32F32 0x0000000020000000ul
#define HWCAP2_SME_FA64 0x0000000040000000ul
#define HWCAP2_WFXT 0x0000000080000000ul
#define HWCAP2_EBF16 0x0000000100000000ul
#define HWCAP2_SVE_EBF16 0x0000000200000000ul
#define HWCAP2_CSSC 0x0000000400000000ul
#define HWCAP2_RPRFM 0x0000000800000000ul
#define HWCAP2_SVE2P1 0x0000001000000000ul
#define HWCAP2_SME2 0x0000002000000000ul
#define HWCAP2_SME2P1 0x0000004000000000ul
#define HWCAP2_SME_I16I32 0x0000008000000000ul
#define HWCAP2_SME_BI32I32 0x0000010000000000ul
#define HWCAP2_SME_B16B16 0x0000020000000000ul
#define HWCAP2_SME_F16F16 0x0000040000000000ul
#define HWCAP2_MOPS 0x0000080000000000ul
#define HWCAP2_HBC 0x0000100000000000ul
#endif /* !_MACHINE_ELF_H_ */

View file

@ -0,0 +1,3 @@
/* $OpenBSD: elf.h,v 1.1 2024/07/14 19:33:59 miod Exp $ */
#include <arm/elf.h>

View file

@ -0,0 +1,7 @@
/* $OpenBSD: elf.h,v 1.1 2024/07/14 09:48:48 jca Exp $ */
/*
* This file is in the public domain.
*/
/* Nothing for now */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpi.c,v 1.433 2024/07/02 08:27:04 kettenis Exp $ */
/* $OpenBSD: acpi.c,v 1.435 2024/07/14 13:58:57 jmatthew Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@ -65,6 +65,7 @@ void acpi_pci_set_powerstate(pci_chipset_tag_t, pcitag_t, int, int);
int acpi_pci_notify(struct aml_node *, int, void *);
int acpi_submatch(struct device *, void *, void *);
int acpi_noprint(void *, const char *);
int acpi_print(void *, const char *);
void acpi_map_pmregs(struct acpi_softc *);
@ -756,9 +757,10 @@ acpi_pci_min_powerstate(pci_chipset_tag_t pc, pcitag_t tag)
void
acpi_pci_set_powerstate(pci_chipset_tag_t pc, pcitag_t tag, int state, int pre)
{
#if NACPIPWRRES > 0
struct acpi_softc *sc = acpi_softc;
#if NACPIPWRRES > 0
struct acpi_pwrres *pr;
#endif
struct acpi_pci *pdev;
int bus, dev, fun;
char name[5];
@ -769,10 +771,15 @@ acpi_pci_set_powerstate(pci_chipset_tag_t pc, pcitag_t tag, int state, int pre)
break;
}
/* XXX Add a check to discard nodes without Power Resources? */
if (pdev == NULL)
return;
if (state != ACPI_STATE_D0 && !pre) {
snprintf(name, sizeof(name), "_PS%d", state);
aml_evalname(sc, pdev->node, name, 0, NULL, NULL);
}
#if NACPIPWRRES > 0
SIMPLEQ_FOREACH(pr, &sc->sc_pwrresdevs, p_next) {
if (pr->p_node != pdev->node)
continue;
@ -811,6 +818,9 @@ acpi_pci_set_powerstate(pci_chipset_tag_t pc, pcitag_t tag, int state, int pre)
}
#endif /* NACPIPWRRES > 0 */
if (state == ACPI_STATE_D0 && pre)
aml_evalname(sc, pdev->node, "_PS0", 0, NULL, NULL);
}
int
@ -1307,6 +1317,12 @@ acpi_submatch(struct device *parent, void *match, void *aux)
return ((*cf->cf_attach->ca_match)(parent, match, aux));
}
int
acpi_noprint(void *aux, const char *pnp)
{
return (QUIET);
}
int
acpi_print(void *aux, const char *pnp)
{
@ -3001,6 +3017,12 @@ const char *acpi_isa_hids[] = {
NULL
};
/* Overly abundant devices to avoid printing details for */
const char *acpi_quiet_hids[] = {
"ACPI0007",
NULL
};
void
acpi_attach_deps(struct acpi_softc *sc, struct aml_node *node)
{
@ -3220,7 +3242,10 @@ acpi_foundhid(struct aml_node *node, void *arg)
if (!node->parent->attached) {
node->parent->attached = 1;
config_found(self, &aaa, acpi_print);
if (acpi_matchhids(&aaa, acpi_quiet_hids, "none"))
config_found(self, &aaa, acpi_noprint);
else
config_found(self, &aaa, acpi_print);
}
return (0);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpicpu.c,v 1.93 2024/06/07 16:53:35 kettenis Exp $ */
/* $OpenBSD: acpicpu.c,v 1.94 2024/07/14 14:04:16 jmatthew Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
@ -654,6 +654,9 @@ acpicpu_match(struct device *parent, void *match, void *aux)
struct acpi_attach_args *aa = aux;
struct cfdata *cf = match;
struct acpi_softc *acpi = (struct acpi_softc *)parent;
CPU_INFO_ITERATOR cii;
struct cpu_info *ci;
int64_t uid;
if (acpi_matchhids(aa, acpicpu_hids, cf->cf_driver->cd_name) &&
aa->aaa_node && aa->aaa_node->value &&
@ -663,7 +666,15 @@ acpicpu_match(struct device *parent, void *match, void *aux)
* so we won't attach any Processor() nodes.
*/
acpi->sc_skip_processor = 1;
return (1);
/* Only match if we can find a CPU with the right ID */
if (aml_evalinteger(acpi, aa->aaa_node, "_UID", 0,
NULL, &uid) == 0)
CPU_INFO_FOREACH(cii, ci)
if (ci->ci_acpi_proc_id == uid)
return (1);
return (0);
}
/* sanity */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpipwrres.c,v 1.13 2023/02/18 14:32:02 dv Exp $ */
/* $OpenBSD: acpipwrres.c,v 1.14 2024/07/14 10:48:55 kettenis Exp $ */
/*
* Copyright (c) 2013 Martin Pieuchot <mpi@openbsd.org>
@ -33,6 +33,7 @@
int acpipwrres_match(struct device *, void *, void *);
void acpipwrres_attach(struct device *, struct device *, void *);
int acpipwrres_activate(struct device *, int);
#ifdef ACPIPWRRES_DEBUG
#define DPRINTF(x) printf x
@ -66,7 +67,8 @@ struct acpipwrres_consumer {
};
const struct cfattach acpipwrres_ca = {
sizeof(struct acpipwrres_softc), acpipwrres_match, acpipwrres_attach
sizeof(struct acpipwrres_softc), acpipwrres_match, acpipwrres_attach,
NULL, acpipwrres_activate
};
struct cfdriver acpipwrres_cd = {
@ -140,6 +142,23 @@ acpipwrres_attach(struct device *parent, struct device *self, void *aux)
printf("\n");
}
int
acpipwrres_activate(struct device *self, int act)
{
struct acpipwrres_softc *sc = (struct acpipwrres_softc *)self;
switch (act) {
case DVACT_SUSPEND:
if (sc->sc_cons_ref == 0 && sc->sc_state != ACPIPWRRES_OFF) {
aml_evalname(sc->sc_acpi, sc->sc_devnode, "_OFF", 0,
NULL, NULL);
sc->sc_state = ACPIPWRRES_OFF;
}
break;
}
return 0;
}
int
acpipwrres_ref_incr(struct acpipwrres_softc *sc, struct aml_node *node)
{
@ -149,9 +168,11 @@ acpipwrres_ref_incr(struct acpipwrres_softc *sc, struct aml_node *node)
DPRINTF(("%s: dev %s ON %d\n", DEVNAME(sc), node->name,
sc->sc_cons_ref));
if (sc->sc_cons_ref++ == 0)
if (sc->sc_cons_ref++ == 0) {
aml_evalname(sc->sc_acpi, sc->sc_devnode, "_ON", 0,
NULL, NULL);
sc->sc_state = ACPIPWRRES_ON;
}
return (0);
}
@ -165,9 +186,11 @@ acpipwrres_ref_decr(struct acpipwrres_softc *sc, struct aml_node *node)
DPRINTF(("%s: dev %s OFF %d\n", DEVNAME(sc), node->name,
sc->sc_cons_ref));
if (--sc->sc_cons_ref == 0)
if (--sc->sc_cons_ref == 0) {
aml_evalname(sc->sc_acpi, sc->sc_devnode, "_OFF", 0,
NULL, NULL);
sc->sc_state = ACPIPWRRES_OFF;
}
return (0);
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qcgpio.c,v 1.10 2024/07/04 18:35:36 patrick Exp $ */
/* $OpenBSD: qcgpio.c,v 1.11 2024/07/15 15:33:54 mglocker Exp $ */
/*
* Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
*
@ -237,6 +237,8 @@ qcgpio_x1e80100_pin_map(int pin, bus_size_t *off)
return pin;
case 0x180:
return 67;
case 0x380:
return 33;
case 0x3c0:
return 3;
default:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dwmshc.c,v 1.7 2024/05/26 22:04:52 kettenis Exp $ */
/* $OpenBSD: dwmshc.c,v 1.8 2024/07/15 09:56:30 patrick Exp $ */
/*
* Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
@ -101,6 +101,8 @@
#define EMMC_DLL_TXCLK 0x808
#define EMMC_DLL_TXCLK_TX_TAP_NUM_SHIFT 0
#define EMMC_DLL_TXCLK_TX_TAP_NUM_MASK 0x1f
#define EMMC_DLL_TXCLK_TX_TAP_NUM_90_DEG 0x8
#define EMMC_DLL_TXCLK_TX_TAP_NUM_DEFAULT 0x10
#define EMMC_DLL_TXCLK_TX_TAP_VALUE_SHIFT 8
#define EMMC_DLL_TXCLK_TX_TAP_VALUE_MASK 0xff
#define EMMC_DLL_TXCLK_TX_DELAY_SHIFT 16
@ -112,7 +114,7 @@
#define EMMC_DLL_STRBIN 0x80c
#define EMMC_DLL_STRBIN_TAP_NUM_SHIFT 0
#define EMMC_DLL_STRBIN_TAP_NUM_MASK 0x1f
#define EMMC_DLL_STRBIN_TAP_NUM_DEFAULT 0x8
#define EMMC_DLL_STRBIN_TAP_NUM_90_DEG 0x8
#define EMMC_DLL_STRBIN_TAP_VALUE_SHIFT 8
#define EMMC_DLL_STRBIN_TAP_VALUE_MASK 0xff
#define EMMC_DLL_STRBIN_DELAY_NUM_SHIFT 16
@ -122,6 +124,20 @@
#define EMMC_DLL_STRBIN_TAP_VALUE_SEL (1U << 25)
#define EMMC_DLL_STRBIN_DELAY_NUM_SEL (1U << 26)
#define EMMC_DLL_STRBIN_DELAY_ENA (1U << 27)
#define EMMC_DLL_CMDOUT 0x810
#define EMMC_DLL_CMDOUT_TAP_NUM_SHIFT 0
#define EMMC_DLL_CMDOUT_TAP_NUM_MASK 0x1f
#define EMMC_DLL_CMDOUT_TAP_NUM_90_DEG 0x8
#define EMMC_DLL_CMDOUT_TAP_VALUE_SHIFT 8
#define EMMC_DLL_CMDOUT_TAP_VALUE_MASK 0xff
#define EMMC_DLL_CMDOUT_DELAY_NUM_SHIFT 16
#define EMMC_DLL_CMDOUT_DELAY_NUM_MASK 0xff
#define EMMC_DLL_CMDOUT_TAP_NUM_SEL (1U << 24)
#define EMMC_DLL_CMDOUT_TAP_VALUE_SEL (1U << 25)
#define EMMC_DLL_CMDOUT_DELAY_NUM_SEL (1U << 26)
#define EMMC_DLL_CMDOUT_DELAY_ENA (1U << 27)
#define EMMC_DLL_CMDOUT_SRC_SEL (1U << 28)
#define EMMC_DLL_CMDOUT_EN_SRC_SEL (1U << 29)
#define EMMC_DLL_STATUS0 0x840
#define EMMC_DLL_STATUS0_DLL_LOCK_VALUE_SHIFT 0
#define EMMC_DLL_STATUS0_DLL_LOCK_VALUE_MASK 0xff
@ -182,7 +198,8 @@ dwmshc_match(struct device *parent, void *match, void *aux)
{
struct fdt_attach_args *faa = aux;
return (OF_is_compatible(faa->fa_node, "rockchip,rk3568-dwcmshc"));
return (OF_is_compatible(faa->fa_node, "rockchip,rk3568-dwcmshc") ||
OF_is_compatible(faa->fa_node, "rockchip,rk3588-dwcmshc"));
}
static void
dwmshc_attach(struct device *parent, struct device *self, void *aux)
@ -303,7 +320,7 @@ static void
dwmshc_clock_post(struct sdhc_softc *sdhc, int freq, int timing)
{
struct dwmshc_softc *sc = (struct dwmshc_softc *)sdhc;
uint32_t txclk_tapnum = EMMC_DLL_STRBIN_DELAY_NUM_DEFAULT;
uint32_t txclk_tapnum = EMMC_DLL_TXCLK_TX_TAP_NUM_DEFAULT;
clock_set_frequency(sc->sc_node, 0, freq * 1000);
@ -324,8 +341,11 @@ dwmshc_clock_post(struct sdhc_softc *sdhc, int freq, int timing)
delay(1);
dwmshc_wr4(sc, EMMC_DLL_CTRL, 0);
dwmshc_wr4(sc, EMMC_DLL_RXCLK, EMMC_DLL_RXCLK_RX_CLK_OUT_SEL |
/* rk3568 */ EMMC_DLL_RXCLK_RX_CLK_SRC_SEL);
if (OF_is_compatible(sc->sc_node, "rockchip,rk3568-dwcmshc"))
dwmshc_wr4(sc, EMMC_DLL_RXCLK, EMMC_DLL_RXCLK_RX_CLK_OUT_SEL |
EMMC_DLL_RXCLK_RX_CLK_SRC_SEL);
else
dwmshc_wr4(sc, EMMC_DLL_RXCLK, EMMC_DLL_RXCLK_RX_CLK_OUT_SEL);
dwmshc_wr4(sc, EMMC_DLL_CTRL, EMMC_DLL_CTRL_DLL_START |
0x5 << EMMC_DLL_CTRL_DLL_START_POINT_SHIFT |
0x2 << EMMC_DLL_CTRL_DLL_INCREMENT_SHIFT);
@ -341,7 +361,18 @@ dwmshc_clock_post(struct sdhc_softc *sdhc, int freq, int timing)
txclk_tapnum = OF_getpropint(sc->sc_node,
"rockchip,txclk-tapnum", txclk_tapnum);
/* XXX rk3588 hs400 */
#ifdef notyet
if (OF_is_compatible(sc->sc_node, "rockchip,rk3588-dwcmshc") &&
timing == SDMMC_TIMING_MMC_HS400) {
txclk_tapnum = EMMC_DLL_TXCLK_TX_TAP_NUM_90_DEG;
dwmshc_wr4(sc, EMMC_DLL_CMDOUT,
EMMC_DLL_CMDOUT_TAP_NUM_90_DEG |
EMMC_DLL_CMDOUT_TAP_NUM_SEL |
EMMC_DLL_CMDOUT_DELAY_ENA |
EMMC_DLL_CMDOUT_SRC_SEL |
EMMC_DLL_CMDOUT_EN_SRC_SEL);
}
#endif
}
dwmshc_wr4(sc, EMMC_DLL_TXCLK, EMMC_DLL_TXCLK_TX_CLK_OUT_SEL |
@ -349,7 +380,7 @@ dwmshc_clock_post(struct sdhc_softc *sdhc, int freq, int timing)
txclk_tapnum << EMMC_DLL_TXCLK_TX_TAP_NUM_SHIFT);
dwmshc_wr4(sc, EMMC_DLL_STRBIN, EMMC_DLL_STRBIN_DELAY_ENA |
EMMC_DLL_STRBIN_TAP_NUM_SEL |
(EMMC_DLL_STRBIN_TAP_NUM_DEFAULT <<
(EMMC_DLL_STRBIN_TAP_NUM_90_DEG <<
EMMC_DLL_STRBIN_TAP_NUM_SHIFT));
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rkclock.c,v 1.89 2024/06/11 09:15:33 kettenis Exp $ */
/* $OpenBSD: rkclock.c,v 1.90 2024/07/15 09:54:38 patrick Exp $ */
/*
* Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
*
@ -4217,6 +4217,20 @@ const struct rkclock rk3588_clocks[] = {
{ RK3588_CLK_GPU_SRC },
SET_PARENT
},
{
RK3588_CCLK_EMMC, RK3588_CRU_CLKSEL_CON(77),
SEL(15, 14), DIV(13, 8),
{ RK3588_PLL_GPLL, RK3588_PLL_CPLL, RK3588_XIN24M }
},
{
RK3588_BCLK_EMMC, RK3588_CRU_CLKSEL_CON(78),
SEL(5, 5), DIV(4, 0),
{ RK3588_PLL_GPLL, RK3588_PLL_CPLL }
},
{
RK3588_TMCLK_EMMC, 0, 0, 0,
{ RK3588_XIN24M }
},
{
RK3588_CLK_GMAC_125M, RK3588_CRU_CLKSEL_CON(83),
SEL(15, 15), DIV(14, 8),
@ -4567,6 +4581,26 @@ rk3588_reset(void *cookie, uint32_t *cells, int on)
reg = RK3588_CRU_SOFTRST_CON(12);
bit = 1;
break;
case RK3588_SRST_H_EMMC:
reg = RK3588_CRU_SOFTRST_CON(31);
bit = 4;
break;
case RK3588_SRST_A_EMMC:
reg = RK3588_CRU_SOFTRST_CON(31);
bit = 5;
break;
case RK3588_SRST_C_EMMC:
reg = RK3588_CRU_SOFTRST_CON(31);
bit = 6;
break;
case RK3588_SRST_B_EMMC:
reg = RK3588_CRU_SOFTRST_CON(31);
bit = 7;
break;
case RK3588_SRST_T_EMMC:
reg = RK3588_CRU_SOFTRST_CON(31);
bit = 8;
break;
case RK3588_SRST_A_GMAC0:
reg = RK3588_CRU_SOFTRST_CON(32);
bit = 10;

View file

@ -480,6 +480,11 @@
#define RK3588_ACLK_LOW_TOP_ROOT 258
#define RK3588_CLK_GPU_SRC 261
#define RK3588_CLK_GPU 262
#define RK3588_HCLK_EMMC 298
#define RK3588_ACLK_EMMC 299
#define RK3588_CCLK_EMMC 300
#define RK3588_BCLK_EMMC 301
#define RK3588_TMCLK_EMMC 302
#define RK3588_CLK_GMAC_125M 310
#define RK3588_CCLK_SRC_SDIO 395
#define RK3588_ACLK_VOP_ROOT 600
@ -513,6 +518,11 @@
#define RK3588_SRST_P_TSADC 86
#define RK3588_SRST_TSADC 87
#define RK3588_SRST_H_EMMC 278
#define RK3588_SRST_A_EMMC 279
#define RK3588_SRST_C_EMMC 280
#define RK3588_SRST_B_EMMC 281
#define RK3588_SRST_T_EMMC 282
#define RK3588_SRST_A_GMAC0 291
#define RK3588_SRST_A_GMAC1 292
#define RK3588_SRST_PCIE0_POWER_UP 294

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ichiic.c,v 1.55 2024/05/24 06:02:53 jsg Exp $ */
/* $OpenBSD: ichiic.c,v 1.56 2024/07/16 01:14:23 jsg Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@ -108,6 +108,7 @@ const struct pci_matchid ichiic_ids[] = {
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801JI_SMB },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_APOLLOLAKE_SMB },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ATOMC2000_PCU_SMB },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C3000_SMB_2 },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BAYTRAIL_SMB },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_BRASWELL_SMB },
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_SMB },

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_elf.c,v 1.186 2024/04/02 08:39:16 deraadt Exp $ */
/* $OpenBSD: exec_elf.c,v 1.188 2024/07/14 11:36:54 jca Exp $ */
/*
* Copyright (c) 1996 Per Fogelstrom
@ -89,6 +89,7 @@
#include <machine/reg.h>
#include <machine/exec.h>
#include <machine/elf.h>
int elf_load_file(struct proc *, char *, struct exec_package *,
struct elf_args *);
@ -923,6 +924,14 @@ bad:
return (error);
}
#ifdef __HAVE_CPU_HWCAP
unsigned long hwcap;
#endif /* __HAVE_CPU_HWCAP */
#ifdef __HAVE_CPU_HWCAP2
unsigned long hwcap2;
#endif /* __HAVE_CPU_HWCAP2 */
/*
* Phase II of load. It is now safe to load the interpreter. Info collected
* when loading the program is available for setup of the interpreter.
@ -995,6 +1004,18 @@ exec_elf_fixup(struct proc *p, struct exec_package *epp)
a->au_v = ap->arg_entry;
a++;
#ifdef __HAVE_CPU_HWCAP
a->au_id = AUX_hwcap;
a->au_v = hwcap;
a++;
#endif /* __HAVE_CPU_HWCAP */
#ifdef __HAVE_CPU_HWCAP2
a->au_id = AUX_hwcap2;
a->au_v = hwcap2;
a++;
#endif /* __HAVE_CPU_HWCAP2 */
a->au_id = AUX_openbsd_timekeep;
a->au_v = p->p_p->ps_timekeep;
a++;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: uipc_socket.c,v 1.337 2024/07/12 17:20:18 mvs Exp $ */
/* $OpenBSD: uipc_socket.c,v 1.338 2024/07/14 15:42:23 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@ -1690,7 +1690,7 @@ somove(struct socket *so, int wait)
* Move only a partial mbuf at maximum splice length or
* if the drain buffer is too small for this large mbuf.
*/
if (!maxreached && so->so_snd.sb_datacc > 0) {
if (!maxreached && sosp->so_snd.sb_datacc > 0) {
len -= size;
break;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.719 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: if.c,v 1.720 2024/07/14 18:53:39 bluhm Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@ -3353,6 +3353,7 @@ ifnewlladdr(struct ifnet *ifp)
{
#ifdef INET6
struct ifaddr *ifa;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
#endif
struct ifreq ifrq;
short up;
@ -3378,7 +3379,7 @@ ifnewlladdr(struct ifnet *ifp)
* Update the link-local address. Don't do it if we're
* a router to avoid confusing hosts on the network.
*/
if (ip6_forwarding == 0) {
if (!i_am_router) {
ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa;
if (ifa) {
in6_purgeaddr(ifa);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pf.c,v 1.1202 2024/07/12 09:25:27 bluhm Exp $ */
/* $OpenBSD: pf.c,v 1.1203 2024/07/14 18:53:39 bluhm Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@ -7988,7 +7988,7 @@ done:
if (pd.dir == PF_IN) {
int flags = IPV6_REDIRECT;
switch (ip6_forwarding) {
switch (atomic_load_int(&ip6_forwarding)) {
case 2:
SET(flags, IPV6_FORWARDING_IPSEC);
/* FALLTHROUGH */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pf_norm.c,v 1.232 2024/07/04 12:50:08 bluhm Exp $ */
/* $OpenBSD: pf_norm.c,v 1.233 2024/07/14 18:53:39 bluhm Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@ -1013,7 +1013,7 @@ pf_refragment6(struct mbuf **m0, struct m_tag *mtag, struct sockaddr_in6 *dst,
if (ifp == NULL) {
int flags = 0;
switch (ip6_forwarding) {
switch (atomic_load_int(&ip6_forwarding)) {
case 2:
SET(flags, IPV6_FORWARDING_IPSEC);
/* FALLTHROUGH */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_carp.c,v 1.362 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: ip_carp.c,v 1.363 2024/07/14 18:53:39 bluhm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@ -1287,9 +1287,10 @@ carp_send_na(struct carp_softc *sc)
struct ifaddr *ifa;
struct in6_addr *in6;
static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
int flags = ND_NA_FLAG_OVERRIDE;
if (ip6_forwarding != 0)
if (i_am_router)
flags |= ND_NA_FLAG_ROUTER;
TAILQ_FOREACH(ifa, &sc->sc_if.if_addrlist, ifa_list) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_icmp.c,v 1.195 2024/07/12 09:25:27 bluhm Exp $ */
/* $OpenBSD: ip_icmp.c,v 1.196 2024/07/14 18:53:39 bluhm Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@ -588,9 +588,9 @@ reflect:
struct sockaddr_in sgw;
struct sockaddr_in ssrc;
struct rtentry *newrt = NULL;
int i_am_router = (atomic_load_int(&ip_forwarding) != 0);
if (icmp_rediraccept == 0 ||
atomic_load_int(&ip_forwarding) != 0)
if (icmp_rediraccept == 0 || i_am_router)
goto freeit;
if (code > 3)
goto badcode;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_input.c,v 1.398 2024/07/12 09:25:27 bluhm Exp $ */
/* $OpenBSD: ip_input.c,v 1.399 2024/07/14 18:53:39 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@ -111,6 +111,10 @@ LIST_HEAD(, ipq) ipq;
int ip_maxqueue = 300;
int ip_frags = 0;
const struct sysctl_bounded_args ipctl_vars_unlocked[] = {
{ IPCTL_FORWARDING, &ip_forwarding, 0, 2 },
};
const struct sysctl_bounded_args ipctl_vars[] = {
#ifdef MROUTING
{ IPCTL_MRTPROTO, &ip_mrtproto, SYSCTL_INT_READONLY },
@ -1799,8 +1803,9 @@ ip_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
NET_UNLOCK();
return (error);
case IPCTL_FORWARDING:
return (sysctl_int_bounded(oldp, oldlenp, newp, newlen,
&ip_forwarding, 0, 2));
return (sysctl_bounded_arr(
ipctl_vars_unlocked, nitems(ipctl_vars_unlocked),
name, namelen, oldp, oldlenp, newp, newlen));
default:
NET_LOCK();
error = sysctl_bounded_arr(ipctl_vars, nitems(ipctl_vars),

View file

@ -1,4 +1,4 @@
/* $OpenBSD: icmp6.c,v 1.253 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: icmp6.c,v 1.254 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -1228,6 +1228,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
char *lladdr = NULL;
int lladdrlen = 0;
struct rtentry *rt = NULL;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
int is_router;
int is_onlink;
struct in6_addr src6 = ip6->ip6_src;
@ -1241,7 +1242,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
return;
/* if we are router, we don't update route by icmp6 redirect */
if (ip6_forwarding != 0)
if (i_am_router)
goto freeit;
if (!(ifp->if_xflags & IFXF_AUTOCONF6))
goto freeit;
@ -1366,7 +1367,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
/* RFC 2461 8.3 */
nd6_cache_lladdr(ifp, &redtgt6, lladdr, lladdrlen, ND_REDIRECT,
is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER);
is_onlink ? ND_REDIRECT_ONLINK : ND_REDIRECT_ROUTER, i_am_router);
if (!is_onlink) { /* better router case. perform rtredirect. */
/* perform rtredirect */
@ -1438,11 +1439,12 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt)
size_t maxlen;
u_char *p;
struct sockaddr_in6 src_sa;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
icmp6_errcount(ND_REDIRECT, 0);
/* if we are not router, we don't send icmp6 redirect */
if (ip6_forwarding == 0)
if (!i_am_router)
goto fail;
/* sanity check */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_input.c,v 1.264 2024/07/04 12:50:08 bluhm Exp $ */
/* $OpenBSD: ip6_input.c,v 1.265 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@ -416,7 +416,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
SET(flags, IPV6_REDIRECT);
#endif
switch (ip6_forwarding) {
switch (atomic_load_int(&ip6_forwarding)) {
case 2:
SET(flags, IPV6_FORWARDING_IPSEC);
/* FALLTHROUGH */
@ -1443,12 +1443,15 @@ const u_char inet6ctlerrmap[PRC_NCMDS] = {
extern int ip6_mrtproto;
#endif
const struct sysctl_bounded_args ipv6ctl_vars_unlocked[] = {
{ IPV6CTL_FORWARDING, &ip6_forwarding, 0, 2 },
};
const struct sysctl_bounded_args ipv6ctl_vars[] = {
{ IPV6CTL_DAD_PENDING, &ip6_dad_pending, SYSCTL_INT_READONLY },
#ifdef MROUTING
{ IPV6CTL_MRTPROTO, &ip6_mrtproto, SYSCTL_INT_READONLY },
#endif
{ IPV6CTL_FORWARDING, &ip6_forwarding, 0, 2 },
{ IPV6CTL_SENDREDIRECTS, &ip6_sendredirects, 0, 1 },
{ IPV6CTL_DEFHLIM, &ip6_defhlim, 0, 255 },
{ IPV6CTL_MAXFRAGPACKETS, &ip6_maxfragpackets, 0, 1000 },
@ -1568,6 +1571,10 @@ ip6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
atomic_inc_long(&rtgeneration);
NET_UNLOCK();
return (error);
case IPV6CTL_FORWARDING:
return (sysctl_bounded_arr(
ipv6ctl_vars_unlocked, nitems(ipv6ctl_vars_unlocked),
name, namelen, oldp, oldlenp, newp, newlen));
default:
NET_LOCK();
error = sysctl_bounded_arr(ipv6ctl_vars, nitems(ipv6ctl_vars),

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nd6.c,v 1.281 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: nd6.c,v 1.282 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@ -107,8 +107,8 @@ void nd6_slowtimo(void *);
void nd6_expire(void *);
void nd6_expire_timer(void *);
void nd6_invalidate(struct rtentry *);
void nd6_free(struct rtentry *);
int nd6_llinfo_timer(struct rtentry *);
void nd6_free(struct rtentry *, int);
int nd6_llinfo_timer(struct rtentry *, int);
struct timeout nd6_timer_to;
struct timeout nd6_slowtimo_ch;
@ -264,6 +264,7 @@ nd6_timer(void *unused)
{
struct llinfo_nd6 *ln, *nln;
time_t uptime, expire;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
int secs;
NET_LOCK();
@ -276,7 +277,7 @@ nd6_timer(void *unused)
struct rtentry *rt = ln->ln_rt;
if (rt->rt_expire && rt->rt_expire <= uptime)
if (nd6_llinfo_timer(rt))
if (nd6_llinfo_timer(rt, i_am_router))
continue;
if (rt->rt_expire && rt->rt_expire < expire)
@ -300,7 +301,7 @@ nd6_timer(void *unused)
* Returns 1 if `rt' should no longer be used, 0 otherwise.
*/
int
nd6_llinfo_timer(struct rtentry *rt)
nd6_llinfo_timer(struct rtentry *rt, int i_am_router)
{
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
struct sockaddr_in6 *dst = satosin6(rt_key(rt));
@ -346,7 +347,7 @@ nd6_llinfo_timer(struct rtentry *rt)
} else
atomic_sub_int(&ln_hold_total, len);
nd6_free(rt);
nd6_free(rt, i_am_router);
ln = NULL;
}
break;
@ -362,7 +363,7 @@ nd6_llinfo_timer(struct rtentry *rt)
case ND6_LLINFO_PURGE:
/* Garbage Collection(RFC 2461 5.3) */
if (!ND6_LLINFO_PERMANENT(ln)) {
nd6_free(rt);
nd6_free(rt, i_am_router);
ln = NULL;
}
break;
@ -383,7 +384,7 @@ nd6_llinfo_timer(struct rtentry *rt)
nd6_ns_output(ifp, &dst->sin6_addr, &dst->sin6_addr,
&ln->ln_saddr6, 0);
} else {
nd6_free(rt);
nd6_free(rt, i_am_router);
ln = NULL;
}
break;
@ -477,6 +478,7 @@ void
nd6_purge(struct ifnet *ifp)
{
struct llinfo_nd6 *ln, *nln;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
NET_ASSERT_LOCKED_EXCLUSIVE();
@ -492,7 +494,7 @@ nd6_purge(struct ifnet *ifp)
rt->rt_gateway->sa_family == AF_LINK) {
sdl = satosdl(rt->rt_gateway);
if (sdl->sdl_index == ifp->if_index)
nd6_free(rt);
nd6_free(rt, i_am_router);
}
}
}
@ -661,7 +663,7 @@ nd6_invalidate(struct rtentry *rt)
* Free an nd6 llinfo entry.
*/
void
nd6_free(struct rtentry *rt)
nd6_free(struct rtentry *rt, int i_am_router)
{
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
struct in6_addr in6 = satosin6(rt_key(rt))->sin6_addr;
@ -671,7 +673,7 @@ nd6_free(struct rtentry *rt)
ifp = if_get(rt->rt_ifidx);
if (ip6_forwarding == 0) {
if (!i_am_router) {
if (ln->ln_router) {
/*
* rt6_flush must be called whether or not the neighbor
@ -1031,7 +1033,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
*/
void
nd6_cache_lladdr(struct ifnet *ifp, const struct in6_addr *from, char *lladdr,
int lladdrlen, int type, int code)
int lladdrlen, int type, int code, int i_am_router)
{
struct rtentry *rt;
struct llinfo_nd6 *ln;
@ -1080,7 +1082,7 @@ nd6_cache_lladdr(struct ifnet *ifp, const struct in6_addr *from, char *lladdr,
return;
if ((rt->rt_flags & (RTF_GATEWAY | RTF_LLINFO)) != RTF_LLINFO) {
fail:
nd6_free(rt);
nd6_free(rt, i_am_router);
rtfree(rt);
return;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nd6.h,v 1.99 2023/05/04 06:56:56 bluhm Exp $ */
/* $OpenBSD: nd6.h,v 1.100 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
@ -134,7 +134,7 @@ void nd6_nud_hint(struct rtentry *);
void nd6_rtrequest(struct ifnet *, int, struct rtentry *);
int nd6_ioctl(u_long, caddr_t, struct ifnet *);
void nd6_cache_lladdr(struct ifnet *, const struct in6_addr *, char *,
int, int, int);
int, int, int, int);
int nd6_resolve(struct ifnet *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *);
int nd6_need_cache(struct ifnet *);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nd6_nbr.c,v 1.152 2024/06/20 19:25:42 bluhm Exp $ */
/* $OpenBSD: nd6_nbr.c,v 1.153 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@ -108,7 +108,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
struct ifaddr *ifa = NULL;
int lladdrlen = 0;
int anycast = 0, proxy = 0, tentative = 0;
int i_am_router = (ip6_forwarding != 0);
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
int tlladdr;
struct nd_opts ndopts;
struct sockaddr_dl *proxydl = NULL;
@ -323,7 +323,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
}
nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, ND_NEIGHBOR_SOLICIT,
0);
0, i_am_router);
nd6_na_output(ifp, &saddr6, &taddr6,
((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) |
@ -559,7 +559,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len)
int is_override;
char *lladdr = NULL;
int lladdrlen = 0;
int i_am_router = (ip6_forwarding != 0);
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
struct ifaddr *ifa;
struct in6_ifaddr *ifa6;
struct llinfo_nd6 *ln;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: nd6_rtr.c,v 1.170 2023/03/31 19:43:33 bluhm Exp $ */
/* $OpenBSD: nd6_rtr.c,v 1.171 2024/07/14 18:53:39 bluhm Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@ -73,6 +73,7 @@ nd6_rtr_cache(struct mbuf *m, int off, int icmp6len, int icmp6_type)
struct in6_addr saddr6 = ip6->ip6_src;
char *lladdr = NULL;
int lladdrlen = 0;
int i_am_router = (atomic_load_int(&ip6_forwarding) != 0);
struct nd_opts ndopts;
char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
@ -157,7 +158,8 @@ nd6_rtr_cache(struct mbuf *m, int off, int icmp6len, int icmp6_type)
goto bad;
}
nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, icmp6_type, 0);
nd6_cache_lladdr(ifp, &saddr6, lladdr, lladdrlen, icmp6_type, 0,
i_am_router);
if_put(ifp);
freeit:

50
sys/sys/auxv.h Normal file
View file

@ -0,0 +1,50 @@
/* $OpenBSD: auxv.h,v 1.1 2024/07/14 09:48:49 jca Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2017 Michal Meloun
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_AUXV_H_
#define _SYS_AUXV_H_
#include <sys/types.h>
#include <machine/elf.h>
/* Values for a_type. */
#define AT_NULL 0 /* Terminates the vector. */
#define AT_IGNORE 1 /* Ignored entry. */
#define AT_PAGESZ 6 /* Page size in bytes. */
#define AT_HWCAP 25 /* CPU feature flags. */
#define AT_HWCAP2 26 /* CPU feature flags 2. */
#define AT_COUNT 27 /* Count of defined aux entry types. */
__BEGIN_DECLS
int elf_aux_info(int aux, void *buf, int buflen);
__END_DECLS
#endif /* !_SYS_AUXV_H_ */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: exec_elf.h,v 1.104 2024/06/22 12:26:17 deraadt Exp $ */
/* $OpenBSD: exec_elf.h,v 1.105 2024/07/14 09:48:49 jca Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
@ -728,6 +728,8 @@ enum AuxID {
AUX_base = 7, /* base addr for ld.so or static PIE */
AUX_flags = 8, /* processor flags */
AUX_entry = 9, /* a.out entry */
AUX_hwcap = 25, /* processor flags */
AUX_hwcap2 = 26, /* processor flags (continued) */
AUX_sun_uid = 2000, /* euid */
AUX_sun_ruid = 2001, /* ruid */
AUX_sun_gid = 2002, /* egid */
@ -821,7 +823,7 @@ extern Elf_Dyn _DYNAMIC[];
/*
* How many entries are in the AuxInfo array we pass to the process?
*/
#define ELF_AUX_ENTRIES 9
#define ELF_AUX_ENTRIES 11
#define ELF_AUX_WORDS (sizeof(AuxInfo) * ELF_AUX_ENTRIES / sizeof(char *))
struct exec_package;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: proc.h,v 1.362 2024/07/08 13:17:12 claudio Exp $ */
/* $OpenBSD: proc.h,v 1.363 2024/07/15 07:24:03 jsg Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@ -308,8 +308,8 @@ struct process {
"\013WAITED" "\014COREDUMP" "\015SINGLEEXIT" "\016SINGLEUNWIND" \
"\017NOZOMBIE" "\020STOPPED" "\021SYSTEM" "\022EMBRYO" "\023ZOMBIE" \
"\024NOBROADCASTKILL" "\025PLEDGE" "\026WXNEEDED" "\027EXECPLEDGE" \
"\030ORPHAN" "\031CHROOT" "\032NOBTCFI" "\033ITIMER")
"\030ORPHAN" "\031CHROOT" "\032NOBTCFI" "\033ITIMER" "\034PIN" \
"\035LIBCPIN")
struct kcov_dev;
struct lock_list_entry;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ext2fs.h,v 1.26 2021/03/11 13:31:35 jsg Exp $ */
/* $OpenBSD: ext2fs.h,v 1.27 2024/07/15 13:27:36 martijn Exp $ */
/* $NetBSD: ext2fs.h,v 1.10 2000/01/28 16:00:23 bouyer Exp $ */
/*
@ -156,7 +156,48 @@ struct ext2fs {
u_int32_t e2fs_first_meta_bg;
u_int32_t e2fs_mkfs_time;
u_int32_t e2fs_journal_backup[17];
u_int32_t reserved2[172];
u_int32_t e2fs_bcount_hi; /* high bits of blocks count */
u_int32_t e2fs_rbcount_hi; /* high bits of reserved blocks count */
u_int32_t e2fs_fbcount_hi; /* high bits of free blocks count */
u_int16_t e2fs_min_extra_isize; /* all inodes have some bytes */
u_int16_t e2fs_want_extra_isize;/* inodes must reserve some bytes */
u_int32_t e2fs_flags; /* miscellaneous flags */
u_int16_t e2fs_raid_stride; /* RAID stride */
u_int16_t e2fs_mmpintv; /* seconds to wait in MMP checking */
u_int64_t e2fs_mmpblk; /* block for multi-mount protection */
u_int32_t e2fs_raid_stripe_wid; /* blocks on data disks (N * stride) */
u_int8_t e2fs_log_gpf; /* FLEX_BG group size */
u_int8_t e2fs_chksum_type; /* metadata checksum algorithm used */
u_int8_t e2fs_encrypt; /* versioning level for encryption */
u_int8_t e2fs_reserved_pad;
u_int64_t e2fs_kbytes_written; /* number of lifetime kilobytes */
u_int32_t e2fs_snapinum; /* inode number of active snapshot */
u_int32_t e2fs_snapid; /* sequential ID of active snapshot */
u_int64_t e2fs_snaprbcount; /* rsvd blocks for active snapshot */
u_int32_t e2fs_snaplist; /* inode number for on-disk snapshot */
u_int32_t e2fs_errcount; /* number of file system errors */
u_int32_t e2fs_first_errtime; /* first time an error happened */
u_int32_t e2fs_first_errino; /* inode involved in first error */
u_int64_t e2fs_first_errblk; /* block involved of first error */
u_int8_t e2fs_first_errfunc[32];/* function where error happened */
u_int32_t e2fs_first_errline; /* line number where error happened */
u_int32_t e2fs_last_errtime; /* most recent time of an error */
u_int32_t e2fs_last_errino; /* inode involved in last error */
u_int32_t e2fs_last_errline; /* line number where error happened */
u_int64_t e2fs_last_errblk; /* block involved of last error */
u_int8_t e2fs_last_errfunc[32];/* function where error happened */
u_int8_t e2fs_mount_opts[64];
u_int32_t e2fs_usrquota_inum; /* inode for tracking user quota */
u_int32_t e2fs_grpquota_inum; /* inode for tracking group quota */
u_int32_t e2fs_overhead_clusters;/* overhead blocks/clusters */
u_int32_t e2fs_backup_bgs[2]; /* groups with sparse_super2 SBs */
u_int8_t e2fs_encrypt_algos[4];/* encryption algorithms in use */
u_int8_t e2fs_encrypt_pw_salt[16];/* salt used for string2key */
u_int32_t e2fs_lpf_ino; /* location of the lost+found inode */
u_int32_t e2fs_proj_quota_inum; /* inode for tracking project quota */
u_int32_t e2fs_chksum_seed; /* checksum seed */
u_int32_t e2fs_reserved[98]; /* padding to the end of the block */
u_int32_t e2fs_sbchksum; /* superblock checksum */
};

View file

@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: ssh_config.5,v 1.397 2024/07/04 22:53:59 djm Exp $
.Dd $Mdocdate: July 4 2024 $
.\" $OpenBSD: ssh_config.5,v 1.398 2024/07/14 10:19:23 jsg Exp $
.Dd $Mdocdate: July 14 2024 $
.Dt SSH_CONFIG 5
.Os
.Sh NAME
@ -1263,7 +1263,7 @@ and
.It Cm KexAlgorithms
Specifies the permitted KEX (Key Exchange) algorithms that will be used and
their preference order.
The selected algorithm will the the first algorithm in this list that
The selected algorithm will be the first algorithm in this list that
the server also supports.
Multiple algorithms must be comma-separated.
.Pp

View file

@ -1,4 +1,4 @@
/* $OpenBSD: chap.c,v 1.19 2024/07/01 07:09:07 yasuoka Exp $ */
/* $OpenBSD: chap.c,v 1.20 2024/07/14 10:52:50 yasuoka Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
@ -36,7 +36,7 @@
* </ul></p>
*/
/* RFC 1994, 2433 */
/* $Id: chap.c,v 1.19 2024/07/01 07:09:07 yasuoka Exp $ */
/* $Id: chap.c,v 1.20 2024/07/14 10:52:50 yasuoka Exp $ */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
@ -537,14 +537,12 @@ md5chap_authenticate(chap *_this, int id, char *username, u_char *challenge,
MD5_CTX md5ctx;
int rval, passlen;
u_char digest[16];
char *password, buf[MAX_PASSWORD_LENGTH + 1];
buf[0] = id;
passlen = sizeof(buf) - 1;
password = &buf[1];
char idpass[1 + MAX_PASSWORD_LENGTH + 1];
idpass[0] = id;
passlen = MAX_PASSWORD_LENGTH;
rval = npppd_get_user_password(_this->ppp->pppd, _this->ppp, username,
password, &passlen);
idpass + 1, &passlen);
if (rval != 0) {
switch (rval) {
@ -559,9 +557,9 @@ md5chap_authenticate(chap *_this, int id, char *username, u_char *challenge,
}
goto auth_failed;
}
passlen = strlen(password);
passlen = strlen(idpass + 1);
MD5Init(&md5ctx);
MD5Update(&md5ctx, buf, passlen + 1);
MD5Update(&md5ctx, idpass, 1 + passlen);
MD5Update(&md5ctx, challenge, lchallenge);
MD5Final(digest, &md5ctx);

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: radiusctl.8,v 1.7 2024/07/10 05:41:34 jmc Exp $
.\" $OpenBSD: radiusctl.8,v 1.8 2024/07/14 03:47:44 jsg Exp $
.\"
.\" Copyright (c) YASUOKA Masahiko <yasuoka@yasuoka.net>
.\"
@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
.Dd $Mdocdate: July 10 2024 $
.Dd $Mdocdate: July 14 2024 $
.Dt RADIUSCTL 8
.Os
.Sh NAME
@ -109,7 +109,7 @@ is specified,
.Nm
shows the sessions in JSON format.
.It Cm ipcp disconnect Ar sequence
Request to disconnect the session specfied by the
Request to disconnect the session specified by the
.Ar sequence .
.El
.Sh EXAMPLES

View file

@ -1,4 +1,4 @@
/* $OpenBSD: radiusctl.c,v 1.9 2024/07/09 17:26:14 yasuoka Exp $ */
/* $OpenBSD: radiusctl.c,v 1.10 2024/07/14 11:12:32 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
*
@ -307,6 +307,7 @@ radius_test(struct parse_result *res)
u_char resp[1 + MD5_DIGEST_LENGTH]; /* "1 + " for CHAP Id */
MD5_CTX md5ctx;
arc4random_buf(chal, sizeof(chal));
arc4random_buf(resp, 1); /* CHAP Id is random */
MD5Init(&md5ctx);
MD5Update(&md5ctx, resp, 1);

View file

@ -1,9 +1,11 @@
# $OpenBSD: Makefile,v 1.4 2024/07/09 17:26:14 yasuoka Exp $
# $OpenBSD: Makefile,v 1.6 2024/07/14 16:09:23 yasuoka Exp $
SUBDIR= radiusd
SUBDIR+= radiusd_bsdauth
SUBDIR+= radiusd_file
SUBDIR+= radiusd_ipcp
SUBDIR+= radiusd_radius
SUBDIR+= radiusd_standard
SUBDIR+= radiusd_eap2mschap
.include <bsd.prog.mk>

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile.inc,v 1.3 2024/07/02 16:18:11 deraadt Exp $
# $OpenBSD: Makefile.inc,v 1.4 2024/07/14 16:09:23 yasuoka Exp $
.PATH: ${.CURDIR}/..
CFLAGS+= -I${.CURDIR}/..
@ -7,5 +7,5 @@ CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+= -Wmissing-declarations -Wpointer-arith
#DEGUG= -g
#CFLAGS+= -DRADIUSD_DEBUG
#CFLAGS+= -DRADIUSD_DEBUG -DEAP2MSCHAP_DEBUG
#CFLAGS+= -Werror

Some files were not shown because too many files have changed in this diff Show more