From 36c45cb00b9217e70bd6ad620a152e283a370cd4 Mon Sep 17 00:00:00 2001 From: purplerain Date: Mon, 5 Feb 2024 01:13:44 +0000 Subject: [PATCH] sync with OpenBSD -current --- .../config/os/bsd/openbsd/ctype_base.h | 22 +- .../config/os/bsd/openbsd/ctype_base.h | 22 +- gnu/usr.bin/binutils-2.17/binutils/readelf.c | 1 + .../binutils-2.17/include/elf/common.h | 1 + include/ctype.h | 45 +-- lib/libc/gen/ctype_.c | 12 +- lib/libc/gen/isctype.c | 29 +- lib/libc/locale/iswctype.c | 31 ++- lib/libc/locale/iswctype_l.c | 26 +- lib/libc/locale/rune.h | 30 +- lib/libc/locale/runetable.c | 256 +++++++++--------- lib/libc/locale/wctype.c | 26 +- lib/libssl/ssl_lib.c | 4 +- lib/libssl/tls13_handshake_msg.c | 4 +- regress/lib/libc/timingsafe/timingsafe.c | 6 +- regress/lib/libcrypto/asn1/asn1basic.c | 4 +- sys/arch/amd64/amd64/codepatch.c | 23 +- sys/arch/arm64/stand/efiboot/efiboot.c | 4 +- sys/dev/ic/qwx.c | 8 +- usr.bin/openssl/ca.c | 3 +- usr.sbin/rpki-client/cert.c | 15 +- usr.sbin/rpki-client/mft.c | 80 ++---- usr.sbin/vmd/fw_cfg.c | 4 +- usr.sbin/vmd/vioblk.c | 4 +- usr.sbin/vmd/vmd.c | 7 +- usr.sbin/vmd/vmm.c | 6 +- 26 files changed, 324 insertions(+), 349 deletions(-) diff --git a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h index e2d26707f..254abd5b3 100644 --- a/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h +++ b/gnu/gcc/libstdc++-v3/config/os/bsd/openbsd/ctype_base.h @@ -46,17 +46,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // NB: Offsets into ctype::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. typedef char mask; - static const mask upper = _U; - static const mask lower = _L; - static const mask alpha = _U | _L; - static const mask digit = _N; - static const mask xdigit = _N | _X; - static const mask space = _S; - static const mask print = char(_P | _U | _L | _N | _B); - static const mask graph = _P | _U | _L | _N; - static const mask cntrl = _C; - static const mask punct = _P; - static const mask alnum = _U | _L | _N; + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_U | _CTYPE_L; + static const mask digit = _CTYPE_N; + static const mask xdigit = _CTYPE_N | _CTYPE_X; + static const mask space = _CTYPE_S; + static const mask print = char(_CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B); + static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N; + static const mask cntrl = _CTYPE_C; + static const mask punct = _CTYPE_P; + static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N; }; _GLIBCXX_END_NAMESPACE diff --git a/gnu/lib/libstdc++/libstdc++/config/os/bsd/openbsd/ctype_base.h b/gnu/lib/libstdc++/libstdc++/config/os/bsd/openbsd/ctype_base.h index 8ec1d3f2d..be0276a09 100644 --- a/gnu/lib/libstdc++/libstdc++/config/os/bsd/openbsd/ctype_base.h +++ b/gnu/lib/libstdc++/libstdc++/config/os/bsd/openbsd/ctype_base.h @@ -41,15 +41,15 @@ // NB: Offsets into ctype::_M_table force a particular size // on the mask type. Because of this, we don't use an enum. typedef char mask; - static const mask upper = _U; - static const mask lower = _L; - static const mask alpha = _U | _L; - static const mask digit = _N; - static const mask xdigit = _N | _X; - static const mask space = _S; - static const mask print = _P | _U | _L | _N | _B; - static const mask graph = _P | _U | _L | _N; - static const mask cntrl = _C; - static const mask punct = _P; - static const mask alnum = _U | _L | _N; + static const mask upper = _CTYPE_U; + static const mask lower = _CTYPE_L; + static const mask alpha = _CTYPE_U | _CTYPE_L; + static const mask digit = _CTYPE_N; + static const mask xdigit = _CTYPE_N | _CTYPE_X; + static const mask space = _CTYPE_S; + static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B; + static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N; + static const mask cntrl = _CTYPE_C; + static const mask punct = _CTYPE_P; + static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N; }; diff --git a/gnu/usr.bin/binutils-2.17/binutils/readelf.c b/gnu/usr.bin/binutils-2.17/binutils/readelf.c index f67db474d..961533e35 100644 --- a/gnu/usr.bin/binutils-2.17/binutils/readelf.c +++ b/gnu/usr.bin/binutils-2.17/binutils/readelf.c @@ -2703,6 +2703,7 @@ get_segment_type (unsigned long p_type) case PT_GNU_EH_FRAME: return "GNU_EH_FRAME"; case PT_GNU_STACK: return "GNU_STACK"; + case PT_GNU_PROPERTY: return "GNU_PROPERTY"; case PT_GNU_RELRO: return "GNU_RELRO"; case PT_OPENBSD_RANDOMIZE: return "OPENBSD_RANDOMIZE"; diff --git a/gnu/usr.bin/binutils-2.17/include/elf/common.h b/gnu/usr.bin/binutils-2.17/include/elf/common.h index aa3f2a103..0ee8873d0 100644 --- a/gnu/usr.bin/binutils-2.17/include/elf/common.h +++ b/gnu/usr.bin/binutils-2.17/include/elf/common.h @@ -310,6 +310,7 @@ #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME /* Solaris uses the same value */ #define PT_GNU_STACK (PT_LOOS + 0x474e551) /* Stack flags */ #define PT_GNU_RELRO (PT_LOOS + 0x474e552) /* Read-only after relocation */ +#define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) /* Program property note */ #define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* Fill with random data. */ #define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* Program does W^X violations */ diff --git a/include/ctype.h b/include/ctype.h index e90d375c8..6dd2ced25 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype.h,v 1.25 2017/09/05 03:16:13 schwarze Exp $ */ +/* $OpenBSD: ctype.h,v 1.26 2024/02/04 13:03:18 jca Exp $ */ /* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */ /* @@ -42,14 +42,14 @@ #include -#define _U 0x01 -#define _L 0x02 -#define _N 0x04 -#define _S 0x08 -#define _P 0x10 -#define _C 0x20 -#define _X 0x40 -#define _B 0x80 +#define _CTYPE_U 0x01 +#define _CTYPE_L 0x02 +#define _CTYPE_N 0x04 +#define _CTYPE_S 0x08 +#define _CTYPE_P 0x10 +#define _CTYPE_C 0x20 +#define _CTYPE_X 0x40 +#define _CTYPE_B 0x80 #if __POSIX_VISIBLE >= 200809 #ifndef _LOCALE_T_DEFINED_ @@ -114,57 +114,62 @@ int toupper_l(int, locale_t); __only_inline int isalnum(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_U|_L|_N))); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & + (_CTYPE_U|_CTYPE_L|_CTYPE_N))); } __only_inline int isalpha(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_U|_L))); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & + (_CTYPE_U|_CTYPE_L))); } __only_inline int iscntrl(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _C)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_C)); } __only_inline int isdigit(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _N)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_N)); } __only_inline int isgraph(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_P|_U|_L|_N))); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & + (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N))); } __only_inline int islower(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _L)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_L)); } __only_inline int isprint(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_P|_U|_L|_N|_B))); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & + (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B))); } __only_inline int ispunct(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _P)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_P)); } __only_inline int isspace(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _S)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_S)); } __only_inline int isupper(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _U)); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & _CTYPE_U)); } __only_inline int isxdigit(int _c) { - return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (_N|_X))); + return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & + (_CTYPE_N|_CTYPE_X))); } __only_inline int tolower(int _c) diff --git a/lib/libc/gen/ctype_.c b/lib/libc/gen/ctype_.c index 897224433..9742c9f16 100644 --- a/lib/libc/gen/ctype_.c +++ b/lib/libc/gen/ctype_.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype_.c,v 1.12 2015/09/19 04:02:21 guenther Exp $ */ +/* $OpenBSD: ctype_.c,v 1.13 2024/02/04 13:03:18 jca Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. @@ -36,6 +36,16 @@ #include #include "ctype_private.h" +/* Shorter names for the defines provided by */ +#define _U _CTYPE_U +#define _L _CTYPE_L +#define _N _CTYPE_N +#define _S _CTYPE_S +#define _P _CTYPE_P +#define _C _CTYPE_C +#define _X _CTYPE_X +#define _B _CTYPE_B + const char _C_ctype_[1 + CTYPE_NUM_CHARS] = { 0, _C, _C, _C, _C, _C, _C, _C, _C, diff --git a/lib/libc/gen/isctype.c b/lib/libc/gen/isctype.c index a4e944ca7..2891ccd45 100644 --- a/lib/libc/gen/isctype.c +++ b/lib/libc/gen/isctype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isctype.c,v 1.12 2015/09/13 11:38:08 guenther Exp $ */ +/* $OpenBSD: isctype.c,v 1.13 2024/02/04 13:03:18 jca Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. @@ -41,7 +41,8 @@ int isalnum(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N))); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & + (_CTYPE_U|_CTYPE_L|_CTYPE_N))); } DEF_STRONG(isalnum); @@ -49,7 +50,8 @@ DEF_STRONG(isalnum); int isalpha(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_U|_L))); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & + (_CTYPE_U|_CTYPE_L))); } DEF_STRONG(isalpha); @@ -65,7 +67,7 @@ DEF_STRONG(isblank); int iscntrl(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _C)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_C)); } DEF_STRONG(iscntrl); @@ -73,7 +75,7 @@ DEF_STRONG(iscntrl); int isdigit(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _N)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_N)); } DEF_STRONG(isdigit); @@ -81,7 +83,8 @@ DEF_STRONG(isdigit); int isgraph(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N))); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & + (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N))); } DEF_STRONG(isgraph); @@ -89,7 +92,7 @@ DEF_STRONG(isgraph); int islower(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _L)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_L)); } DEF_STRONG(islower); @@ -97,7 +100,8 @@ DEF_STRONG(islower); int isprint(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B))); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & + (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B))); } DEF_STRONG(isprint); @@ -105,7 +109,7 @@ DEF_STRONG(isprint); int ispunct(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _P)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_P)); } DEF_STRONG(ispunct); @@ -113,7 +117,7 @@ DEF_STRONG(ispunct); int isspace(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _S)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_S)); } DEF_STRONG(isspace); @@ -121,7 +125,7 @@ DEF_STRONG(isspace); int isupper(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _U)); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & _CTYPE_U)); } DEF_STRONG(isupper); @@ -129,7 +133,8 @@ DEF_STRONG(isupper); int isxdigit(int c) { - return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & (_N|_X))); + return (c == EOF ? 0 : ((_ctype_ + 1)[(unsigned char)c] & + (_CTYPE_N|_CTYPE_X))); } DEF_STRONG(isxdigit); diff --git a/lib/libc/locale/iswctype.c b/lib/libc/locale/iswctype.c index ea7cd3149..6cd92fe1a 100644 --- a/lib/libc/locale/iswctype.c +++ b/lib/libc/locale/iswctype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iswctype.c,v 1.8 2022/07/25 21:38:24 guenther Exp $ */ +/* $OpenBSD: iswctype.c,v 1.9 2024/02/04 12:46:01 jca Exp $ */ /* $NetBSD: iswctype.c,v 1.15 2005/02/09 21:35:46 kleink Exp $ */ /* @@ -80,75 +80,75 @@ __tolower_w(wint_t c) int iswalnum(wint_t c) { - return (__isctype_w((c), _CTYPE_A|_CTYPE_D)); + return (__isctype_w((c), _RUNETYPE_A|_RUNETYPE_D)); } int iswalpha(wint_t c) { - return (__isctype_w((c), _CTYPE_A)); + return (__isctype_w((c), _RUNETYPE_A)); } int iswblank(wint_t c) { - return (__isctype_w((c), _CTYPE_B)); + return (__isctype_w((c), _RUNETYPE_B)); } int iswcntrl(wint_t c) { - return (__isctype_w((c), _CTYPE_C)); + return (__isctype_w((c), _RUNETYPE_C)); } int iswdigit(wint_t c) { - return (__isctype_w((c), _CTYPE_D)); + return (__isctype_w((c), _RUNETYPE_D)); } int iswgraph(wint_t c) { - return (__isctype_w((c), _CTYPE_G)); + return (__isctype_w((c), _RUNETYPE_G)); } int iswlower(wint_t c) { - return (__isctype_w((c), _CTYPE_L)); + return (__isctype_w((c), _RUNETYPE_L)); } int iswprint(wint_t c) { - return (__isctype_w((c), _CTYPE_R)); + return (__isctype_w((c), _RUNETYPE_R)); } int iswpunct(wint_t c) { - return (__isctype_w((c), _CTYPE_P)); + return (__isctype_w((c), _RUNETYPE_P)); } int iswspace(wint_t c) { - return (__isctype_w((c), _CTYPE_S)); + return (__isctype_w((c), _RUNETYPE_S)); } DEF_STRONG(iswspace); int iswupper(wint_t c) { - return (__isctype_w((c), _CTYPE_U)); + return (__isctype_w((c), _RUNETYPE_U)); } DEF_STRONG(iswupper); int iswxdigit(wint_t c) { - return (__isctype_w((c), _CTYPE_X)); + return (__isctype_w((c), _RUNETYPE_X)); } wint_t @@ -167,8 +167,9 @@ DEF_STRONG(towlower); int wcwidth(wchar_t c) { - if (__isctype_w((c), _CTYPE_R)) - return (((unsigned)__runetype_w(c) & _CTYPE_SWM) >> _CTYPE_SWS); + if (__isctype_w((c), _RUNETYPE_R)) + return (((unsigned)__runetype_w(c) & _RUNETYPE_SWM) >> + _RUNETYPE_SWS); return -1; } DEF_WEAK(wcwidth); diff --git a/lib/libc/locale/iswctype_l.c b/lib/libc/locale/iswctype_l.c index 2fc9d7de4..a459abba9 100644 --- a/lib/libc/locale/iswctype_l.c +++ b/lib/libc/locale/iswctype_l.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iswctype_l.c,v 1.2 2022/07/25 21:38:24 guenther Exp $ */ +/* $OpenBSD: iswctype_l.c,v 1.3 2024/02/04 12:46:01 jca Exp $ */ /* $NetBSD: iswctype.c,v 1.15 2005/02/09 21:35:46 kleink Exp $ */ /* @@ -82,73 +82,73 @@ __isctype_wl(wint_t c, _RuneType f, locale_t locale) int iswalnum_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_A|_CTYPE_D, locale); + return __isctype_wl(c, _RUNETYPE_A|_RUNETYPE_D, locale); } int iswalpha_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_A, locale); + return __isctype_wl(c, _RUNETYPE_A, locale); } int iswblank_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_B, locale); + return __isctype_wl(c, _RUNETYPE_B, locale); } int iswcntrl_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_C, locale); + return __isctype_wl(c, _RUNETYPE_C, locale); } int iswdigit_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_D, locale); + return __isctype_wl(c, _RUNETYPE_D, locale); } int iswgraph_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_G, locale); + return __isctype_wl(c, _RUNETYPE_G, locale); } int iswlower_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_L, locale); + return __isctype_wl(c, _RUNETYPE_L, locale); } int iswprint_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_R, locale); + return __isctype_wl(c, _RUNETYPE_R, locale); } int iswpunct_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_P, locale); + return __isctype_wl(c, _RUNETYPE_P, locale); } int iswspace_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_S, locale); + return __isctype_wl(c, _RUNETYPE_S, locale); } int iswupper_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_U, locale); + return __isctype_wl(c, _RUNETYPE_U, locale); } int iswxdigit_l(wint_t c, locale_t locale) { - return __isctype_wl(c, _CTYPE_X, locale); + return __isctype_wl(c, _RUNETYPE_X, locale); } wint_t diff --git a/lib/libc/locale/rune.h b/lib/libc/locale/rune.h index f10db484a..18b077562 100644 --- a/lib/libc/locale/rune.h +++ b/lib/libc/locale/rune.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rune.h,v 1.4 2017/09/05 03:16:13 schwarze Exp $ */ +/* $OpenBSD: rune.h,v 1.5 2024/02/04 12:46:01 jca Exp $ */ /* $NetBSD: rune.h,v 1.9 2003/08/07 16:43:04 agc Exp $ */ /*- @@ -47,34 +47,6 @@ #define _LOCALE_C (locale_t)1 #define _LOCALE_UTF8 (locale_t)2 -/* - * map _RTYPE_x to _CTYPE_x - * - * XXX: these should be defined in ctype.h and used in isxxx macros. - * (note: current isxxx macros use "old" NetBSD masks and - * _CTYPE_x are not public.) - */ -#define _CTYPE_A _RUNETYPE_A -#define _CTYPE_C _RUNETYPE_C -#define _CTYPE_D _RUNETYPE_D -#define _CTYPE_G _RUNETYPE_G -#define _CTYPE_L _RUNETYPE_L -#define _CTYPE_P _RUNETYPE_P -#define _CTYPE_S _RUNETYPE_S -#define _CTYPE_U _RUNETYPE_U -#define _CTYPE_X _RUNETYPE_X -#define _CTYPE_B _RUNETYPE_B -#define _CTYPE_R _RUNETYPE_R -#define _CTYPE_I _RUNETYPE_I -#define _CTYPE_T _RUNETYPE_T -#define _CTYPE_Q _RUNETYPE_Q -#define _CTYPE_SWM _RUNETYPE_SWM -#define _CTYPE_SWS _RUNETYPE_SWS -#define _CTYPE_SW0 _RUNETYPE_SW0 -#define _CTYPE_SW1 _RUNETYPE_SW1 -#define _CTYPE_SW2 _RUNETYPE_SW2 -#define _CTYPE_SW3 _RUNETYPE_SW3 - __BEGIN_HIDDEN_DECLS extern _RuneLocale _DefaultRuneLocale; extern _RuneLocale *_Utf8RuneLocale; diff --git a/lib/libc/locale/runetable.c b/lib/libc/locale/runetable.c index 6adc16350..0990fe58c 100644 --- a/lib/libc/locale/runetable.c +++ b/lib/libc/locale/runetable.c @@ -48,134 +48,134 @@ _RuneLocale _DefaultRuneLocale = { "NONE", _DEFAULT_INVALID_RUNE, - { /*00*/ _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - /*08*/ _CTYPE_C, - _CTYPE_C|_CTYPE_S|_CTYPE_B, - _CTYPE_C|_CTYPE_S, - _CTYPE_C|_CTYPE_S, - _CTYPE_C|_CTYPE_S, - _CTYPE_C|_CTYPE_S, - _CTYPE_C, - _CTYPE_C, - /*10*/ _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - /*18*/ _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - _CTYPE_C, - /*20*/ _CTYPE_S|_CTYPE_B|_CTYPE_R|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE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TYPE_A|_CTYPE_SW1, - _CTYPE_L|_CTYPE_R|_CTYPE_G|_CTYPE_A|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1, - _CTYPE_C, + { /*00*/ _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + /*08*/ _RUNETYPE_C, + _RUNETYPE_C|_RUNETYPE_S|_RUNETYPE_B, + _RUNETYPE_C|_RUNETYPE_S, + _RUNETYPE_C|_RUNETYPE_S, + _RUNETYPE_C|_RUNETYPE_S, + _RUNETYPE_C|_RUNETYPE_S, + _RUNETYPE_C, + _RUNETYPE_C, + /*10*/ _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + /*18*/ _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + _RUNETYPE_C, + /*20*/ _RUNETYPE_S|_RUNETYPE_B|_RUNETYPE_R|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + /*28*/ _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + /*30*/ _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|0, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|1, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|2, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|3, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|4, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|5, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|6, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|7, + /*38*/ _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|8, + _RUNETYPE_D|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_X|_RUNETYPE_SW1|9, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + /*40*/ _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|10, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|11, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|12, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|13, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|14, + _RUNETYPE_U|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|15, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*48*/ _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*50*/ _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*58*/ _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_U|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + /*60*/ _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|10, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|11, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|12, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|13, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|14, + _RUNETYPE_L|_RUNETYPE_X|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1|15, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*68*/ _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*70*/ _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + /*78*/ _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_L|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_A|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_P|_RUNETYPE_R|_RUNETYPE_G|_RUNETYPE_SW1, + _RUNETYPE_C, }, { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, diff --git a/lib/libc/locale/wctype.c b/lib/libc/locale/wctype.c index b6c432cb2..5e2fe786a 100644 --- a/lib/libc/locale/wctype.c +++ b/lib/libc/locale/wctype.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wctype.c,v 1.1 2022/07/25 21:38:24 guenther Exp $ */ +/* $OpenBSD: wctype.c,v 1.2 2024/02/04 12:46:01 jca Exp $ */ /* $NetBSD: iswctype.c,v 1.15 2005/02/09 21:35:46 kleink Exp $ */ /* @@ -43,18 +43,18 @@ static struct _WCTypeEntry wctype_entries[_WCTYPE_NINDEXES] = { - { "alnum", _CTYPE_A|_CTYPE_D }, - { "alpha", _CTYPE_A }, - { "blank", _CTYPE_B }, - { "cntrl", _CTYPE_C }, - { "digit", _CTYPE_D }, - { "graph", _CTYPE_G }, - { "lower", _CTYPE_L }, - { "print", _CTYPE_R }, - { "punct", _CTYPE_P }, - { "space", _CTYPE_S }, - { "upper", _CTYPE_U }, - { "xdigit", _CTYPE_X }, + { "alnum", _RUNETYPE_A|_RUNETYPE_D }, + { "alpha", _RUNETYPE_A }, + { "blank", _RUNETYPE_B }, + { "cntrl", _RUNETYPE_C }, + { "digit", _RUNETYPE_D }, + { "graph", _RUNETYPE_G }, + { "lower", _RUNETYPE_L }, + { "print", _RUNETYPE_R }, + { "punct", _RUNETYPE_P }, + { "space", _RUNETYPE_S }, + { "upper", _RUNETYPE_U }, + { "xdigit", _RUNETYPE_X }, }; wctype_t diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 0277202de..3d7810a36 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.319 2024/02/03 15:58:34 beck Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.320 2024/02/04 20:50:23 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1068,7 +1068,7 @@ SSL_is_server(const SSL *s) LSSL_ALIAS(SSL_is_server); static long -ssl_get_default_timeout() +ssl_get_default_timeout(void) { /* * 2 hours, the 24 hours mentioned in the TLSv1 spec diff --git a/lib/libssl/tls13_handshake_msg.c b/lib/libssl/tls13_handshake_msg.c index 134cfb217..c7f4d7b7e 100644 --- a/lib/libssl/tls13_handshake_msg.c +++ b/lib/libssl/tls13_handshake_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls13_handshake_msg.c,v 1.6 2022/07/22 19:33:53 jsing Exp $ */ +/* $OpenBSD: tls13_handshake_msg.c,v 1.7 2024/02/04 20:50:23 tb Exp $ */ /* * Copyright (c) 2018, 2019 Joel Sing * @@ -34,7 +34,7 @@ struct tls13_handshake_msg { }; struct tls13_handshake_msg * -tls13_handshake_msg_new() +tls13_handshake_msg_new(void) { struct tls13_handshake_msg *msg = NULL; diff --git a/regress/lib/libc/timingsafe/timingsafe.c b/regress/lib/libc/timingsafe/timingsafe.c index f6605f869..d768a808b 100644 --- a/regress/lib/libc/timingsafe/timingsafe.c +++ b/regress/lib/libc/timingsafe/timingsafe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timingsafe.c,v 1.3 2014/06/21 22:57:15 tedu Exp $ */ +/* $OpenBSD: timingsafe.c,v 1.4 2024/02/04 20:51:21 tb Exp $ */ /* * Copyright (c) 2014 Google Inc. * @@ -28,7 +28,7 @@ enum { static unsigned char bufone[N], buftwo[N]; void -check() +check(void) { int cmp = memcmp(bufone, buftwo, N); @@ -49,7 +49,7 @@ check() } int -main() +main(void) { int i, j; diff --git a/regress/lib/libcrypto/asn1/asn1basic.c b/regress/lib/libcrypto/asn1/asn1basic.c index 5bcb9009a..1a873bf25 100644 --- a/regress/lib/libcrypto/asn1/asn1basic.c +++ b/regress/lib/libcrypto/asn1/asn1basic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1basic.c,v 1.15 2023/08/15 21:05:44 tb Exp $ */ +/* $OpenBSD: asn1basic.c,v 1.16 2024/02/04 13:07:02 tb Exp $ */ /* * Copyright (c) 2017, 2021 Joel Sing * Copyright (c) 2023 Theo Buehler @@ -699,7 +699,7 @@ asn1_integer_null_data_test(void) ASN1_INTEGER *aint = NULL; uint8_t *p = NULL, *pp; int len; - int failed = 0; + int failed = 1; if ((aint = ASN1_INTEGER_new()) == NULL) { fprintf(stderr, "FAIL: ASN1_INTEGER_new() == NULL\n"); diff --git a/sys/arch/amd64/amd64/codepatch.c b/sys/arch/amd64/amd64/codepatch.c index 1ed1dd993..4bc3852ba 100644 --- a/sys/arch/amd64/amd64/codepatch.c +++ b/sys/arch/amd64/amd64/codepatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: codepatch.c,v 1.10 2023/07/31 01:33:57 guenther Exp $ */ +/* $OpenBSD: codepatch.c,v 1.11 2024/02/04 20:18:48 guenther Exp $ */ /* * Copyright (c) 2014-2015 Stefan Fritsch * @@ -39,8 +39,9 @@ extern struct codepatch codepatch_end; extern char __cptext_start[]; extern char __cptext_end[]; -void codepatch_control_flow(uint16_t _tag, void *_func, int _opcode, - const char *_op); +enum op_type { OP_CALL, OP_JMP }; +__cptext void codepatch_control_flow(uint16_t _tag, void *_func, + enum op_type _type); void codepatch_fill_nop(void *caddr, uint16_t len) @@ -155,26 +156,27 @@ codepatch_replace(uint16_t tag, const void *code, size_t len) void codepatch_call(uint16_t tag, void *func) { - /* 0xe8 == call near */ - codepatch_control_flow(tag, func, 0xe8, "call"); + codepatch_control_flow(tag, func, OP_CALL); } void codepatch_jmp(uint16_t tag, void *func) { - /* 0xe9 == jmp near */ - codepatch_control_flow(tag, func, 0xe9, "jmp"); + codepatch_control_flow(tag, func, OP_JMP); } /* Patch with call or jump to func */ void -codepatch_control_flow(uint16_t tag, void *func, int opcode, const char *op) +codepatch_control_flow(uint16_t tag, void *func, enum op_type type) { struct codepatch *patch; unsigned char *rwaddr; int32_t offset; int i = 0; vaddr_t rwmap = 0; + const char *op = type == OP_JMP ? "jmp" : "call"; + char opcode = type == OP_JMP ? 0xe9 /* jmp near */ + : 0xe8 /* call near */; DBGPRINT("patching tag %u with %s %p", tag, op, func); @@ -189,7 +191,10 @@ codepatch_control_flow(uint16_t tag, void *func, int opcode, const char *op) rwaddr = codepatch_maprw(&rwmap, patch->addr); rwaddr[0] = opcode; memcpy(rwaddr + 1, &offset, sizeof(offset)); - codepatch_fill_nop(rwaddr + 5, patch->len - 5); + if (type == OP_CALL) + codepatch_fill_nop(rwaddr + 5, patch->len - 5); + else /* OP_JMP */ + memset(rwaddr + 5, 0xCC /* int3 */, patch->len - 5); i++; } codepatch_unmaprw(rwmap); diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index 2754f192f..ca2cd2358 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.48 2023/05/12 16:43:00 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.49 2024/02/04 18:44:23 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -587,6 +587,8 @@ efi_dma_constraint(void) fdt_node_is_compatible(node, "rockchip,rk3588") || fdt_node_is_compatible(node, "rockchip,rk3588s")) dma_constraint[1] = htobe64(0xffffffff); + if (fdt_node_is_compatible(node, "lenovo,thinkpad-x13s")) + dma_constraint[1] = htobe64(0xffffffff); /* Pass DMA constraint. */ node = fdt_find_node("/chosen"); diff --git a/sys/dev/ic/qwx.c b/sys/dev/ic/qwx.c index 1441f8a9d..e64306d72 100644 --- a/sys/dev/ic/qwx.c +++ b/sys/dev/ic/qwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qwx.c,v 1.16 2024/02/03 20:07:19 kettenis Exp $ */ +/* $OpenBSD: qwx.c,v 1.17 2024/02/04 17:51:59 kettenis Exp $ */ /* * Copyright 2023 Stefan Sperling @@ -8368,7 +8368,7 @@ qwx_qmi_load_bdf_qmi(struct qwx_softc *sc, int regdb) if (regdb) bdf_type = ATH11K_QMI_BDF_TYPE_REGDB; - else if (len >= QWX_SELFMAG && + else if (boardfw_len >= QWX_SELFMAG && memcmp(boardfw, QWX_ELFMAG, QWX_SELFMAG) == 0) bdf_type = ATH11K_QMI_BDF_TYPE_ELF; else @@ -8376,9 +8376,9 @@ qwx_qmi_load_bdf_qmi(struct qwx_softc *sc, int regdb) DPRINTF("%s: bdf_type %d\n", __func__, bdf_type); - fw_size = MIN(sc->hw_params.fw.board_size, len); + fw_size = MIN(sc->hw_params.fw.board_size, boardfw_len); - ret = qwx_qmi_load_file_target_mem(sc, boardfw, boardfw_len, bdf_type); + ret = qwx_qmi_load_file_target_mem(sc, boardfw, fw_size, bdf_type); if (ret < 0) { printf("%s: failed to load bdf file\n", __func__); goto out; diff --git a/usr.bin/openssl/ca.c b/usr.bin/openssl/ca.c index 1e802a4d7..6fedd22c9 100644 --- a/usr.bin/openssl/ca.c +++ b/usr.bin/openssl/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.57 2023/11/13 12:43:08 tb Exp $ */ +/* $OpenBSD: ca.c,v 1.58 2024/02/04 13:08:29 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2576,7 +2576,6 @@ get_certificate_status(const char *serial, CA_DB *db) goto err; } if (strlen(serial) % 2) { - /* Set the first char to 0 */ ; row[DB_serial][0] = '0'; /* Copy String from serial to row[DB_serial] */ diff --git a/usr.sbin/rpki-client/cert.c b/usr.sbin/rpki-client/cert.c index 7e743dc90..14bed46ee 100644 --- a/usr.sbin/rpki-client/cert.c +++ b/usr.sbin/rpki-client/cert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cert.c,v 1.124 2024/02/03 14:43:15 tb Exp $ */ +/* $OpenBSD: cert.c,v 1.125 2024/02/04 07:43:27 tb Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2021 Job Snijders @@ -737,7 +737,8 @@ struct cert * cert_parse_pre(const char *fn, const unsigned char *der, size_t len) { const unsigned char *oder; - int i; + size_t j; + int i, extsz; X509 *x = NULL; X509_EXTENSION *ext = NULL; const X509_ALGOR *palg; @@ -808,8 +809,12 @@ cert_parse_pre(const char *fn, const unsigned char *der, size_t len) goto out; /* Look for X509v3 extensions. */ + if ((extsz = X509_get_ext_count(x)) <= 0) { + warnx("%s: certificate without X.509v3 extensions", fn); + goto out; + } - for (i = 0; i < X509_get_ext_count(x); i++) { + for (i = 0; i < extsz; i++) { ext = X509_get_ext(x, i); assert(ext != NULL); obj = X509_EXTENSION_get_object(ext); @@ -938,8 +943,8 @@ cert_parse_pre(const char *fn, const unsigned char *der, size_t len) p.fn); goto out; } - for (i = 0; (size_t)i < p.res->asz; i++) { - if (p.res->as[i].type == CERT_AS_INHERIT) { + for (j = 0; j < p.res->asz; j++) { + if (p.res->as[j].type == CERT_AS_INHERIT) { warnx("%s: inherit elements not allowed in EE" " cert", p.fn); goto out; diff --git a/usr.sbin/rpki-client/mft.c b/usr.sbin/rpki-client/mft.c index 86c29ab7b..d6891157e 100644 --- a/usr.sbin/rpki-client/mft.c +++ b/usr.sbin/rpki-client/mft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mft.c,v 1.104 2024/02/03 14:30:47 job Exp $ */ +/* $OpenBSD: mft.c,v 1.105 2024/02/04 00:53:27 job Exp $ */ /* * Copyright (c) 2022 Theo Buehler * Copyright (c) 2019 Kristaps Dzonsons @@ -89,58 +89,6 @@ IMPLEMENT_ASN1_FUNCTIONS(Manifest); #define GENTIME_LENGTH 15 -/* - * Convert an ASN1_GENERALIZEDTIME to a struct tm. - * Returns 1 on success, 0 on failure. - */ -static int -generalizedtime_to_tm(const ASN1_GENERALIZEDTIME *gtime, struct tm *tm) -{ - /* - * ASN1_GENERALIZEDTIME is another name for ASN1_STRING. Check type and - * length, so we don't accidentally accept a UTCTime. Punt on checking - * Zulu time for OpenSSL: we don't want to mess about with silly flags. - */ - if (ASN1_STRING_type(gtime) != V_ASN1_GENERALIZEDTIME) - return 0; - if (ASN1_STRING_length(gtime) != GENTIME_LENGTH) - return 0; - - memset(tm, 0, sizeof(*tm)); - return ASN1_TIME_to_tm(gtime, tm); -} - -/* - * Validate and verify the time validity of the mft. - * Returns 1 if all is good and for any other case 0. - */ -static int -mft_parse_time(const ASN1_GENERALIZEDTIME *from, - const ASN1_GENERALIZEDTIME *until, struct parse *p) -{ - struct tm tm_from, tm_until; - - if (!generalizedtime_to_tm(from, &tm_from)) { - warnx("%s: embedded from time format invalid", p->fn); - return 0; - } - if (!generalizedtime_to_tm(until, &tm_until)) { - warnx("%s: embedded until time format invalid", p->fn); - return 0; - } - - if ((p->res->thisupdate = timegm(&tm_from)) == -1 || - (p->res->nextupdate = timegm(&tm_until)) == -1) - errx(1, "%s: timegm failed", p->fn); - - if (p->res->thisupdate > p->res->nextupdate) { - warnx("%s: bad update interval", p->fn); - return 0; - } - - return 1; -} - /* * Determine rtype corresponding to file extension. Returns RTYPE_INVALID * on error or unkown extension. @@ -301,8 +249,32 @@ mft_parse_econtent(const unsigned char *d, size_t dsz, struct parse *p) if (p->res->seqnum == NULL) goto out; - if (!mft_parse_time(mft->thisUpdate, mft->nextUpdate, p)) + /* + * OpenSSL's DER decoder implementation will accept a GeneralizedTime + * which doesn't conform to RFC 5280. So, double check. + */ + if (ASN1_STRING_length(mft->thisUpdate) != GENTIME_LENGTH) { + warnx("%s: embedded from time format invalid", p->fn); goto out; + } + if (ASN1_STRING_length(mft->nextUpdate) != GENTIME_LENGTH) { + warnx("%s: embedded until time format invalid", p->fn); + goto out; + } + + if (!x509_get_time(mft->thisUpdate, &p->res->thisupdate)) { + warn("%s: parsing manifest thisUpdate failed", p->fn); + goto out; + } + if (!x509_get_time(mft->nextUpdate, &p->res->nextupdate)) { + warn("%s: parsing manifest nextUpdate failed", p->fn); + goto out; + } + + if (p->res->thisupdate > p->res->nextupdate) { + warnx("%s: bad update interval", p->fn); + goto out; + } if (OBJ_obj2nid(mft->fileHashAlg) != NID_sha256) { warnx("%s: RFC 6486 section 4.2.1: fileHashAlg: " diff --git a/usr.sbin/vmd/fw_cfg.c b/usr.sbin/vmd/fw_cfg.c index b875082b6..3e9459bae 100644 --- a/usr.sbin/vmd/fw_cfg.c +++ b/usr.sbin/vmd/fw_cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fw_cfg.c,v 1.7 2023/02/06 20:33:34 dv Exp $ */ +/* $OpenBSD: fw_cfg.c,v 1.8 2024/02/04 14:53:12 dv Exp $ */ /* * Copyright (c) 2018 Claudio Jeker * @@ -396,7 +396,7 @@ fw_cfg_add_file(const char *name, const void *data, size_t len) if (fw_cfg_lookup_file(name)) fatalx("%s: fw_cfg: file %s exists", __progname, name); - if ((f = calloc(sizeof(*f), 1)) == NULL) + if ((f = calloc(1, sizeof(*f))) == NULL) fatal("%s", __func__); if ((f->data = malloc(len)) == NULL) diff --git a/usr.sbin/vmd/vioblk.c b/usr.sbin/vmd/vioblk.c index 427fdea43..b1d393f8a 100644 --- a/usr.sbin/vmd/vioblk.c +++ b/usr.sbin/vmd/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.10 2024/02/03 00:28:07 jsg Exp $ */ +/* $OpenBSD: vioblk.c,v 1.11 2024/02/04 14:54:51 dv Exp $ */ /* * Copyright (c) 2023 Dave Voutila @@ -301,7 +301,7 @@ vioblk_notifyq(struct vioblk_dev *dev) uint8_t ds; off_t offset; ssize_t sz; - int is_write, notify, i; + int is_write, notify = 0, i; char *vr; struct vring_desc *table, *desc; struct vring_avail *avail; diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c index 613cddebd..f821b7e3c 100644 --- a/usr.sbin/vmd/vmd.c +++ b/usr.sbin/vmd/vmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.c,v 1.153 2024/01/18 14:49:59 claudio Exp $ */ +/* $OpenBSD: vmd.c,v 1.154 2024/02/04 14:56:45 dv Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -527,9 +527,8 @@ vmd_dispatch_vmm(int fd, struct privsep_proc *p, struct imsg *imsg) imsg->hdr.peerid == IMSG_AGENTX_PEERID ? PROC_AGENTX : PROC_CONTROL, -1, imsg->hdr.type, imsg->hdr.peerid, -1, &vir, sizeof(vir)) == -1) { - log_debug("%s: GET_INFO_VM failed for vm %d, removing", - __func__, vm->vm_vmid); - vm_terminate(vm, __func__); + if (vm) + vm_terminate(vm, __func__); return (-1); } break; diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c index 917c7a22d..1f7678fba 100644 --- a/usr.sbin/vmd/vmm.c +++ b/usr.sbin/vmd/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.117 2024/01/18 14:49:59 claudio Exp $ */ +/* $OpenBSD: vmm.c,v 1.118 2024/02/04 14:57:00 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -650,8 +650,7 @@ vmm_start_vm(struct imsg *imsg, uint32_t *id, pid_t *pid) if ((vm = vm_getbyvmid(imsg->hdr.peerid)) == NULL) { log_warnx("%s: can't find vm", __func__); - ret = ENOENT; - goto err; + return (ENOENT); } vcp = &vm->vm_params.vmc_params; @@ -747,7 +746,6 @@ vmm_start_vm(struct imsg *imsg, uint32_t *id, pid_t *pid) if (vmm_pipe(vm, fds[0], vmm_dispatch_vm) == -1) fatal("setup vm pipe"); - return (0); } else { /* Child. Create a new session. */ if (setsid() == -1)