sync with OpenBSD -current

This commit is contained in:
purplerain 2024-08-19 17:15:41 +00:00
parent c78abe7784
commit eb9d621948
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
270 changed files with 666 additions and 538 deletions

View file

@ -1,11 +1,11 @@
/* $OpenBSD: thread_private.h,v 1.36 2021/01/06 19:54:17 otto Exp $ */
/* $OpenBSD: thread_private.h,v 1.37 2024/08/18 02:25:51 guenther Exp $ */
/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */
#ifndef _THREAD_PRIVATE_H_
#define _THREAD_PRIVATE_H_
#include <stdio.h> /* for FILE and __isthreaded */
extern int __isthreaded;
#define _MALLOC_MUTEXES 32
void _malloc_init(int);
@ -77,14 +77,15 @@ PROTO_NORMAL(_malloc_init);
* Returns the address of the thread's TCB.
*/
struct __sFILE;
struct pthread;
struct thread_callbacks {
int *(*tc_errnoptr)(void); /* MUST BE FIRST */
void *(*tc_tcb)(void);
__dead void (*tc_canceled)(void);
void (*tc_flockfile)(FILE *);
int (*tc_ftrylockfile)(FILE *);
void (*tc_funlockfile)(FILE *);
void (*tc_flockfile)(struct __sFILE *);
int (*tc_ftrylockfile)(struct __sFILE *);
void (*tc_funlockfile)(struct __sFILE *);
void (*tc_malloc_lock)(int);
void (*tc_malloc_unlock)(int);
void (*tc_atexit_lock)(void);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ___runetype_mb.c,v 1.3 2017/09/05 03:16:13 schwarze Exp $ */
/* $OpenBSD: ___runetype_mb.c,v 1.4 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: ___runetype_mb.c,v 1.10 2005/02/10 19:19:57 tnozaki Exp $ */
/*-
@ -34,7 +34,7 @@
*/
#include <wctype.h>
#include "rune.h"
#include "runetype.h"
#include "rune_local.h"
_RuneType

View file

@ -1,4 +1,4 @@
/* $OpenBSD: _wctrans.c,v 1.2 2012/12/05 23:20:00 deraadt Exp $ */
/* $OpenBSD: _wctrans.c,v 1.3 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: _wctrans.c,v 1.6 2005/02/10 19:19:57 tnozaki Exp $ */
/*-
@ -62,8 +62,7 @@
#include <wctype.h>
#include <stdlib.h>
#include <string.h>
#include "rune.h"
#include "rune_local.h"
#include "runetype.h"
#include "_wctrans_local.h"
/*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rune.c,v 1.10 2022/07/27 20:00:11 guenther Exp $ */
/* $OpenBSD: rune.c,v 1.11 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: rune.c,v 1.26 2004/05/09 11:26:33 kleink Exp $ */
/*-
@ -63,12 +63,13 @@
#include <sys/stat.h>
#include <assert.h>
#include <errno.h>
#include <locale.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include "rune.h"
#include "runetype.h"
#include "rune_local.h"
#define SAFE_ADD(x, y) \

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rune.h,v 1.5 2024/02/04 12:46:01 jca Exp $ */
/* $OpenBSD: rune.h,v 1.6 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: rune.h,v 1.9 2003/08/07 16:43:04 agc Exp $ */
/*-
@ -39,8 +39,6 @@
#define _RUNE_H_
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
#include "runetype.h"
#define _LOCALE_NONE (locale_t)0

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rune_local.h,v 1.8 2022/07/27 20:00:11 guenther Exp $ */
/* $OpenBSD: rune_local.h,v 1.9 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: rune_local.h,v 1.7 2003/03/02 22:18:15 tshiozak Exp $ */
/*-
@ -30,6 +30,9 @@
#ifndef _RUNE_LOCAL_H_
#define _RUNE_LOCAL_H_
#include <stdio.h>
#include <wchar.h>
__BEGIN_HIDDEN_DECLS
/* rune.c */

View file

@ -40,7 +40,6 @@
#include <assert.h>
#include <wchar.h>
#include "rune.h"
#include "rune_local.h"
#include "citrus_ctype.h"
_RuneLocale _DefaultRuneLocale = {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: setlocale.c,v 1.30 2019/07/03 03:24:04 deraadt Exp $ */
/* $OpenBSD: setlocale.c,v 1.31 2024/08/18 02:20:29 guenther Exp $ */
/*
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
*
@ -16,6 +16,7 @@
*/
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: wctype.c,v 1.2 2024/02/04 12:46:01 jca Exp $ */
/* $OpenBSD: wctype.c,v 1.3 2024/08/18 02:22:29 guenther Exp $ */
/* $NetBSD: iswctype.c,v 1.15 2005/02/09 21:35:46 kleink Exp $ */
/*
@ -38,7 +38,6 @@
#include <wchar.h>
#include <wctype.h>
#include <string.h>
#include "rune.h"
#include "runetype.h"
static struct _WCTypeEntry wctype_entries[_WCTYPE_NINDEXES] =

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rthread_cb.h,v 1.3 2021/01/06 19:54:17 otto Exp $ */
/* $OpenBSD: rthread_cb.h,v 1.4 2024/08/18 02:25:51 guenther Exp $ */
/*
* Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
* All Rights Reserved.
@ -16,12 +16,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
struct __sFILE;
__BEGIN_HIDDEN_DECLS
void _thread_flockfile(FILE *);
int _thread_ftrylockfile(FILE *);
void _thread_funlockfile(FILE *);
void _thread_flockfile(struct __sFILE *);
int _thread_ftrylockfile(struct __sFILE *);
void _thread_funlockfile(struct __sFILE *);
void _thread_malloc_lock(int);
void _thread_malloc_unlock(int);
void _thread_atexit_lock(void);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: localtime.c,v 1.66 2024/04/04 02:20:01 millert Exp $ */
/* $OpenBSD: localtime.c,v 1.67 2024/08/18 02:20:29 guenther Exp $ */
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@ -13,6 +13,7 @@
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: conf_def.c,v 1.34 2024/04/09 13:56:30 beck Exp $ */
/* $OpenBSD: conf_def.c,v 1.35 2024/08/18 17:50:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -80,57 +80,6 @@ static char *scan_quote(CONF *conf, char *p);
static char *scan_dquote(CONF *conf, char *p);
#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
static CONF *def_create(CONF_METHOD *meth);
static int def_init_default(CONF *conf);
static int def_init_WIN32(CONF *conf);
static int def_destroy(CONF *conf);
static int def_destroy_data(CONF *conf);
static int def_load(CONF *conf, const char *name, long *eline);
static int def_load_bio(CONF *conf, BIO *bp, long *eline);
static int def_dump(const CONF *conf, BIO *bp);
static int def_is_number(const CONF *conf, char c);
static int def_to_int(const CONF *conf, char c);
static CONF_METHOD default_method = {
.name = "OpenSSL default",
.create = def_create,
.init = def_init_default,
.destroy = def_destroy,
.destroy_data = def_destroy_data,
.load_bio = def_load_bio,
.dump = def_dump,
.is_number = def_is_number,
.to_int = def_to_int,
.load = def_load
};
static CONF_METHOD WIN32_method = {
"WIN32",
def_create,
def_init_WIN32,
def_destroy,
def_destroy_data,
def_load_bio,
def_dump,
def_is_number,
def_to_int,
def_load
};
CONF_METHOD *
NCONF_default(void)
{
return &default_method;
}
LCRYPTO_ALIAS(NCONF_default);
CONF_METHOD *
NCONF_WIN32(void)
{
return &WIN32_method;
}
LCRYPTO_ALIAS(NCONF_WIN32);
static CONF *
def_create(CONF_METHOD *meth)
{
@ -151,7 +100,7 @@ def_init_default(CONF *conf)
if (conf == NULL)
return 0;
conf->meth = &default_method;
conf->meth = NCONF_default();
conf->meth_data = CONF_type_default;
conf->data = NULL;
@ -164,23 +113,13 @@ def_init_WIN32(CONF *conf)
if (conf == NULL)
return 0;
conf->meth = &WIN32_method;
conf->meth = NCONF_WIN32();
conf->meth_data = (void *)CONF_type_win32;
conf->data = NULL;
return 1;
}
static int
def_destroy(CONF *conf)
{
if (def_destroy_data(conf)) {
free(conf);
return 1;
}
return 0;
}
static int
def_destroy_data(CONF *conf)
{
@ -191,24 +130,13 @@ def_destroy_data(CONF *conf)
}
static int
def_load(CONF *conf, const char *name, long *line)
def_destroy(CONF *conf)
{
int ret;
BIO *in = NULL;
in = BIO_new_file(name, "rb");
if (in == NULL) {
if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
CONFerror(CONF_R_NO_SUCH_FILE);
else
CONFerror(ERR_R_SYS_LIB);
return 0;
if (def_destroy_data(conf)) {
free(conf);
return 1;
}
ret = def_load_bio(conf, in, line);
BIO_free(in);
return ret;
return 0;
}
static int
@ -416,6 +344,27 @@ err:
return (0);
}
static int
def_load(CONF *conf, const char *name, long *line)
{
int ret;
BIO *in = NULL;
in = BIO_new_file(name, "rb");
if (in == NULL) {
if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE)
CONFerror(CONF_R_NO_SUCH_FILE);
else
CONFerror(ERR_R_SYS_LIB);
return 0;
}
ret = def_load_bio(conf, in, line);
BIO_free(in);
return ret;
}
static void
clear_comments(CONF *conf, char *p)
{
@ -698,3 +647,43 @@ def_to_int(const CONF *conf, char c)
{
return c - '0';
}
static CONF_METHOD default_method = {
.name = "OpenSSL default",
.create = def_create,
.init = def_init_default,
.destroy = def_destroy,
.destroy_data = def_destroy_data,
.load_bio = def_load_bio,
.dump = def_dump,
.is_number = def_is_number,
.to_int = def_to_int,
.load = def_load
};
static CONF_METHOD WIN32_method = {
"WIN32",
def_create,
def_init_WIN32,
def_destroy,
def_destroy_data,
def_load_bio,
def_dump,
def_is_number,
def_to_int,
def_load
};
CONF_METHOD *
NCONF_default(void)
{
return &default_method;
}
LCRYPTO_ALIAS(NCONF_default);
CONF_METHOD *
NCONF_WIN32(void)
{
return &WIN32_method;
}
LCRYPTO_ALIAS(NCONF_WIN32);

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: X509_REQ_add_extensions.3,v 1.1 2021/10/27 14:54:07 schwarze Exp $
.\" $OpenBSD: X509_REQ_add_extensions.3,v 1.2 2024/08/18 11:04:55 tb Exp $
.\"
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
.\"
@ -14,15 +14,13 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: October 27 2021 $
.Dd $Mdocdate: August 18 2024 $
.Dt X509_REQ_ADD_EXTENSIONS 3
.Os
.Sh NAME
.Nm X509_REQ_add_extensions ,
.Nm X509_REQ_add_extensions_nid ,
.Nm X509_REQ_get_extensions ,
.Nm X509_REQ_set_extension_nids ,
.Nm X509_REQ_get_extension_nids ,
.Nm X509_REQ_extension_nid
.Nd extensions in certification requests
.Sh SYNOPSIS
@ -40,10 +38,6 @@
.Fc
.Ft STACK_OF(X509_EXTENSION) *
.Fn X509_REQ_get_extensions "X509_REQ *req"
.Ft void
.Fn X509_REQ_set_extension_nids "int *nids"
.Ft int *
.Fn X509_REQ_get_extension_nids void
.Ft int
.Fn X509_REQ_extension_nid "int nid"
.Sh DESCRIPTION
@ -77,21 +71,6 @@ and
.Dv NID_ms_ext_req
are considered appropriate.
.Pp
.Fn X509_REQ_set_extension_nids
replaces the list of attribute types that
.Fn X509_REQ_get_extensions
considers appropriate for storing extensions.
The
.Fa nids
argument is interpreted as a pointer to the first element
of a variable-sized array of
.Vt int .
The last element of the array has to be
.Dv NID_undef .
The array needs to remain valid until
.Fn X509_REQ_set_extension_nids
is called again with a different argument.
.Pp
.Fn X509_REQ_extension_nid
checks whether
.Fn X509_REQ_get_extensions
@ -118,13 +97,6 @@ does not contain
contains no attribute of an appropriate type,
or if decoding or memory allocation fails.
.Pp
.Fn X509_REQ_get_extension_nids
returns the pointer installed with
.Fn X509_REQ_set_extension_nids
or a pointer to a static array
.Brq Dv NID_ext_req , NID_ms_ext_req , NID_undef
by default.
.Pp
.Fn X509_REQ_extension_nid
returns 1 if
.Fa nid