sync with OpenBSD -current

This commit is contained in:
purplerain 2024-06-24 17:59:29 +00:00
parent 7bc640af07
commit 4a6edb3688
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
61 changed files with 680 additions and 286 deletions

View file

@ -1,4 +1,4 @@
dnl $OpenBSD: hardware,v 1.23 2024/04/23 10:17:20 fcambus Exp $ dnl $OpenBSD: hardware,v 1.24 2024/06/24 05:15:29 jsg Exp $
The following machines are targeted by SecBSD/MACHINE: The following machines are targeted by SecBSD/MACHINE:
Allwinner A64/H5/H6 Allwinner A64/H5/H6
@ -31,7 +31,7 @@ The following machines are targeted by SecBSD/MACHINE:
Apple iMac (24-inch, M1, 2021) Apple iMac (24-inch, M1, 2021)
Apple MacBook Pro (14-inch, M1 Pro/Max, 2021) Apple MacBook Pro (14-inch, M1 Pro/Max, 2021)
Apple MacBook Pro (16-inch, M1 Pro/Max, 2021) Apple MacBook Pro (16-inch, M1 Pro/Max, 2021)
Apple Studio (M1 Max/Ultra, 2022) Apple Mac Studio (M1 Max/Ultra, 2022)
Apple Mac mini (M2, 2023) Apple Mac mini (M2, 2023)
Apple MacBook Air (13-inch, M2, 2022) Apple MacBook Air (13-inch, M2, 2022)
Apple MacBook Pro (13-inch, M2, 2022) Apple MacBook Pro (13-inch, M2, 2022)
@ -39,7 +39,7 @@ The following machines are targeted by SecBSD/MACHINE:
Apple Mac mini (M2 Pro, 2023) Apple Mac mini (M2 Pro, 2023)
Apple MacBook Pro (14-inch, M2 Pro/Max, 2023) Apple MacBook Pro (14-inch, M2 Pro/Max, 2023)
Apple MacBook Pro (16-inch, M2 Pro/Max, 2023) Apple MacBook Pro (16-inch, M2 Pro/Max, 2023)
Apple Studio (M2 Max/Ultra, 2023) Apple Mac Studio (M2 Max/Ultra, 2023)
Broadcom BCM2837/BCM2711 Broadcom BCM2837/BCM2711
Raspberry Pi 3 Raspberry Pi 3
Raspberry Pi 3 Model B+ Raspberry Pi 3 Model B+

View file

@ -1,4 +1,4 @@
/* $OpenBSD: string.h,v 1.32 2017/09/05 03:16:13 schwarze Exp $ */ /* $OpenBSD: string.h,v 1.33 2024/06/23 07:08:26 otto Exp $ */
/* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */
/*- /*-
@ -37,7 +37,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/_null.h> #include <sys/_null.h>
#include <machine/_types.h> #include <sys/_types.h>
/* /*
* POSIX mandates that certain string functions not present in ISO C * POSIX mandates that certain string functions not present in ISO C
@ -128,7 +128,7 @@ size_t strlcat(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3))); __attribute__ ((__bounded__(__string__,1,3)));
size_t strlcpy(char *, const char *, size_t) size_t strlcpy(char *, const char *, size_t)
__attribute__ ((__bounded__(__string__,1,3))); __attribute__ ((__bounded__(__string__,1,3)));
void strmode(int, char *); void strmode(__mode_t, char *);
char *strsep(char **, const char *); char *strsep(char **, const char *);
int timingsafe_bcmp(const void *, const void *, size_t); int timingsafe_bcmp(const void *, const void *, size_t);
int timingsafe_memcmp(const void *, const void *, size_t); int timingsafe_memcmp(const void *, const void *, size_t);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: strmode.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */ /* $OpenBSD: strmode.c,v 1.9 2024/06/23 07:08:26 otto Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,10 +32,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>
/* XXX mode should be mode_t */
void void
strmode(int mode, char *p) strmode(mode_t mode, char *p)
{ {
/* print type */ /* print type */
switch (mode & S_IFMT) { switch (mode & S_IFMT) {

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: swapctl.2,v 1.25 2021/11/21 23:44:55 jan Exp $ .\" $OpenBSD: swapctl.2,v 1.26 2024/06/24 14:39:28 deraadt Exp $
.\" $NetBSD: swapctl.2,v 1.10 1998/08/29 17:11:09 mrg Exp $ .\" $NetBSD: swapctl.2,v 1.10 1998/08/29 17:11:09 mrg Exp $
.\" .\"
.\" Copyright (c) 1997 Matthew R. Green .\" Copyright (c) 1997 Matthew R. Green
@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: November 21 2021 $ .Dd $Mdocdate: June 24 2024 $
.Dt SWAPCTL 2 .Dt SWAPCTL 2
.Os .Os
.Sh NAME .Sh NAME
@ -197,7 +197,7 @@ has already been made available for swapping.
.It Bq Er EINVAL .It Bq Er EINVAL
The device configured by The device configured by
.Fa arg .Fa arg
has no associated size, or the has insufficient size, or the
.Fa cmd .Fa cmd
was unknown. was unknown.
.It Bq Er ENXIO .It Bq Er ENXIO

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.195 2024/05/24 19:16:53 tb Exp $ # $OpenBSD: Makefile,v 1.196 2024/06/24 06:43:22 tb Exp $
LIB= crypto LIB= crypto
LIBREBUILD=y LIBREBUILD=y
@ -36,6 +36,7 @@ CFLAGS+= -I${LCRYPTO_SRC}/dh
CFLAGS+= -I${LCRYPTO_SRC}/dsa CFLAGS+= -I${LCRYPTO_SRC}/dsa
CFLAGS+= -I${LCRYPTO_SRC}/ec CFLAGS+= -I${LCRYPTO_SRC}/ec
CFLAGS+= -I${LCRYPTO_SRC}/ecdsa CFLAGS+= -I${LCRYPTO_SRC}/ecdsa
CFLAGS+= -I${LCRYPTO_SRC}/err
CFLAGS+= -I${LCRYPTO_SRC}/evp CFLAGS+= -I${LCRYPTO_SRC}/evp
CFLAGS+= -I${LCRYPTO_SRC}/hidden CFLAGS+= -I${LCRYPTO_SRC}/hidden
CFLAGS+= -I${LCRYPTO_SRC}/hmac CFLAGS+= -I${LCRYPTO_SRC}/hmac

View file

@ -1,4 +1,4 @@
/* $OpenBSD: asn1_err.c,v 1.26 2023/07/05 21:23:36 beck Exp $ */ /* $OpenBSD: asn1_err.c,v 1.27 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason)
static ERR_STRING_DATA ASN1_str_functs[] = { static const ERR_STRING_DATA ASN1_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA ASN1_str_reasons[] = { static const ERR_STRING_DATA ASN1_str_reasons[] = {
{ERR_REASON(ASN1_R_ADDING_OBJECT) , "adding object"}, {ERR_REASON(ASN1_R_ADDING_OBJECT) , "adding object"},
{ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) , "asn1 parse error"}, {ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) , "asn1 parse error"},
{ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) , "asn1 sig parse error"}, {ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) , "asn1 sig parse error"},
@ -206,8 +208,8 @@ ERR_load_ASN1_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) { if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) {
ERR_load_strings(0, ASN1_str_functs); ERR_load_const_strings(ASN1_str_functs);
ERR_load_strings(0, ASN1_str_reasons); ERR_load_const_strings(ASN1_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bio_err.c,v 1.20 2023/07/05 21:23:37 beck Exp $ */ /* $OpenBSD: bio_err.c,v 1.21 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/bio.h> #include <openssl/bio.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BIO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BIO,0,reason)
static ERR_STRING_DATA BIO_str_functs[] = { static const ERR_STRING_DATA BIO_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA BIO_str_reasons[] = { static const ERR_STRING_DATA BIO_str_reasons[] = {
{ERR_REASON(BIO_R_ACCEPT_ERROR) , "accept error"}, {ERR_REASON(BIO_R_ACCEPT_ERROR) , "accept error"},
{ERR_REASON(BIO_R_BAD_FOPEN_MODE) , "bad fopen mode"}, {ERR_REASON(BIO_R_BAD_FOPEN_MODE) , "bad fopen mode"},
{ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP) , "bad hostname lookup"}, {ERR_REASON(BIO_R_BAD_HOSTNAME_LOOKUP) , "bad hostname lookup"},
@ -112,8 +114,8 @@ ERR_load_BIO_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) { if (ERR_func_error_string(BIO_str_functs[0].error) == NULL) {
ERR_load_strings(0, BIO_str_functs); ERR_load_const_strings(BIO_str_functs);
ERR_load_strings(0, BIO_str_reasons); ERR_load_const_strings(BIO_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bn_err.c,v 1.17 2023/07/08 12:21:58 beck Exp $ */ /* $OpenBSD: bn_err.c,v 1.18 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/bn.h> #include <openssl/bn.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BN,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BN,0,reason)
static ERR_STRING_DATA BN_str_functs[]= { static const ERR_STRING_DATA BN_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA BN_str_reasons[]= { static const ERR_STRING_DATA BN_str_reasons[] = {
{ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"}, {ERR_REASON(BN_R_ARG2_LT_ARG3) , "arg2 lt arg3"},
{ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"}, {ERR_REASON(BN_R_BAD_RECIPROCAL) , "bad reciprocal"},
{ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"}, {ERR_REASON(BN_R_BIGNUM_TOO_LONG) , "bignum too long"},
@ -100,8 +102,8 @@ ERR_load_BN_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(BN_str_functs[0].error) == NULL) { if (ERR_func_error_string(BN_str_functs[0].error) == NULL) {
ERR_load_strings(0, BN_str_functs); ERR_load_const_strings(BN_str_functs);
ERR_load_strings(0, BN_str_reasons); ERR_load_const_strings(BN_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: buf_err.c,v 1.13 2023/07/08 08:26:26 beck Exp $ */ /* $OpenBSD: buf_err.c,v 1.14 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/buffer.h> #include <openssl/buffer.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)
static ERR_STRING_DATA BUF_str_functs[] = { static const ERR_STRING_DATA BUF_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA BUF_str_reasons[] = { static const ERR_STRING_DATA BUF_str_reasons[] = {
{0, NULL} {0, NULL}
}; };
@ -81,8 +83,8 @@ ERR_load_BUF_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) { if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) {
ERR_load_strings(0, BUF_str_functs); ERR_load_const_strings(BUF_str_functs);
ERR_load_strings(0, BUF_str_reasons); ERR_load_const_strings(BUF_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cms_err.c,v 1.14 2023/07/08 08:26:26 beck Exp $ */ /* $OpenBSD: cms_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */
/* /*
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
* *
@ -11,17 +11,19 @@
#include <openssl/cms.h> #include <openssl/cms.h>
#include <openssl/err.h> #include <openssl/err.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CMS,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CMS,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CMS,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CMS,0,reason)
static ERR_STRING_DATA CMS_str_functs[] = { static const ERR_STRING_DATA CMS_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA CMS_str_reasons[] = { static const ERR_STRING_DATA CMS_str_reasons[] = {
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ADD_SIGNER_ERROR), "add signer error"}, {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_ADD_SIGNER_ERROR), "add signer error"},
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_ALREADY_PRESENT), {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_CERTIFICATE_ALREADY_PRESENT),
"certificate already present"}, "certificate already present"},
@ -155,8 +157,8 @@ ERR_load_CMS_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) { if (ERR_func_error_string(CMS_str_functs[0].error) == NULL) {
ERR_load_strings(ERR_LIB_CMS, CMS_str_functs); ERR_load_const_strings(CMS_str_functs);
ERR_load_strings(ERR_LIB_CMS, CMS_str_reasons); ERR_load_const_strings(CMS_str_reasons);
} }
#endif #endif
return 1; return 1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: conf_err.c,v 1.16 2024/04/09 13:56:30 beck Exp $ */ /* $OpenBSD: conf_err.c,v 1.17 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/conf.h> #include <openssl/conf.h>
#include <openssl/err.h> #include <openssl/err.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)
static ERR_STRING_DATA CONF_str_functs[]= { static const ERR_STRING_DATA CONF_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA CONF_str_reasons[]= { static const ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"}, {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"},
{ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"}, {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"},
{ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"}, {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"},
@ -98,8 +100,8 @@ ERR_load_CONF_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) { if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) {
ERR_load_strings(0, CONF_str_functs); ERR_load_const_strings(CONF_str_functs);
ERR_load_strings(0, CONF_str_reasons); ERR_load_const_strings(CONF_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpt_err.c,v 1.15 2023/07/08 08:28:23 beck Exp $ */ /* $OpenBSD: cpt_err.c,v 1.16 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,12 +60,14 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CRYPTO,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CRYPTO,0,reason)
static ERR_STRING_DATA CRYPTO_str_functs[] = { static const ERR_STRING_DATA CRYPTO_str_functs[] = {
{ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX), "CRYPTO_get_ex_new_index"}, {ERR_FUNC(CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX), "CRYPTO_get_ex_new_index"},
{ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID), "CRYPTO_get_new_dynlockid"}, {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID), "CRYPTO_get_new_dynlockid"},
{ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_LOCKID), "CRYPTO_get_new_lockid"}, {ERR_FUNC(CRYPTO_F_CRYPTO_GET_NEW_LOCKID), "CRYPTO_get_new_lockid"},
@ -79,7 +81,7 @@ static ERR_STRING_DATA CRYPTO_str_functs[] = {
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA CRYPTO_str_reasons[] = { static const ERR_STRING_DATA CRYPTO_str_reasons[] = {
{ERR_REASON(CRYPTO_R_FIPS_MODE_NOT_SUPPORTED), "fips mode not supported"}, {ERR_REASON(CRYPTO_R_FIPS_MODE_NOT_SUPPORTED), "fips mode not supported"},
{ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK), "no dynlock create callback"}, {ERR_REASON(CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK), "no dynlock create callback"},
{0, NULL} {0, NULL}
@ -92,8 +94,8 @@ ERR_load_CRYPTO_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(CRYPTO_str_functs[0].error) == NULL) { if (ERR_func_error_string(CRYPTO_str_functs[0].error) == NULL) {
ERR_load_strings(0, CRYPTO_str_functs); ERR_load_const_strings(CRYPTO_str_functs);
ERR_load_strings(0, CRYPTO_str_reasons); ERR_load_const_strings(CRYPTO_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ct_err.c,v 1.7 2022/07/12 14:42:48 kn Exp $ */ /* $OpenBSD: ct_err.c,v 1.8 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -56,9 +56,11 @@
#include <openssl/ct.h> #include <openssl/ct.h>
#include <openssl/err.h> #include <openssl/err.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
static ERR_STRING_DATA CT_str_functs[] = { static const ERR_STRING_DATA CT_str_functs[] = {
{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"}, {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW, 0), "CTLOG_new"},
{ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0), {ERR_PACK(ERR_LIB_CT, CT_F_CTLOG_NEW_FROM_BASE64, 0),
"CTLOG_new_from_base64"}, "CTLOG_new_from_base64"},
@ -101,7 +103,7 @@ static ERR_STRING_DATA CT_str_functs[] = {
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA CT_str_reasons[] = { static const ERR_STRING_DATA CT_str_reasons[] = {
{ERR_PACK(ERR_LIB_CT, 0, CT_R_BASE64_DECODE_ERROR), {ERR_PACK(ERR_LIB_CT, 0, CT_R_BASE64_DECODE_ERROR),
"base64 decode error"}, "base64 decode error"},
{ERR_PACK(ERR_LIB_CT, 0, CT_R_INVALID_LOG_ID_LENGTH), {ERR_PACK(ERR_LIB_CT, 0, CT_R_INVALID_LOG_ID_LENGTH),
@ -140,8 +142,8 @@ int
ERR_load_CT_strings(void) ERR_load_CT_strings(void)
{ {
if (ERR_func_error_string(CT_str_functs[0].error) == NULL) { if (ERR_func_error_string(CT_str_functs[0].error) == NULL) {
ERR_load_strings(0, CT_str_functs); ERR_load_const_strings(CT_str_functs);
ERR_load_strings(0, CT_str_reasons); ERR_load_const_strings(CT_str_reasons);
} }
return 1; return 1;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dh_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ /* $OpenBSD: dh_err.c,v 1.22 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -57,20 +57,22 @@
#include <openssl/opensslconf.h> #include <openssl/opensslconf.h>
#include <openssl/err.h>
#include <openssl/dh.h> #include <openssl/dh.h>
#include <openssl/err.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DH,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DH,0,reason)
static ERR_STRING_DATA DH_str_functs[] = { static const ERR_STRING_DATA DH_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA DH_str_reasons[] = { static const ERR_STRING_DATA DH_str_reasons[] = {
{ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"}, {ERR_REASON(DH_R_BAD_GENERATOR) ,"bad generator"},
{ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"}, {ERR_REASON(DH_R_BN_DECODE_ERROR) ,"bn decode error"},
{ERR_REASON(DH_R_BN_ERROR) ,"bn error"}, {ERR_REASON(DH_R_BN_ERROR) ,"bn error"},
@ -104,8 +106,8 @@ ERR_load_DH_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(DH_str_functs[0].error) == NULL) { if (ERR_func_error_string(DH_str_functs[0].error) == NULL) {
ERR_load_strings(0, DH_str_functs); ERR_load_const_strings(DH_str_functs);
ERR_load_strings(0, DH_str_reasons); ERR_load_const_strings(DH_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: dsa_err.c,v 1.21 2024/05/19 08:22:40 tb Exp $ */ /* $OpenBSD: dsa_err.c,v 1.22 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/dsa.h> #include <openssl/dsa.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)
static ERR_STRING_DATA DSA_str_functs[] = { static const ERR_STRING_DATA DSA_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA DSA_str_reasons[] = { static const ERR_STRING_DATA DSA_str_reasons[] = {
{ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"}, {ERR_REASON(DSA_R_BAD_Q_VALUE) ,"bad q value"},
{ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"}, {ERR_REASON(DSA_R_BN_DECODE_ERROR) ,"bn decode error"},
{ERR_REASON(DSA_R_BN_ERROR) ,"bn error"}, {ERR_REASON(DSA_R_BN_ERROR) ,"bn error"},
@ -94,8 +96,8 @@ ERR_load_DSA_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) { if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) {
ERR_load_strings(0, DSA_str_functs); ERR_load_const_strings(DSA_str_functs);
ERR_load_strings(0, DSA_str_reasons); ERR_load_const_strings(DSA_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_err.c,v 1.19 2024/05/19 08:26:03 tb Exp $ */ /* $OpenBSD: ec_err.c,v 1.20 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ec.h> #include <openssl/ec.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EC,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EC,0,reason)
static ERR_STRING_DATA EC_str_functs[] = { static const ERR_STRING_DATA EC_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA EC_str_reasons[] = { static const ERR_STRING_DATA EC_str_reasons[] = {
{ERR_REASON(EC_R_ASN1_ERROR), "asn1 error"}, {ERR_REASON(EC_R_ASN1_ERROR), "asn1 error"},
{ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD), "asn1 unknown field"}, {ERR_REASON(EC_R_ASN1_UNKNOWN_FIELD), "asn1 unknown field"},
{ERR_REASON(EC_R_BAD_SIGNATURE), "bad signature"}, {ERR_REASON(EC_R_BAD_SIGNATURE), "bad signature"},
@ -140,10 +142,9 @@ void
ERR_load_EC_strings(void) ERR_load_EC_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(EC_str_functs[0].error) == NULL) { if (ERR_func_error_string(EC_str_functs[0].error) == NULL) {
ERR_load_strings(0, EC_str_functs); ERR_load_const_strings(EC_str_functs);
ERR_load_strings(0, EC_str_reasons); ERR_load_const_strings(EC_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: err.c,v 1.60 2024/03/02 11:37:13 tb Exp $ */ /* $OpenBSD: err.c,v 1.61 2024/06/24 06:43:22 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -244,9 +244,9 @@ struct st_ERR_FNS {
/* Works on the "error_hash" string table */ /* Works on the "error_hash" string table */
LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create); LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create);
void (*cb_err_del)(void); void (*cb_err_del)(void);
ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); const ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *);
ERR_STRING_DATA *(*cb_err_set_item)(ERR_STRING_DATA *); const ERR_STRING_DATA *(*cb_err_set_item)(const ERR_STRING_DATA *);
ERR_STRING_DATA *(*cb_err_del_item)(ERR_STRING_DATA *); const ERR_STRING_DATA *(*cb_err_del_item)(const ERR_STRING_DATA *);
/* Works on the "thread_hash" error-state table */ /* Works on the "thread_hash" error-state table */
LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create); LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create);
void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash); void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash);
@ -260,9 +260,9 @@ struct st_ERR_FNS {
/* Predeclarations of the "err_defaults" functions */ /* Predeclarations of the "err_defaults" functions */
static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create); static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create);
static void int_err_del(void); static void int_err_del(void);
static ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); static const ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *);
static ERR_STRING_DATA *int_err_set_item(ERR_STRING_DATA *); static const ERR_STRING_DATA *int_err_set_item(const ERR_STRING_DATA *);
static ERR_STRING_DATA *int_err_del_item(ERR_STRING_DATA *); static const ERR_STRING_DATA *int_err_del_item(const ERR_STRING_DATA *);
static LHASH_OF(ERR_STATE) *int_thread_get(int create); static LHASH_OF(ERR_STATE) *int_thread_get(int create);
static void int_thread_release(LHASH_OF(ERR_STATE) **hash); static void int_thread_release(LHASH_OF(ERR_STATE) **hash);
static ERR_STATE *int_thread_get_item(const ERR_STATE *); static ERR_STATE *int_thread_get_item(const ERR_STATE *);
@ -369,7 +369,7 @@ int_err_del(void)
CRYPTO_w_unlock(CRYPTO_LOCK_ERR); CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
} }
static ERR_STRING_DATA * static const ERR_STRING_DATA *
int_err_get_item(const ERR_STRING_DATA *d) int_err_get_item(const ERR_STRING_DATA *d)
{ {
ERR_STRING_DATA *p; ERR_STRING_DATA *p;
@ -387,10 +387,10 @@ int_err_get_item(const ERR_STRING_DATA *d)
return p; return p;
} }
static ERR_STRING_DATA * static const ERR_STRING_DATA *
int_err_set_item(ERR_STRING_DATA *d) int_err_set_item(const ERR_STRING_DATA *d)
{ {
ERR_STRING_DATA *p; const ERR_STRING_DATA *p;
LHASH_OF(ERR_STRING_DATA) *hash; LHASH_OF(ERR_STRING_DATA) *hash;
err_fns_check(); err_fns_check();
@ -399,14 +399,14 @@ int_err_set_item(ERR_STRING_DATA *d)
return NULL; return NULL;
CRYPTO_w_lock(CRYPTO_LOCK_ERR); CRYPTO_w_lock(CRYPTO_LOCK_ERR);
p = lh_ERR_STRING_DATA_insert(hash, d); p = lh_ERR_STRING_DATA_insert(hash, (void *)d);
CRYPTO_w_unlock(CRYPTO_LOCK_ERR); CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
return p; return p;
} }
static ERR_STRING_DATA * static const ERR_STRING_DATA *
int_err_del_item(ERR_STRING_DATA *d) int_err_del_item(const ERR_STRING_DATA *d)
{ {
ERR_STRING_DATA *p; ERR_STRING_DATA *p;
LHASH_OF(ERR_STRING_DATA) *hash; LHASH_OF(ERR_STRING_DATA) *hash;
@ -692,6 +692,16 @@ ERR_load_strings(int lib, ERR_STRING_DATA *str)
} }
LCRYPTO_ALIAS(ERR_load_strings); LCRYPTO_ALIAS(ERR_load_strings);
void
ERR_load_const_strings(const ERR_STRING_DATA *str)
{
ERR_load_ERR_strings();
while (str->error) {
ERRFN(err_set_item)(str);
str++;
}
}
void void
ERR_unload_strings(int lib, ERR_STRING_DATA *str) ERR_unload_strings(int lib, ERR_STRING_DATA *str)
{ {
@ -964,7 +974,8 @@ LCRYPTO_ALIAS(ERR_error_string);
const char * const char *
ERR_lib_error_string(unsigned long e) ERR_lib_error_string(unsigned long e)
{ {
ERR_STRING_DATA d, *p; const ERR_STRING_DATA *p;
ERR_STRING_DATA d;
unsigned long l; unsigned long l;
if (!OPENSSL_init_crypto(0, NULL)) if (!OPENSSL_init_crypto(0, NULL))
@ -981,7 +992,8 @@ LCRYPTO_ALIAS(ERR_lib_error_string);
const char * const char *
ERR_func_error_string(unsigned long e) ERR_func_error_string(unsigned long e)
{ {
ERR_STRING_DATA d, *p; const ERR_STRING_DATA *p;
ERR_STRING_DATA d;
unsigned long l, f; unsigned long l, f;
err_fns_check(); err_fns_check();
@ -996,7 +1008,8 @@ LCRYPTO_ALIAS(ERR_func_error_string);
const char * const char *
ERR_reason_error_string(unsigned long e) ERR_reason_error_string(unsigned long e)
{ {
ERR_STRING_DATA d, *p = NULL; const ERR_STRING_DATA *p = NULL;
ERR_STRING_DATA d;
unsigned long l, r; unsigned long l, r;
err_fns_check(); err_fns_check();

View file

@ -0,0 +1,123 @@
/* $OpenBSD: err_local.h,v 1.1 2024/06/24 06:43:22 tb 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.]
*/
/* ====================================================================
* Copyright (c) 1998-2006 The OpenSSL 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.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <openssl/err.h>
#ifndef HEADER_ERR_LOCAL_H
#define HEADER_ERR_LOCAL_H
__BEGIN_HIDDEN_DECLS
void ERR_load_const_strings(const ERR_STRING_DATA *str);
__END_HIDDEN_DECLS
#endif /* HEADER_ERR_LOCAL_H */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_err.c,v 1.33 2024/04/09 13:52:41 beck Exp $ */ /* $OpenBSD: evp_err.c,v 1.34 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_EVP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_EVP,0,reason)
static ERR_STRING_DATA EVP_str_functs[] = { static const ERR_STRING_DATA EVP_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA EVP_str_reasons[] = { static const ERR_STRING_DATA EVP_str_reasons[] = {
{ERR_REASON(EVP_R_AES_IV_SETUP_FAILED) , "aes iv setup failed"}, {ERR_REASON(EVP_R_AES_IV_SETUP_FAILED) , "aes iv setup failed"},
{ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) , "aes key setup failed"}, {ERR_REASON(EVP_R_AES_KEY_SETUP_FAILED) , "aes key setup failed"},
{ERR_REASON(EVP_R_ASN1_LIB) , "asn1 lib"}, {ERR_REASON(EVP_R_ASN1_LIB) , "asn1 lib"},
@ -159,8 +161,8 @@ ERR_load_EVP_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) { if (ERR_func_error_string(EVP_str_functs[0].error) == NULL) {
ERR_load_strings(0, EVP_str_functs); ERR_load_const_strings(EVP_str_functs);
ERR_load_strings(0, EVP_str_reasons); ERR_load_const_strings(EVP_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kdf_err.c,v 1.9 2022/07/12 14:42:49 kn Exp $ */ /* $OpenBSD: kdf_err.c,v 1.10 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2018 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2018 The OpenSSL Project. All rights reserved.
* *
@ -56,16 +56,18 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/kdf.h> #include <openssl/kdf.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
static ERR_STRING_DATA KDF_str_functs[] = { static const ERR_STRING_DATA KDF_str_functs[] = {
{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_CTRL_STR, 0), "pkey_hkdf_ctrl_str"}, {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_CTRL_STR, 0), "pkey_hkdf_ctrl_str"},
{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_DERIVE, 0), "pkey_hkdf_derive"}, {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_DERIVE, 0), "pkey_hkdf_derive"},
{ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_INIT, 0), "pkey_hkdf_init"}, {ERR_PACK(ERR_LIB_KDF, KDF_F_PKEY_HKDF_INIT, 0), "pkey_hkdf_init"},
{0, NULL}, {0, NULL},
}; };
static ERR_STRING_DATA KDF_str_reasons[] = { static const ERR_STRING_DATA KDF_str_reasons[] = {
{ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_KEY), "missing key"}, {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_KEY), "missing key"},
{ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST), {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST),
"missing message digest"}, "missing message digest"},
@ -81,8 +83,8 @@ ERR_load_KDF_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) { if (ERR_func_error_string(KDF_str_functs[0].error) == NULL) {
ERR_load_strings(0, KDF_str_functs); ERR_load_const_strings(KDF_str_functs);
ERR_load_strings(0, KDF_str_reasons); ERR_load_const_strings(KDF_str_reasons);
} }
#endif #endif
return 1; return 1;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: obj_err.c,v 1.14 2023/07/08 12:27:51 beck Exp $ */ /* $OpenBSD: obj_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/objects.h> #include <openssl/objects.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OBJ,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OBJ,0,reason)
static ERR_STRING_DATA OBJ_str_functs[] = { static const ERR_STRING_DATA OBJ_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA OBJ_str_reasons[] = { static const ERR_STRING_DATA OBJ_str_reasons[] = {
{ERR_REASON(OBJ_R_MALLOC_FAILURE) , "malloc failure"}, {ERR_REASON(OBJ_R_MALLOC_FAILURE) , "malloc failure"},
{ERR_REASON(OBJ_R_UNKNOWN_NID) , "unknown nid"}, {ERR_REASON(OBJ_R_UNKNOWN_NID) , "unknown nid"},
{0, NULL} {0, NULL}
@ -83,8 +85,8 @@ ERR_load_OBJ_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(OBJ_str_functs[0].error) == NULL) { if (ERR_func_error_string(OBJ_str_functs[0].error) == NULL) {
ERR_load_strings(0, OBJ_str_functs); ERR_load_const_strings(OBJ_str_functs);
ERR_load_strings(0, OBJ_str_reasons); ERR_load_const_strings(OBJ_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ocsp_err.c,v 1.10 2023/07/08 10:44:00 beck Exp $ */ /* $OpenBSD: ocsp_err.c,v 1.11 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ocsp.h> #include <openssl/ocsp.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_OCSP,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_OCSP,0,reason)
static ERR_STRING_DATA OCSP_str_functs[]= { static const ERR_STRING_DATA OCSP_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA OCSP_str_reasons[]= { static const ERR_STRING_DATA OCSP_str_reasons[] = {
{ERR_REASON(OCSP_R_BAD_DATA) , "bad data"}, {ERR_REASON(OCSP_R_BAD_DATA) , "bad data"},
{ERR_REASON(OCSP_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, {ERR_REASON(OCSP_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
{ERR_REASON(OCSP_R_DIGEST_ERR) , "digest err"}, {ERR_REASON(OCSP_R_DIGEST_ERR) , "digest err"},
@ -111,8 +113,8 @@ ERR_load_OCSP_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(OCSP_str_functs[0].error) == NULL) { if (ERR_func_error_string(OCSP_str_functs[0].error) == NULL) {
ERR_load_strings(0, OCSP_str_functs); ERR_load_const_strings(OCSP_str_functs);
ERR_load_strings(0, OCSP_str_reasons); ERR_load_const_strings(OCSP_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pem_err.c,v 1.14 2023/07/07 13:40:44 beck Exp $ */ /* $OpenBSD: pem_err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PEM,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PEM,0,reason)
static ERR_STRING_DATA PEM_str_functs[] = { static const ERR_STRING_DATA PEM_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA PEM_str_reasons[] = { static const ERR_STRING_DATA PEM_str_reasons[] = {
{ERR_REASON(PEM_R_BAD_BASE64_DECODE) , "bad base64 decode"}, {ERR_REASON(PEM_R_BAD_BASE64_DECODE) , "bad base64 decode"},
{ERR_REASON(PEM_R_BAD_DECRYPT) , "bad decrypt"}, {ERR_REASON(PEM_R_BAD_DECRYPT) , "bad decrypt"},
{ERR_REASON(PEM_R_BAD_END_LINE) , "bad end line"}, {ERR_REASON(PEM_R_BAD_END_LINE) , "bad end line"},
@ -109,8 +111,8 @@ ERR_load_PEM_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(PEM_str_functs[0].error) == NULL) { if (ERR_func_error_string(PEM_str_functs[0].error) == NULL) {
ERR_load_strings(0, PEM_str_functs); ERR_load_const_strings(PEM_str_functs);
ERR_load_strings(0, PEM_str_reasons); ERR_load_const_strings(PEM_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pk12err.c,v 1.14 2023/02/16 08:38:17 tb Exp $ */ /* $OpenBSD: pk12err.c,v 1.15 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pkcs12.h> #include <openssl/pkcs12.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS12,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS12,0,reason)
static ERR_STRING_DATA PKCS12_str_functs[]= { static const ERR_STRING_DATA PKCS12_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA PKCS12_str_reasons[]= { static const ERR_STRING_DATA PKCS12_str_reasons[] = {
{ERR_REASON(PKCS12_R_CANT_PACK_STRUCTURE), "cant pack structure"}, {ERR_REASON(PKCS12_R_CANT_PACK_STRUCTURE), "cant pack structure"},
{ERR_REASON(PKCS12_R_CONTENT_TYPE_NOT_DATA), "content type not data"}, {ERR_REASON(PKCS12_R_CONTENT_TYPE_NOT_DATA), "content type not data"},
{ERR_REASON(PKCS12_R_DECODE_ERROR) , "decode error"}, {ERR_REASON(PKCS12_R_DECODE_ERROR) , "decode error"},
@ -103,8 +105,8 @@ ERR_load_PKCS12_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(PKCS12_str_functs[0].error) == NULL) { if (ERR_func_error_string(PKCS12_str_functs[0].error) == NULL) {
ERR_load_strings(0, PKCS12_str_functs); ERR_load_const_strings(PKCS12_str_functs);
ERR_load_strings(0, PKCS12_str_reasons); ERR_load_const_strings(PKCS12_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pkcs7err.c,v 1.15 2023/02/16 08:38:17 tb Exp $ */ /* $OpenBSD: pkcs7err.c,v 1.16 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pkcs7.h> #include <openssl/pkcs7.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_PKCS7,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_PKCS7,0,reason)
static ERR_STRING_DATA PKCS7_str_functs[]= { static const ERR_STRING_DATA PKCS7_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA PKCS7_str_reasons[]= { static const ERR_STRING_DATA PKCS7_str_reasons[] = {
{ERR_REASON(PKCS7_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, {ERR_REASON(PKCS7_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
{ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"}, {ERR_REASON(PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"},
{ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED), "cipher not initialized"}, {ERR_REASON(PKCS7_R_CIPHER_NOT_INITIALIZED), "cipher not initialized"},
@ -135,8 +137,8 @@ ERR_load_PKCS7_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(PKCS7_str_functs[0].error) == NULL) { if (ERR_func_error_string(PKCS7_str_functs[0].error) == NULL) {
ERR_load_strings(0, PKCS7_str_functs); ERR_load_const_strings(PKCS7_str_functs);
ERR_load_strings(0, PKCS7_str_reasons); ERR_load_const_strings(PKCS7_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rand_err.c,v 1.17 2023/07/07 12:01:32 beck Exp $ */ /* $OpenBSD: rand_err.c,v 1.18 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RAND,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RAND,0,reason)
static ERR_STRING_DATA RAND_str_functs[] = { static const ERR_STRING_DATA RAND_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA RAND_str_reasons[] = { static const ERR_STRING_DATA RAND_str_reasons[] = {
{ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED), "dual ec drbg disabled"}, {ERR_REASON(RAND_R_DUAL_EC_DRBG_DISABLED), "dual ec drbg disabled"},
{ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG), "error initialising drbg"}, {ERR_REASON(RAND_R_ERROR_INITIALISING_DRBG), "error initialising drbg"},
{ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG), "error instantiating drbg"}, {ERR_REASON(RAND_R_ERROR_INSTANTIATING_DRBG), "error instantiating drbg"},
@ -86,8 +88,8 @@ ERR_load_RAND_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(RAND_str_functs[0].error) == NULL) { if (ERR_func_error_string(RAND_str_functs[0].error) == NULL) {
ERR_load_strings(0, RAND_str_functs); ERR_load_const_strings(RAND_str_functs);
ERR_load_strings(0, RAND_str_reasons); ERR_load_const_strings(RAND_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rsa_err.c,v 1.22 2023/07/08 12:26:45 beck Exp $ */ /* $OpenBSD: rsa_err.c,v 1.23 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason)
static ERR_STRING_DATA RSA_str_functs[] = { static const ERR_STRING_DATA RSA_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA RSA_str_reasons[] = { static const ERR_STRING_DATA RSA_str_reasons[] = {
{ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"}, {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"},
{ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"}, {ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"},
{ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"}, {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"},
@ -150,8 +152,8 @@ ERR_load_RSA_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) { if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) {
ERR_load_strings(0, RSA_str_functs); ERR_load_const_strings(RSA_str_functs);
ERR_load_strings(0, RSA_str_reasons); ERR_load_const_strings(RSA_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ts_err.c,v 1.7 2023/07/07 07:25:21 beck Exp $ */ /* $OpenBSD: ts_err.c,v 1.8 2024/06/24 06:43:22 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ts.h> #include <openssl/ts.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_TS,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_TS,0,reason)
static ERR_STRING_DATA TS_str_functs[] = { static const ERR_STRING_DATA TS_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA TS_str_reasons[]= { static const ERR_STRING_DATA TS_str_reasons[] = {
{ERR_REASON(TS_R_BAD_PKCS7_TYPE) , "bad pkcs7 type"}, {ERR_REASON(TS_R_BAD_PKCS7_TYPE) , "bad pkcs7 type"},
{ERR_REASON(TS_R_BAD_TYPE) , "bad type"}, {ERR_REASON(TS_R_BAD_TYPE) , "bad type"},
{ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
@ -116,8 +118,8 @@ ERR_load_TS_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(TS_str_functs[0].error) == NULL) { if (ERR_func_error_string(TS_str_functs[0].error) == NULL) {
ERR_load_strings(0, TS_str_functs); ERR_load_const_strings(TS_str_functs);
ERR_load_strings(0, TS_str_reasons); ERR_load_const_strings(TS_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ui_err.c,v 1.12 2023/02/16 08:38:17 tb Exp $ */ /* $OpenBSD: ui_err.c,v 1.13 2024/06/24 06:43:23 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -60,17 +60,19 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ui.h> #include <openssl/ui.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)
static ERR_STRING_DATA UI_str_functs[] = { static const ERR_STRING_DATA UI_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA UI_str_reasons[] = { static const ERR_STRING_DATA UI_str_reasons[] = {
{ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS), "common ok and cancel characters"}, {ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS), "common ok and cancel characters"},
{ERR_REASON(UI_R_INDEX_TOO_LARGE), "index too large"}, {ERR_REASON(UI_R_INDEX_TOO_LARGE), "index too large"},
{ERR_REASON(UI_R_INDEX_TOO_SMALL), "index too small"}, {ERR_REASON(UI_R_INDEX_TOO_SMALL), "index too small"},
@ -88,8 +90,8 @@ ERR_load_UI_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(UI_str_functs[0].error) == NULL) { if (ERR_func_error_string(UI_str_functs[0].error) == NULL) {
ERR_load_strings(0, UI_str_functs); ERR_load_const_strings(UI_str_functs);
ERR_load_strings(0, UI_str_reasons); ERR_load_const_strings(UI_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_conf.c,v 1.17 2024/06/18 09:47:03 tb Exp $ */ /* $OpenBSD: x509_conf.c,v 1.18 2024/06/24 06:32:04 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 1999. * project 1999.
*/ */
@ -198,32 +198,32 @@ do_ext_i2d(const X509V3_EXT_METHOD *method, int nid, int crit,
ext_der = NULL; ext_der = NULL;
ext_len = ASN1_item_i2d(ext_struct, &ext_der, method->it); ext_len = ASN1_item_i2d(ext_struct, &ext_der, method->it);
if (ext_len < 0) if (ext_len < 0)
goto merr; goto err;
} else { } else {
unsigned char *p; unsigned char *p;
if ((ext_len = method->i2d(ext_struct, NULL)) <= 0) if ((ext_len = method->i2d(ext_struct, NULL)) <= 0)
goto merr; goto err;
if ((ext_der = calloc(1, ext_len)) == NULL) if ((ext_der = calloc(1, ext_len)) == NULL)
goto merr; goto err;
p = ext_der; p = ext_der;
if (method->i2d(ext_struct, &p) != ext_len) if (method->i2d(ext_struct, &p) != ext_len)
goto merr; goto err;
} }
if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL) if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)
goto merr; goto err;
ASN1_STRING_set0(ext_oct, ext_der, ext_len); ASN1_STRING_set0(ext_oct, ext_der, ext_len);
ext_der = NULL; ext_der = NULL;
ext_len = 0; ext_len = 0;
ext = X509_EXTENSION_create_by_NID(NULL, nid, crit, ext_oct); ext = X509_EXTENSION_create_by_NID(NULL, nid, crit, ext_oct);
if (ext == NULL) if (ext == NULL)
goto merr; goto err;
ASN1_OCTET_STRING_free(ext_oct); ASN1_OCTET_STRING_free(ext_oct);
return ext; return ext;
merr: err:
free(ext_der); free(ext_der);
ASN1_OCTET_STRING_free(ext_oct); ASN1_OCTET_STRING_free(ext_oct);
X509V3error(ERR_R_MALLOC_FAILURE); X509V3error(ERR_R_MALLOC_FAILURE);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_err.c,v 1.22 2023/05/14 17:20:26 tb Exp $ */ /* $OpenBSD: x509_err.c,v 1.23 2024/06/24 06:43:23 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
* *
@ -61,17 +61,19 @@
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#include "err_local.h"
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509,0,reason)
static ERR_STRING_DATA X509_str_functs[] = { static const ERR_STRING_DATA X509_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA X509_str_reasons[] = { static const ERR_STRING_DATA X509_str_reasons[] = {
{ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"}, {ERR_REASON(X509_R_BAD_X509_FILETYPE) , "bad x509 filetype"},
{ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"}, {ERR_REASON(X509_R_BASE64_DECODE_ERROR) , "base64 decode error"},
{ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"}, {ERR_REASON(X509_R_CANT_CHECK_DH_KEY) , "cant check dh key"},
@ -108,12 +110,12 @@ static ERR_STRING_DATA X509_str_reasons[] = {
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0) #define ERR_FUNC(func) ERR_PACK(ERR_LIB_X509V3,func,0)
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_X509V3,0,reason)
static ERR_STRING_DATA X509V3_str_functs[] = { static const ERR_STRING_DATA X509V3_str_functs[] = {
{ERR_FUNC(0xfff), "CRYPTO_internal"}, {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL} {0, NULL}
}; };
static ERR_STRING_DATA X509V3_str_reasons[] = { static const ERR_STRING_DATA X509V3_str_reasons[] = {
{ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"}, {ERR_REASON(X509V3_R_BAD_IP_ADDRESS) , "bad ip address"},
{ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"}, {ERR_REASON(X509V3_R_BAD_OBJECT) , "bad object"},
{ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"}, {ERR_REASON(X509V3_R_BN_DEC2BN_ERROR) , "bn dec2bn error"},
@ -192,8 +194,8 @@ ERR_load_X509_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(X509_str_functs[0].error) == NULL) { if (ERR_func_error_string(X509_str_functs[0].error) == NULL) {
ERR_load_strings(0, X509_str_functs); ERR_load_const_strings(X509_str_functs);
ERR_load_strings(0, X509_str_reasons); ERR_load_const_strings(X509_str_reasons);
} }
#endif #endif
} }
@ -205,8 +207,8 @@ ERR_load_X509V3_strings(void)
{ {
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) { if (ERR_func_error_string(X509V3_str_functs[0].error) == NULL) {
ERR_load_strings(0, X509V3_str_functs); ERR_load_const_strings(X509V3_str_functs);
ERR_load_strings(0, X509V3_str_reasons); ERR_load_const_strings(X509V3_str_reasons);
} }
#endif #endif
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ssl_err.c,v 1.47 2024/02/03 15:58:33 beck Exp $ */ /* $OpenBSD: ssl_err.c,v 1.49 2024/06/24 06:50:07 tb Exp $ */
/* ==================================================================== /* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
* *
@ -67,7 +67,7 @@
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_SSL,0,reason) #define ERR_REASON(reason) ERR_PACK(ERR_LIB_SSL,0,reason)
/* See SSL_state_func_code below */ /* See SSL_state_func_code below */
static ERR_STRING_DATA SSL_str_functs[]= { static ERR_STRING_DATA SSL_str_functs[] = {
{ERR_FUNC(1), "CONNECT_CW_FLUSH"}, {ERR_FUNC(1), "CONNECT_CW_FLUSH"},
{ERR_FUNC(2), "CONNECT_CW_CLNT_HELLO"}, {ERR_FUNC(2), "CONNECT_CW_CLNT_HELLO"},
{ERR_FUNC(3), "CONNECT_CW_CLNT_HELLO"}, {ERR_FUNC(3), "CONNECT_CW_CLNT_HELLO"},
@ -136,19 +136,19 @@ static ERR_STRING_DATA SSL_str_functs[]= {
{ERR_FUNC(70), "ACCEPT_SW_SESSION_TICKET"}, {ERR_FUNC(70), "ACCEPT_SW_SESSION_TICKET"},
{ERR_FUNC(71), "ACCEPT_SW_CERT_STATUS"}, {ERR_FUNC(71), "ACCEPT_SW_CERT_STATUS"},
{ERR_FUNC(72), "ACCEPT_SW_CERT_STATUS"}, {ERR_FUNC(72), "ACCEPT_SW_CERT_STATUS"},
{ERR_FUNC(73), "ST_BEFORE"}, {ERR_FUNC(73), "ST_BEFORE"},
{ERR_FUNC(74), "ST_ACCEPT"}, {ERR_FUNC(74), "ST_ACCEPT"},
{ERR_FUNC(75), "ST_CONNECT"}, {ERR_FUNC(75), "ST_CONNECT"},
{ERR_FUNC(76), "ST_OK"}, {ERR_FUNC(76), "ST_OK"},
{ERR_FUNC(77), "ST_RENEGOTIATE"}, {ERR_FUNC(77), "ST_RENEGOTIATE"},
{ERR_FUNC(78), "ST_BEFORE_CONNECT"}, {ERR_FUNC(78), "ST_BEFORE_CONNECT"},
{ERR_FUNC(79), "ST_OK_CONNECT"}, {ERR_FUNC(79), "ST_OK_CONNECT"},
{ERR_FUNC(80), "ST_BEFORE_ACCEPT"}, {ERR_FUNC(80), "ST_BEFORE_ACCEPT"},
{ERR_FUNC(81), "ST_OK_ACCEPT"}, {ERR_FUNC(81), "ST_OK_ACCEPT"},
{ERR_FUNC(83), "DTLS1_ST_CR_HELLO_VERIFY_REQUEST"}, {ERR_FUNC(83), "DTLS1_ST_CR_HELLO_VERIFY_REQUEST"},
{ERR_FUNC(84), "DTLS1_ST_CR_HELLO_VERIFY_REQUEST"}, {ERR_FUNC(84), "DTLS1_ST_CR_HELLO_VERIFY_REQUEST"},
{ERR_FUNC(85), "DTLS1_ST_SW_HELLO_VERIFY_REQUEST"}, {ERR_FUNC(85), "DTLS1_ST_SW_HELLO_VERIFY_REQUEST"},
{ERR_FUNC(86), "DTLS1_ST_SW_HELLO_VERIFY_REQUEST"}, {ERR_FUNC(86), "DTLS1_ST_SW_HELLO_VERIFY_REQUEST"},
{ERR_FUNC(0xfff), "(UNKNOWN)SSL_internal"}, {ERR_FUNC(0xfff), "(UNKNOWN)SSL_internal"},
{0, NULL} {0, NULL}
}; };

View file

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.4 2022/12/05 14:43:06 tb Exp $ # $OpenBSD: Makefile,v 1.5 2024/06/23 13:53:21 tb Exp $
RUST_OPENSSL_TESTS = /usr/local/share/rust-openssl-tests RUST_OPENSSL_TESTS = /usr/local/share/rust-openssl-tests
CARGO = /usr/local/bin/cargo CARGO = /usr/local/bin/cargo
@ -20,7 +20,7 @@ ${_WORKSPACE_COOKIE}:
cp ${.CURDIR}/Cargo.toml ${.OBJDIR}/ cp ${.CURDIR}/Cargo.toml ${.OBJDIR}/
. endif . endif
mkdir -p .cargo mkdir -p .cargo
cp ${.CURDIR}/config .cargo/ cp ${.CURDIR}/config.toml .cargo/
cd ${.OBJDIR} && ln -sf ${WORKSPACE_LINKS:S,^,${RUST_OPENSSL_TESTS}/,} . cd ${.OBJDIR} && ln -sf ${WORKSPACE_LINKS:S,^,${RUST_OPENSSL_TESTS}/,} .
touch $@ touch $@

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mem.c,v 1.35 2021/03/24 14:26:39 bluhm Exp $ */ /* $OpenBSD: mem.c,v 1.36 2024/06/23 22:08:37 kettenis Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993 * Copyright (c) 1982, 1986, 1990, 1993
@ -252,7 +252,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return mem_ioctl(dev, cmd, data, flags, p); return mem_ioctl(dev, cmd, data, flags, p);
} }
#endif #endif
return (ENODEV); return (ENOTTY);
} }
#ifdef MTRR #ifdef MTRR

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mem.c,v 1.23 2021/03/25 04:12:00 jsg Exp $ */ /* $OpenBSD: mem.c,v 1.24 2024/06/23 22:08:37 kettenis Exp $ */
/* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */
/* /*
@ -251,5 +251,5 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return 0; return 0;
} }
return (EOPNOTSUPP); return (ENOTTY);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.120 2024/06/21 01:52:17 jsg Exp $ */ /* $OpenBSD: cpu.c,v 1.121 2024/06/23 10:17:16 kettenis Exp $ */
/* /*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com> * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@ -1174,6 +1174,8 @@ cpu_init(void)
if (ID_AA64MMFR1_PAN(id_aa64mmfr1) >= ID_AA64MMFR1_PAN_IMPL) { if (ID_AA64MMFR1_PAN(id_aa64mmfr1) >= ID_AA64MMFR1_PAN_IMPL) {
sctlr = READ_SPECIALREG(sctlr_el1); sctlr = READ_SPECIALREG(sctlr_el1);
sctlr &= ~SCTLR_SPAN; sctlr &= ~SCTLR_SPAN;
if (ID_AA64MMFR1_PAN(id_aa64mmfr1) >= ID_AA64MMFR1_PAN_EPAN)
sctlr |= SCTLR_EPAN;
WRITE_SPECIALREG(sctlr_el1, sctlr); WRITE_SPECIALREG(sctlr_el1, sctlr);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: mem.c,v 1.6 2018/05/04 15:45:11 visa Exp $ */ /* $OpenBSD: mem.c,v 1.7 2024/06/23 22:08:37 kettenis Exp $ */
/* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */
/* /*
@ -253,5 +253,5 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return 0; return 0;
} }
return (EOPNOTSUPP); return (ENOTTY);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: agintc.c,v 1.57 2024/06/19 22:10:45 patrick Exp $ */ /* $OpenBSD: agintc.c,v 1.58 2024/06/23 21:58:34 patrick Exp $ */
/* /*
* Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com> * Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com>
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
@ -1516,6 +1516,7 @@ agintc_send_ipi(struct cpu_info *ci, int id)
#define GITS_BASER_PGSZ_4K (0ULL << 8) #define GITS_BASER_PGSZ_4K (0ULL << 8)
#define GITS_BASER_PGSZ_16K (1ULL << 8) #define GITS_BASER_PGSZ_16K (1ULL << 8)
#define GITS_BASER_PGSZ_64K (2ULL << 8) #define GITS_BASER_PGSZ_64K (2ULL << 8)
#define GITS_BASER_SZ_MASK (0xffULL)
#define GITS_BASER_PA_MASK 0x7ffffffff000ULL #define GITS_BASER_PA_MASK 0x7ffffffff000ULL
#define GITS_TRANSLATER 0x10040 #define GITS_TRANSLATER 0x10040
@ -1572,6 +1573,7 @@ struct agintc_msi_softc {
uint16_t sc_cmdidx; uint16_t sc_cmdidx;
int sc_devbits; int sc_devbits;
uint32_t sc_deviceid_max;
struct agintc_dmamem *sc_dtt; struct agintc_dmamem *sc_dtt;
size_t sc_dtt_pgsz; size_t sc_dtt_pgsz;
uint8_t sc_dte_sz; uint8_t sc_dte_sz;
@ -1703,6 +1705,13 @@ agintc_msi_attach(struct device *parent, struct device *self, void *aux)
size = (1ULL << sc->sc_devbits) * sc->sc_dte_sz; size = (1ULL << sc->sc_devbits) * sc->sc_dte_sz;
size = roundup(size, sc->sc_dtt_pgsz); size = roundup(size, sc->sc_dtt_pgsz);
/* Clamp down to maximum configurable num pages */
if (size / sc->sc_dtt_pgsz > GITS_BASER_SZ_MASK + 1)
size = (GITS_BASER_SZ_MASK + 1) * sc->sc_dtt_pgsz;
/* Calculate max deviceid based off configured size */
sc->sc_deviceid_max = (size / sc->sc_dte_sz) - 1;
/* Allocate table. */ /* Allocate table. */
sc->sc_dtt = agintc_dmamem_alloc(sc->sc_dmat, sc->sc_dtt = agintc_dmamem_alloc(sc->sc_dmat,
size, sc->sc_dtt_pgsz); size, sc->sc_dtt_pgsz);
@ -1858,6 +1867,9 @@ agintc_msi_create_device(struct agintc_msi_softc *sc, uint32_t deviceid)
struct agintc_msi_device *md; struct agintc_msi_device *md;
struct gits_cmd cmd; struct gits_cmd cmd;
if (deviceid > sc->sc_deviceid_max)
return NULL;
md = malloc(sizeof(*md), M_DEVBUF, M_ZERO | M_WAITOK); md = malloc(sizeof(*md), M_DEVBUF, M_ZERO | M_WAITOK);
md->md_deviceid = deviceid; md->md_deviceid = deviceid;
md->md_itt = agintc_dmamem_alloc(sc->sc_dmat, md->md_itt = agintc_dmamem_alloc(sc->sc_dmat,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: armreg.h,v 1.34 2024/05/27 06:20:59 kettenis Exp $ */ /* $OpenBSD: armreg.h,v 1.35 2024/06/23 10:17:16 kettenis Exp $ */
/*- /*-
* Copyright (c) 2013, 2014 Andrew Turner * Copyright (c) 2013, 2014 Andrew Turner
* Copyright (c) 2015 The FreeBSD Foundation * Copyright (c) 2015 The FreeBSD Foundation
@ -705,6 +705,7 @@
#define SCTLR_EnIA 0x0000000080000000 #define SCTLR_EnIA 0x0000000080000000
#define SCTLR_BT0 0x0000000800000000 #define SCTLR_BT0 0x0000000800000000
#define SCTLR_BT1 0x0000001000000000 #define SCTLR_BT1 0x0000001000000000
#define SCTLR_EPAN 0x0200000000000000
/* SPSR_EL1 */ /* SPSR_EL1 */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: conf.c,v 1.48 2024/06/14 19:49:17 kettenis Exp $ */ /* $OpenBSD: conf.c,v 1.49 2024/06/23 15:37:31 kettenis Exp $ */
/* /*
* Copyright (c) 1996 Michael Shalayeff * Copyright (c) 1996 Michael Shalayeff
@ -47,7 +47,7 @@
#include "efipxe.h" #include "efipxe.h"
#include "softraid_arm64.h" #include "softraid_arm64.h"
const char version[] = "1.19"; const char version[] = "1.20";
int debug = 0; int debug = 0;
struct fs_ops file_system[] = { struct fs_ops file_system[] = {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: efiacpi.c,v 1.16 2023/10/09 22:05:27 patrick Exp $ */ /* $OpenBSD: efiacpi.c,v 1.17 2024/06/23 15:37:31 kettenis Exp $ */
/* /*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
@ -402,7 +402,8 @@ static int gic_version;
static uint64_t gicc_base; static uint64_t gicc_base;
static uint64_t gicd_base; static uint64_t gicd_base;
static uint64_t gicr_base; static uint64_t gicr_base;
static uint32_t gicr_size; static uint64_t gicr_size;
static uint64_t gicr_stride;
void void
efi_acpi_madt_gicc(struct acpi_madt_gicc *gicc) efi_acpi_madt_gicc(struct acpi_madt_gicc *gicc)
@ -436,6 +437,30 @@ efi_acpi_madt_gicc(struct acpi_madt_gicc *gicc)
/* Stash GIC information. */ /* Stash GIC information. */
gicc_base = gicc->base_address; gicc_base = gicc->base_address;
/*
* The redistributor base address may be specified per-CPU.
* In that case we will need to reconstruct the base, size and
* stride to use for the redistributor registers.
*/
if (gicc->gicr_base_address > 0) {
if (gicr_base > 0) {
uint32_t size;
if (gicc->gicr_base_address < gicr_base)
size = gicr_base - gicc->gicr_base_address;
else
size = gicc->gicr_base_address - gicr_base;
if (gicr_stride == 0 || size < gicr_stride)
gicr_stride = size;
if (gicr_size == 0 || size > gicr_size)
gicr_size = size;
gicr_base = MIN(gicr_base, gicc->gicr_base_address);
} else {
gicr_base = gicc->gicr_base_address;
gicr_size = 0x20000;
}
}
} }
void void
@ -579,7 +604,7 @@ efi_acpi_madt(struct acpi_table_header *hdr)
reg[0] = htobe64(gicd_base); reg[0] = htobe64(gicd_base);
reg[1] = htobe64(0x10000); reg[1] = htobe64(0x10000);
reg[2] = htobe64(gicr_base); reg[2] = htobe64(gicr_base);
reg[3] = htobe64(gicr_size); reg[3] = htobe64(gicr_size + gicr_stride);
break; break;
default: default:
return; return;
@ -589,6 +614,11 @@ efi_acpi_madt(struct acpi_table_header *hdr)
node = fdt_find_node("/interrupt-controller"); node = fdt_find_node("/interrupt-controller");
fdt_node_set_string_property(node, "compatible", compat); fdt_node_set_string_property(node, "compatible", compat);
fdt_node_set_property(node, "reg", reg, sizeof(reg)); fdt_node_set_property(node, "reg", reg, sizeof(reg));
if (gicr_stride > 0) {
uint64_t stride = htobe64(gicr_stride);
fdt_node_add_property(node, "redistributor-stride",
&stride, sizeof(stride));
}
fdt_node_set_string_property(node, "status", "okay"); fdt_node_set_string_property(node, "status", "okay");
} }

View file

@ -1,5 +1,5 @@
/* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */
/* $OpenBSD: mem.c,v 1.56 2023/03/08 04:43:07 guenther Exp $ */ /* $OpenBSD: mem.c,v 1.57 2024/06/23 22:08:37 kettenis Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993 * Copyright (c) 1982, 1986, 1990, 1993
@ -260,7 +260,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return mem_ioctl(dev, cmd, data, flags, p); return mem_ioctl(dev, cmd, data, flags, p);
} }
#endif #endif
return (ENODEV); return (ENOTTY);
} }
#ifdef MTRR #ifdef MTRR

View file

@ -1,4 +1,4 @@
/* $OpenBSD: acpibat.c,v 1.70 2022/04/06 18:59:27 naddy Exp $ */ /* $OpenBSD: acpibat.c,v 1.71 2024/06/24 15:56:07 mglocker Exp $ */
/* /*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
* *
@ -525,6 +525,12 @@ acpibat_notify(struct aml_node *node, int notify_type, void *arg)
case 0x00: /* Poll sensors */ case 0x00: /* Poll sensors */
case 0x80: /* _BST changed */ case 0x80: /* _BST changed */
acpibat_getbst(sc); acpibat_getbst(sc);
/*
* On some machines the Power Source Device doesn't get
* notified when the AC adapter is plugged or unplugged,
* but the battery does get notified.
*/
aml_notify_dev(ACPI_DEV_AC, 0x80);
break; break;
case 0x81: /* _BIF/_BIX changed */ case 0x81: /* _BIF/_BIX changed */
acpibat_getbix(sc); acpibat_getbix(sc);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: qcscm.c,v 1.5 2023/07/22 22:48:35 patrick Exp $ */ /* $OpenBSD: qcscm.c,v 1.6 2024/06/23 22:04:53 patrick Exp $ */
/* /*
* Copyright (c) 2022 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2022 Patrick Wildt <patrick@blueri.se>
* *
@ -204,14 +204,25 @@ qcscm_smc_exec(uint64_t *in, uint64_t *out)
"ldp x2, x3, [%0, #16]\n" "ldp x2, x3, [%0, #16]\n"
"ldp x4, x5, [%0, #32]\n" "ldp x4, x5, [%0, #32]\n"
"ldp x6, x7, [%0, #48]\n" "ldp x6, x7, [%0, #48]\n"
"ldp x8, x9, [%0, #64]\n"
"ldp x10, x11, [%0, #80]\n"
"ldp x12, x13, [%0, #96]\n"
"ldp x14, x15, [%0, #112]\n"
"ldp x16, x17, [%0, #128]\n"
"smc #0\n" "smc #0\n"
"stp x0, x1, [%1, #0]\n" "stp x0, x1, [%1, #0]\n"
"stp x2, x3, [%1, #16]\n" "stp x2, x3, [%1, #16]\n"
"stp x4, x5, [%1, #32]\n" "stp x4, x5, [%1, #32]\n"
"stp x6, x7, [%1, #48]\n" :: "stp x6, x7, [%1, #48]\n"
"stp x8, x9, [%1, #64]\n"
"stp x10, x11, [%1, #80]\n"
"stp x12, x13, [%1, #96]\n"
"stp x14, x15, [%1, #112]\n"
"stp x16, x17, [%1, #128]\n" ::
"r" (in), "r" (out) : "r" (in), "r" (out) :
"x0", "x1", "x2", "x3", "x0", "x1", "x2", "x3", "x4", "x5",
"x4", "x5", "x6", "x7", "x6", "x7", "x8", "x9", "x10", "x11",
"x12", "x13", "x14", "x15", "x16", "x17",
"memory"); "memory");
} }
@ -219,7 +230,7 @@ int
qcscm_smc_call(struct qcscm_softc *sc, uint8_t owner, uint8_t svc, uint8_t cmd, qcscm_smc_call(struct qcscm_softc *sc, uint8_t owner, uint8_t svc, uint8_t cmd,
uint32_t arginfo, uint64_t *args, int arglen, uint64_t *res) uint32_t arginfo, uint64_t *args, int arglen, uint64_t *res)
{ {
uint64_t smcreq[8] = { 0 }, smcres[8] = { 0 }; uint64_t smcreq[18] = { 0 }, smcres[18] = { 0 };
uint64_t *smcextreq; uint64_t *smcextreq;
int i; int i;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rkusbphy.c,v 1.4 2023/09/29 17:30:35 kettenis Exp $ */ /* $OpenBSD: rkusbphy.c,v 1.5 2024/06/23 10:18:11 kettenis Exp $ */
/* /*
* Copyright (c) 2023 David Gwynne <dlg@openbsd.org> * Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
@ -90,6 +90,38 @@ static const struct rkusbphy_chip rkusbphy_rk3568[] = {
}, },
}; };
static const struct rkusbphy_regs rkusbphy_rk3588_regs = {
/* shift, mask, set */
.clk_enable = { 0x0000, 0, 0x1, 0x0 },
.otg = {
.phy_enable = { 0x000c, 11, 0x1, 0x0 },
},
.host = {
.phy_enable = { 0x0008, 2, 0x1, 0x0 },
},
};
static const struct rkusbphy_chip rkusbphy_rk3588[] = {
{
.c_base_addr = 0x0000,
.c_regs = &rkusbphy_rk3588_regs,
},
{
.c_base_addr = 0x4000,
.c_regs = &rkusbphy_rk3588_regs,
},
{
.c_base_addr = 0x8000,
.c_regs = &rkusbphy_rk3588_regs,
},
{
.c_base_addr = 0xc000,
.c_regs = &rkusbphy_rk3588_regs,
},
};
/* /*
* driver stuff * driver stuff
*/ */
@ -159,6 +191,7 @@ struct rkusbphy_id {
static const struct rkusbphy_id rkusbphy_ids[] = { static const struct rkusbphy_id rkusbphy_ids[] = {
RKUSBPHY_ID("rockchip,rk3568-usb2phy", rkusbphy_rk3568), RKUSBPHY_ID("rockchip,rk3568-usb2phy", rkusbphy_rk3568),
RKUSBPHY_ID("rockchip,rk3588-usb2phy", rkusbphy_rk3588),
}; };
static const struct rkusbphy_id * static const struct rkusbphy_id *
@ -213,7 +246,10 @@ rkusbphy_attach(struct device *parent, struct device *self, void *aux)
sc->sc_node = faa->fa_node; sc->sc_node = faa->fa_node;
grfph = OF_getpropint(sc->sc_node, "rockchip,usbgrf", 0); grfph = OF_getpropint(sc->sc_node, "rockchip,usbgrf", 0);
sc->sc_grf = regmap_byphandle(grfph); if (grfph)
sc->sc_grf = regmap_byphandle(grfph);
else
sc->sc_grf = regmap_bynode(OF_parent(faa->fa_node));
if (sc->sc_grf == NULL) { if (sc->sc_grf == NULL) {
printf("%s: rockchip,usbgrf 0x%x not found\n", DEVNAME(sc), printf("%s: rockchip,usbgrf 0x%x not found\n", DEVNAME(sc),
grfph); grfph);
@ -267,10 +303,8 @@ rkusbphy_register(struct rkusbphy_softc *sc, struct phy_device *pd,
int node; int node;
node = OF_getnodebyname(sc->sc_node, pc->pc_name); node = OF_getnodebyname(sc->sc_node, pc->pc_name);
if (node == 0) { if (node == 0)
printf("%s: cannot find %s\n", DEVNAME(sc), pc->pc_name);
return; return;
}
if (OF_getprop(node, "status", status, sizeof(status)) > 0 && if (OF_getprop(node, "status", status, sizeof(status)) > 0 &&
strcmp(status, "disabled") == 0) strcmp(status, "disabled") == 0)

View file

@ -1256,17 +1256,6 @@ static void i915_audio_component_init(struct drm_i915_private *i915)
{ {
#ifdef notyet #ifdef notyet
u32 aud_freq, aud_freq_init; u32 aud_freq, aud_freq_init;
int ret;
ret = component_add_typed(i915->drm.dev,
&i915_audio_component_bind_ops,
I915_COMPONENT_AUDIO);
if (ret < 0) {
drm_err(&i915->drm,
"failed to add audio component (%d)\n", ret);
/* continue with reduced functionality */
return;
}
if (DISPLAY_VER(i915) >= 9) { if (DISPLAY_VER(i915) >= 9) {
aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL); aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL);
@ -1289,6 +1278,23 @@ static void i915_audio_component_init(struct drm_i915_private *i915)
/* init with current cdclk */ /* init with current cdclk */
intel_audio_cdclk_change_post(i915); intel_audio_cdclk_change_post(i915);
#endif
}
static void i915_audio_component_register(struct drm_i915_private *i915)
{
#ifdef notyet
int ret;
ret = component_add_typed(i915->drm.dev,
&i915_audio_component_bind_ops,
I915_COMPONENT_AUDIO);
if (ret < 0) {
drm_err(&i915->drm,
"failed to add audio component (%d)\n", ret);
/* continue with reduced functionality */
return;
}
i915->display.audio.component_registered = true; i915->display.audio.component_registered = true;
#endif #endif
@ -1322,6 +1328,12 @@ void intel_audio_init(struct drm_i915_private *i915)
i915_audio_component_init(i915); i915_audio_component_init(i915);
} }
void intel_audio_register(struct drm_i915_private *i915)
{
if (!i915->display.audio.lpe.platdev)
i915_audio_component_register(i915);
}
/** /**
* intel_audio_deinit() - deinitialize the audio driver * intel_audio_deinit() - deinitialize the audio driver
* @i915: the i915 drm device private data * @i915: the i915 drm device private data

View file

@ -30,6 +30,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder,
void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv); void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv);
void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv); void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv);
void intel_audio_init(struct drm_i915_private *dev_priv); void intel_audio_init(struct drm_i915_private *dev_priv);
void intel_audio_register(struct drm_i915_private *i915);
void intel_audio_deinit(struct drm_i915_private *dev_priv); void intel_audio_deinit(struct drm_i915_private *dev_priv);
void intel_audio_sdp_split_update(struct intel_encoder *encoder, void intel_audio_sdp_split_update(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state); const struct intel_crtc_state *crtc_state);

View file

@ -388,6 +388,8 @@ void intel_display_driver_register(struct drm_i915_private *i915)
intel_audio_init(i915); intel_audio_init(i915);
intel_audio_register(i915);
intel_display_debugfs_register(i915); intel_display_debugfs_register(i915);
/* /*

View file

@ -285,7 +285,9 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj);
static inline bool static inline bool
i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
{ {
return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); /* TODO: make DPT shrinkable when it has no bound vmas */
return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
!obj->is_dpt;
} }
static inline bool static inline bool

View file

@ -260,8 +260,13 @@ static void signal_irq_work(struct irq_work *work)
i915_request_put(rq); i915_request_put(rq);
} }
/* Lazy irq enabling after HW submission */
if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers)) if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers))
intel_breadcrumbs_arm_irq(b); intel_breadcrumbs_arm_irq(b);
/* And confirm that we still want irqs enabled before we yield */
if (READ_ONCE(b->irq_armed) && !atomic_read(&b->active))
intel_breadcrumbs_disarm_irq(b);
} }
struct intel_breadcrumbs * struct intel_breadcrumbs *
@ -312,13 +317,7 @@ void __intel_breadcrumbs_park(struct intel_breadcrumbs *b)
return; return;
/* Kick the work once more to drain the signalers, and disarm the irq */ /* Kick the work once more to drain the signalers, and disarm the irq */
irq_work_sync(&b->irq_work); irq_work_queue(&b->irq_work);
while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) {
local_irq_disable();
signal_irq_work(&b->irq_work);
local_irq_enable();
cond_resched();
}
} }
void intel_breadcrumbs_free(struct kref *kref) void intel_breadcrumbs_free(struct kref *kref)
@ -401,7 +400,7 @@ static void insert_breadcrumb(struct i915_request *rq)
* the request as it may have completed and raised the interrupt as * the request as it may have completed and raised the interrupt as
* we were attaching it into the lists. * we were attaching it into the lists.
*/ */
if (!b->irq_armed || __i915_request_is_complete(rq)) if (!READ_ONCE(b->irq_armed) || __i915_request_is_complete(rq))
irq_work_queue(&b->irq_work); irq_work_queue(&b->irq_work);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_input.c,v 1.395 2024/06/07 18:24:16 bluhm Exp $ */ /* $OpenBSD: ip_input.c,v 1.396 2024/06/24 12:19:19 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/* /*
@ -1532,11 +1532,17 @@ const u_char inetctlerrmap[PRC_NCMDS] = {
void void
ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags) ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
{ {
struct mbuf mfake, *mcopy;
struct ip *ip = mtod(m, struct ip *); struct ip *ip = mtod(m, struct ip *);
struct route iproute; struct route iproute;
struct rtentry *rt; struct rtentry *rt;
int error = 0, type = 0, code = 0, destmtu = 0, fake = 0, len; u_int rtableid = m->m_pkthdr.ph_rtableid;
u_int8_t loopcnt = m->m_pkthdr.ph_loopcnt;
u_int icmp_len;
char icmp_buf[68];
CTASSERT(sizeof(icmp_buf) <= MHLEN);
u_short mflags, pfflags;
struct mbuf *mcopy;
int error = 0, type = 0, code = 0, destmtu = 0;
u_int32_t dest; u_int32_t dest;
dest = 0; dest = 0;
@ -1554,7 +1560,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
ro = &iproute; ro = &iproute;
ro->ro_rt = NULL; ro->ro_rt = NULL;
} }
rt = route_mpath(ro, &ip->ip_dst, &ip->ip_src, m->m_pkthdr.ph_rtableid); rt = route_mpath(ro, &ip->ip_dst, &ip->ip_src, rtableid);
if (rt == NULL) { if (rt == NULL) {
ipstat_inc(ips_noroute); ipstat_inc(ips_noroute);
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, dest, 0); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, dest, 0);
@ -1562,24 +1568,14 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
} }
/* /*
* Save at most 68 bytes of the packet in case * Save at most 68 bytes of the packet in case we need to generate
* we need to generate an ICMP message to the src. * an ICMP message to the src. The data is saved on the stack.
* The data is saved in the mbuf on the stack that * A new mbuf is only allocated when ICMP is actually created.
* acts as a temporary storage not intended to be
* passed down the IP stack or to the mfree.
*/ */
memset(&mfake.m_hdr, 0, sizeof(mfake.m_hdr)); icmp_len = min(sizeof(icmp_buf), ntohs(ip->ip_len));
mfake.m_type = m->m_type; mflags = m->m_flags;
if (m_dup_pkthdr(&mfake, m, M_DONTWAIT) == 0) { pfflags = m->m_pkthdr.pf.flags;
mfake.m_data = mfake.m_pktdat; m_copydata(m, 0, icmp_len, icmp_buf);
len = min(ntohs(ip->ip_len), 68);
m_copydata(m, 0, len, mfake.m_pktdat);
mfake.m_pkthdr.len = mfake.m_len = len;
#if NPF > 0
pf_pkt_addr_changed(&mfake);
#endif /* NPF > 0 */
fake = 1;
}
ip->ip_ttl -= IPTTLDEC; ip->ip_ttl -= IPTTLDEC;
@ -1597,7 +1593,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
(rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 &&
satosin(rt_key(rt))->sin_addr.s_addr != 0 && satosin(rt_key(rt))->sin_addr.s_addr != 0 &&
ip_sendredirects && !ISSET(flags, IP_REDIRECT) && ip_sendredirects && !ISSET(flags, IP_REDIRECT) &&
!arpproxy(satosin(rt_key(rt))->sin_addr, m->m_pkthdr.ph_rtableid)) { !arpproxy(satosin(rt_key(rt))->sin_addr, rtableid)) {
if ((ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_netmask) == if ((ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_netmask) ==
ifatoia(rt->rt_ifa)->ia_net) { ifatoia(rt->rt_ifa)->ia_net) {
if (rt->rt_flags & RTF_GATEWAY) if (rt->rt_flags & RTF_GATEWAY)
@ -1621,9 +1617,6 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
else else
goto done; goto done;
} }
if (!fake)
goto done;
switch (error) { switch (error) {
case 0: /* forwarded, but need redirect */ case 0: /* forwarded, but need redirect */
/* type, code set above */ /* type, code set above */
@ -1674,15 +1667,22 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct route *ro, int flags)
code = ICMP_UNREACH_HOST; code = ICMP_UNREACH_HOST;
break; break;
} }
mcopy = m_copym(&mfake, 0, len, M_DONTWAIT);
if (mcopy != NULL) mcopy = m_gethdr(M_DONTWAIT, MT_DATA);
icmp_error(mcopy, type, code, dest, destmtu); if (mcopy == NULL)
goto done;
mcopy->m_len = mcopy->m_pkthdr.len = icmp_len;
mcopy->m_flags |= (mflags & M_COPYFLAGS);
mcopy->m_pkthdr.ph_rtableid = rtableid;
mcopy->m_pkthdr.ph_ifidx = ifp->if_index;
mcopy->m_pkthdr.ph_loopcnt = loopcnt;
mcopy->m_pkthdr.pf.flags |= (pfflags & PF_TAG_GENERATED);
memcpy(mcopy->m_data, icmp_buf, icmp_len);
icmp_error(mcopy, type, code, dest, destmtu);
done: done:
if (ro == &iproute) if (ro == &iproute)
rtfree(ro->ro_rt); rtfree(ro->ro_rt);
if (fake)
m_tag_delete_chain(&mfake);
} }
int int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ca.c,v 1.58 2024/02/04 13:08:29 tb Exp $ */ /* $OpenBSD: ca.c,v 1.59 2024/06/23 07:50:52 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -2330,7 +2330,6 @@ certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
if (sk_CONF_VALUE_num(sk) == 0) { if (sk_CONF_VALUE_num(sk) == 0) {
BIO_printf(bio_err, "no name/value pairs found in %s\n", BIO_printf(bio_err, "no name/value pairs found in %s\n",
infile); infile);
CONF_free(parms);
goto err; goto err;
} }
/* /*

View file

@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: sshd_config.5,v 1.363 2024/06/14 05:01:22 djm Exp $ .\" $OpenBSD: sshd_config.5,v 1.365 2024/06/24 06:59:39 jmc Exp $
.Dd $Mdocdate: June 14 2024 $ .Dd $Mdocdate: June 24 2024 $
.Dt SSHD_CONFIG 5 .Dt SSHD_CONFIG 5
.Os .Os
.Sh NAME .Sh NAME
@ -1824,6 +1824,13 @@ via
.Cm AcceptEnv .Cm AcceptEnv
or or
.Cm PermitUserEnvironment . .Cm PermitUserEnvironment .
.It Cm SshdSessionPath
Overrides the default path to the
.Cm sshd-session
binary that is invoked to handle each connection.
The default is
.Pa /usr/libexec/sshd-session .
This option is intended for use by tests.
.It Cm StreamLocalBindMask .It Cm StreamLocalBindMask
Sets the octal file creation mode mask Sets the octal file creation mode mask
.Pq umask .Pq umask

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cmd-refresh-client.c,v 1.48 2022/05/30 12:55:25 nicm Exp $ */ /* $OpenBSD: cmd-refresh-client.c,v 1.49 2024/06/24 08:30:50 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -34,9 +34,10 @@ const struct cmd_entry cmd_refresh_client_entry = {
.name = "refresh-client", .name = "refresh-client",
.alias = "refresh", .alias = "refresh",
.args = { "A:B:cC:Df:F:l::LRSt:U", 0, 1, NULL }, .args = { "A:B:cC:Df:r:F:l::LRSt:U", 0, 1, NULL },
.usage = "[-cDlLRSU] [-A pane:state] [-B name:what:format] " .usage = "[-cDlLRSU] [-A pane:state] [-B name:what:format] "
"[-C XxY] [-f flags] " CMD_TARGET_CLIENT_USAGE " [adjustment]", "[-C XxY] [-f flags] [-r pane:report]" CMD_TARGET_CLIENT_USAGE
" [adjustment]",
.flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG, .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG,
.exec = cmd_refresh_client_exec .exec = cmd_refresh_client_exec
@ -193,6 +194,34 @@ cmd_refresh_client_clipboard(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }
static void
cmd_refresh_report(struct tty *tty, const char *value)
{
struct window_pane *wp;
u_int pane;
size_t size = 0;
char *copy, *split;
if (*value != '%')
return;
copy = xstrdup(value);
if ((split = strchr(copy, ':')) == NULL)
goto out;
*split++ = '\0';
if (sscanf(copy, "%%%u", &pane) != 1)
goto out;
wp = window_pane_find_by_id(pane);
if (wp == NULL)
goto out;
tty_keys_colours(tty, split, strlen(split), &size, &wp->control_fg,
&wp->control_bg);
out:
free(copy);
}
static enum cmd_retval static enum cmd_retval
cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item) cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
{ {
@ -262,6 +291,8 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
server_client_set_flags(tc, args_get(args, 'F')); server_client_set_flags(tc, args_get(args, 'F'));
if (args_has(args, 'f')) if (args_has(args, 'f'))
server_client_set_flags(tc, args_get(args, 'f')); server_client_set_flags(tc, args_get(args, 'f'));
if (args_has(args, 'r'))
cmd_refresh_report(tty, args_get(args, 'r'));
if (args_has(args, 'A')) { if (args_has(args, 'A')) {
if (~tc->flags & CLIENT_CONTROL) if (~tc->flags & CLIENT_CONTROL)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: grid.c,v 1.130 2023/07/13 06:03:48 nicm Exp $ */ /* $OpenBSD: grid.c,v 1.131 2024/06/24 08:11:46 nicm Exp $ */
/* /*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -88,7 +88,7 @@ grid_need_extended_cell(const struct grid_cell_entry *gce,
return (1); return (1);
if ((gc->fg & COLOUR_FLAG_RGB) || (gc->bg & COLOUR_FLAG_RGB)) if ((gc->fg & COLOUR_FLAG_RGB) || (gc->bg & COLOUR_FLAG_RGB))
return (1); return (1);
if (gc->us != 0) /* only supports 256 or RGB */ if (gc->us != 8) /* only supports 256 or RGB */
return (1); return (1);
if (gc->link != 0) if (gc->link != 0)
return (1); return (1);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: input.c,v 1.224 2024/04/10 07:36:25 nicm Exp $ */ /* $OpenBSD: input.c,v 1.225 2024/06/24 08:30:50 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -2652,6 +2652,44 @@ input_get_bg_client(struct window_pane *wp)
return (-1); return (-1);
} }
/*
* If any control mode client exists that has provided a bg color, return it.
* Otherwise, return -1.
*/
static int
input_get_bg_control_client(struct window_pane *wp)
{
struct client *c;
if (wp->control_bg == -1)
return (-1);
TAILQ_FOREACH(c, &clients, entry) {
if (c->flags & CLIENT_CONTROL)
return (wp->control_bg);
}
return (-1);
}
/*
* If any control mode client exists that has provided a fg color, return it.
* Otherwise, return -1.
*/
static int
input_get_fg_control_client(struct window_pane *wp)
{
struct client *c;
if (wp->control_fg == -1)
return (-1);
TAILQ_FOREACH(c, &clients, entry) {
if (c->flags & CLIENT_CONTROL)
return (wp->control_fg);
}
return (-1);
}
/* Handle the OSC 10 sequence for setting and querying foreground colour. */ /* Handle the OSC 10 sequence for setting and querying foreground colour. */
static void static void
input_osc_10(struct input_ctx *ictx, const char *p) input_osc_10(struct input_ctx *ictx, const char *p)
@ -2663,11 +2701,14 @@ input_osc_10(struct input_ctx *ictx, const char *p)
if (strcmp(p, "?") == 0) { if (strcmp(p, "?") == 0) {
if (wp == NULL) if (wp == NULL)
return; return;
tty_default_colours(&defaults, wp); c = input_get_fg_control_client(wp);
if (COLOUR_DEFAULT(defaults.fg)) if (c == -1) {
c = input_get_fg_client(wp); tty_default_colours(&defaults, wp);
else if (COLOUR_DEFAULT(defaults.fg))
c = defaults.fg; c = input_get_fg_client(wp);
else
c = defaults.fg;
}
input_osc_colour_reply(ictx, 10, c); input_osc_colour_reply(ictx, 10, c);
return; return;
} }
@ -2711,11 +2752,14 @@ input_osc_11(struct input_ctx *ictx, const char *p)
if (strcmp(p, "?") == 0) { if (strcmp(p, "?") == 0) {
if (wp == NULL) if (wp == NULL)
return; return;
tty_default_colours(&defaults, wp); c = input_get_bg_control_client(wp);
if (COLOUR_DEFAULT(defaults.bg)) if (c == -1) {
c = input_get_bg_client(wp); tty_default_colours(&defaults, wp);
else if (COLOUR_DEFAULT(defaults.bg))
c = defaults.bg; c = input_get_bg_client(wp);
else
c = defaults.bg;
}
input_osc_colour_reply(ictx, 11, c); input_osc_colour_reply(ictx, 11, c);
return; return;
} }

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.945 2024/05/24 12:39:06 nicm Exp $ .\" $OpenBSD: tmux.1,v 1.946 2024/06/24 08:30:50 nicm Exp $
.\" .\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\" .\"
@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: May 24 2024 $ .Dd $Mdocdate: June 24 2024 $
.Dt TMUX 1 .Dt TMUX 1
.Os .Os
.Sh NAME .Sh NAME
@ -1357,6 +1357,7 @@ specified multiple times.
.Op Fl B Ar name:what:format .Op Fl B Ar name:what:format
.Op Fl C Ar size .Op Fl C Ar size
.Op Fl f Ar flags .Op Fl f Ar flags
.Op Fl r Ar pane:report
.Op Fl l Op Ar target-pane .Op Fl l Op Ar target-pane
.Op Fl t Ar target-client .Op Fl t Ar target-client
.Op Ar adjustment .Op Ar adjustment
@ -1467,6 +1468,12 @@ for all windows in the attached session.
.Fl f .Fl f
sets a comma-separated list of client flags, see sets a comma-separated list of client flags, see
.Ic attach-session . .Ic attach-session .
.Fl r
allows a control mode client to provide information about a pane via a report
(such as the response to OSC 10).
The argument is a pane ID (with a leading
.Ql % ) ,
a colon, then a report escape sequence.
.Pp .Pp
.Fl l .Fl l
requests the clipboard from the client using the requests the clipboard from the client using the

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1217 2024/05/19 03:27:58 jsg Exp $ */ /* $OpenBSD: tmux.h,v 1.1218 2024/06/24 08:30:50 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -1100,6 +1100,9 @@ struct window_pane {
int border_gc_set; int border_gc_set;
struct grid_cell border_gc; struct grid_cell border_gc;
int control_bg;
int control_fg;
TAILQ_ENTRY(window_pane) entry; /* link in list of all panes */ TAILQ_ENTRY(window_pane) entry; /* link in list of all panes */
TAILQ_ENTRY(window_pane) sentry; /* link in list of last visited */ TAILQ_ENTRY(window_pane) sentry; /* link in list of last visited */
RB_ENTRY(window_pane) tree_entry; RB_ENTRY(window_pane) tree_entry;
@ -2407,6 +2410,8 @@ const struct utf8_data *tty_acs_rounded_borders(int);
void tty_keys_build(struct tty *); void tty_keys_build(struct tty *);
void tty_keys_free(struct tty *); void tty_keys_free(struct tty *);
int tty_keys_next(struct tty *); int tty_keys_next(struct tty *);
int tty_keys_colours(struct tty *, const char *, size_t, size_t *,
int *, int *);
/* arguments.c */ /* arguments.c */
void args_set(struct args *, u_char, struct args_value *, int); void args_set(struct args *, u_char, struct args_value *, int);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tty-keys.c,v 1.173 2024/03/21 11:47:55 nicm Exp $ */ /* $OpenBSD: tty-keys.c,v 1.174 2024/06/24 08:30:50 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -59,7 +59,6 @@ static int tty_keys_device_attributes2(struct tty *, const char *, size_t,
size_t *); size_t *);
static int tty_keys_extended_device_attributes(struct tty *, const char *, static int tty_keys_extended_device_attributes(struct tty *, const char *,
size_t, size_t *); size_t, size_t *);
static int tty_keys_colours(struct tty *, const char *, size_t, size_t *);
/* A key tree entry. */ /* A key tree entry. */
struct tty_key { struct tty_key {
@ -721,7 +720,7 @@ tty_keys_next(struct tty *tty)
} }
/* Is this a colours response? */ /* Is this a colours response? */
switch (tty_keys_colours(tty, buf, len, &size)) { switch (tty_keys_colours(tty, buf, len, &size, &tty->fg, &tty->bg)) {
case 0: /* yes */ case 0: /* yes */
key = KEYC_UNKNOWN; key = KEYC_UNKNOWN;
goto complete_key; goto complete_key;
@ -1490,8 +1489,9 @@ tty_keys_extended_device_attributes(struct tty *tty, const char *buf,
* Handle foreground or background input. Returns 0 for success, -1 for * Handle foreground or background input. Returns 0 for success, -1 for
* failure, 1 for partial. * failure, 1 for partial.
*/ */
static int int
tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size) tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size,
int *fg, int *bg)
{ {
struct client *c = tty->client; struct client *c = tty->client;
u_int i; u_int i;
@ -1542,11 +1542,17 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size)
n = colour_parseX11(tmp); n = colour_parseX11(tmp);
if (n != -1 && buf[3] == '0') { if (n != -1 && buf[3] == '0') {
log_debug("%s: foreground is %s", c->name, colour_tostring(n)); if (c != NULL)
tty->fg = n; log_debug("%s fg is %s", c->name, colour_tostring(n));
else
log_debug("fg is %s", colour_tostring(n));
*fg = n;
} else if (n != -1) { } else if (n != -1) {
log_debug("%s: background is %s", c->name, colour_tostring(n)); if (c != NULL)
tty->bg = n; log_debug("%s bg is %s", c->name, colour_tostring(n));
else
log_debug("bg is %s", colour_tostring(n));
*bg = n;
} }
return (0); return (0);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.290 2024/04/10 07:15:21 nicm Exp $ */ /* $OpenBSD: window.c,v 1.291 2024/06/24 08:30:50 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@ -937,6 +937,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
wp->pipe_fd = -1; wp->pipe_fd = -1;
wp->control_bg = -1;
wp->control_fg = -1;
colour_palette_init(&wp->palette); colour_palette_init(&wp->palette);
colour_palette_from_option(&wp->palette, wp->options); colour_palette_from_option(&wp->palette, wp->options);