sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-08 20:04:57 +00:00
parent 880da5e235
commit 8e8dccb6dd
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
7 changed files with 115 additions and 16 deletions

View File

@ -32,10 +32,8 @@
__dso_hidden void *allocate_tib(size_t); __dso_hidden void *allocate_tib(size_t);
#define MAX(a,b) (((a)>(b))?(a):(b))
#ifdef TIB_EXTRA_ALIGN #ifdef TIB_EXTRA_ALIGN
# define TIB_ALIGN MAX(__alignof__(struct tib), TIB_EXTRA_ALIGN) # define TIB_ALIGN MAXIMUM(__alignof__(struct tib), TIB_EXTRA_ALIGN)
#else #else
# define TIB_ALIGN __alignof__(struct tib) # define TIB_ALIGN __alignof__(struct tib)
#endif #endif
@ -170,7 +168,7 @@ allocate_tls_offset(Elf_Addr msize, Elf_Addr align, int for_exe)
* - need to offset the TIB 12 bytes from the start * - need to offset the TIB 12 bytes from the start
* - to place ths TLS data at offset 64 * - to place ths TLS data at offset 64
*/ */
static_tls_align = MAX(align, TIB_ALIGN); static_tls_align = MAXIMUM(align, TIB_ALIGN);
static_tls_align_offset = static_tls_align_offset =
ELF_ROUND(sizeof(struct tib), static_tls_align) - ELF_ROUND(sizeof(struct tib), static_tls_align) -
sizeof(struct tib); sizeof(struct tib);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: util.h,v 1.39 2023/08/15 06:26:34 guenther Exp $ */ /* $OpenBSD: util.h,v 1.40 2023/12/08 12:58:27 deraadt Exp $ */
/* /*
* Copyright (c) 1998 Todd C. Miller <millert@openbsd.org> * Copyright (c) 1998 Todd C. Miller <millert@openbsd.org>
@ -35,6 +35,8 @@
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> /* for NULL */ #include <stddef.h> /* for NULL */
#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
#ifndef __boot #ifndef __boot
# if DO_CLEAN_BOOT # if DO_CLEAN_BOOT
# define __boot __attribute__((section(".boot.text"))) # define __boot __attribute__((section(".boot.text")))

View File

@ -1,4 +1,4 @@
/* $OpenBSD: evp_test.c,v 1.9 2023/11/27 22:39:26 tb Exp $ */ /* $OpenBSD: evp_test.c,v 1.10 2023/12/08 08:30:04 tb Exp $ */
/* /*
* Copyright (c) 2022 Joel Sing <jsing@openbsd.org> * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2023 Theo Buehler <tb@openbsd.org> * Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
@ -439,7 +439,6 @@ evp_do_all_cb_common(const char *descr, const void *ptr, const char *from,
fprintf(stderr, "FAIL: %ss %s and %s out of order\n", descr, fprintf(stderr, "FAIL: %ss %s and %s out of order\n", descr,
previous, from); previous, from);
} }
arg->previous = from;
} }
static void static void
@ -533,6 +532,103 @@ evp_aliases_test(void)
return failure; return failure;
} }
static void
obj_name_cb(const OBJ_NAME *obj_name, void *do_all_arg)
{
struct do_all_arg *arg = do_all_arg;
struct do_all_arg arg_copy = *arg;
const char *previous = arg->previous;
const char *descr = "OBJ_NAME unknown";
assert(obj_name->name != NULL);
arg->previous = obj_name->name;
if (obj_name->type == OBJ_NAME_TYPE_CIPHER_METH) {
descr = "OBJ_NAME cipher";
if (obj_name->alias == 0) {
const EVP_CIPHER *cipher;
if ((cipher = EVP_get_cipherbyname(obj_name->name)) !=
(const EVP_CIPHER *)obj_name->data) {
arg->failure |= 1;
fprintf(stderr, "FAIL: %s by name %p != %p\n",
descr, cipher, obj_name->data);
}
evp_do_all_cb_common(descr, obj_name->data,
obj_name->name, NULL, &arg_copy);
} else if (obj_name->alias == OBJ_NAME_ALIAS) {
evp_cipher_aliases_cb(NULL, obj_name->name,
obj_name->data, &arg_copy);
} else {
fprintf(stderr, "FAIL %s %s: unexpected alias value %d\n",
descr, obj_name->name, obj_name->alias);
arg->failure |= 1;
}
} else if (obj_name->type == OBJ_NAME_TYPE_MD_METH) {
descr = "OBJ_NAME digest";
if (obj_name->alias == 0) {
const EVP_MD *evp_md;
if ((evp_md = EVP_get_digestbyname(obj_name->name)) !=
(const EVP_MD *)obj_name->data) {
arg->failure |= 1;
fprintf(stderr, "FAIL: %s by name %p != %p\n",
descr, evp_md, obj_name->data);
}
evp_do_all_cb_common(descr, obj_name->data,
obj_name->name, NULL, &arg_copy);
} else if (obj_name->alias == OBJ_NAME_ALIAS) {
evp_digest_aliases_cb(NULL, obj_name->name,
obj_name->data, &arg_copy);
} else {
fprintf(stderr, "FAIL: %s %s: unexpected alias value %d\n",
descr, obj_name->name, obj_name->alias);
arg->failure |= 1;
}
} else {
fprintf(stderr, "FAIL: unexpected OBJ_NAME type %d\n",
obj_name->type);
arg->failure |= 1;
}
if (previous != NULL && strcmp(previous, obj_name->name) >= 0) {
arg->failure |= 1;
fprintf(stderr, "FAIL: %ss %s and %s out of order\n", descr,
previous, obj_name->name);
}
arg->failure |= arg_copy.failure;
}
static int
obj_name_do_all_test(void)
{
struct do_all_arg arg;
int failure = 0;
memset(&arg, 0, sizeof(arg));
/* XXX - replace with OBJ_NAME_do_all() after next bump. */
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH, obj_name_cb, &arg);
failure |= arg.failure;
memset(&arg, 0, sizeof(arg));
/* XXX - replace with OBJ_NAME_do_all() after next bump. */
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH, obj_name_cb, &arg);
failure |= arg.failure;
memset(&arg, 0, sizeof(arg));
/* XXX - replace with OBJ_NAME_do_all() after next bump. */
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_PKEY_METH, obj_name_cb, &arg);
failure |= arg.failure;
return failure;
}
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
@ -543,6 +639,7 @@ main(int argc, char **argv)
failed |= evp_pkey_iv_len_test(); failed |= evp_pkey_iv_len_test();
failed |= evp_do_all_test(); failed |= evp_do_all_test();
failed |= evp_aliases_test(); failed |= evp_aliases_test();
failed |= obj_name_do_all_test();
OPENSSL_cleanup(); OPENSSL_cleanup();

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ugold.4,v 1.8 2023/11/30 20:08:23 miod Exp $ .\" $OpenBSD: ugold.4,v 1.9 2023/12/08 06:33:48 miod Exp $
.\" .\"
.\" Copyright (c) 2013 Takayoshi SASANO <sasano@openbsd.org> .\" Copyright (c) 2013 Takayoshi SASANO <sasano@openbsd.org>
.\" Copyright (c) 2013 Martin Pieuchot <mpi@openbsd.org> .\" Copyright (c) 2013 Martin Pieuchot <mpi@openbsd.org>
@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: November 30 2023 $ .Dd $Mdocdate: December 8 2023 $
.Dt UGOLD 4 .Dt UGOLD 4
.Os .Os
.Sh NAME .Sh NAME
@ -41,6 +41,7 @@ driver:
.It Li "RDing TEMPerGold_V3.4" Ta "1 Temperature" .It Li "RDing TEMPerGold_V3.4" Ta "1 Temperature"
.It Li "RDing TEMPerHum1V1.0" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPerHum1V1.0" Ta "1 Temperature and 1 Humidity"
.It Li "RDing TEMPerHum1V1.2" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPerHum1V1.2" Ta "1 Temperature and 1 Humidity"
.It Li "RDing TEMPerHUM_V3.9" Ta "1 Temperature and 1 Humidity"
.It Li "RDing TEMPerHUM_V4.0" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPerHUM_V4.0" Ta "1 Temperature and 1 Humidity"
.It Li "RDing TEMPer1F_H1V1.5F" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPer1F_H1V1.5F" Ta "1 Temperature and 1 Humidity"
.It Li "RDing TEMPerX_V3.1" Ta "1 Temperature and 1 Humidity" .It Li "RDing TEMPerX_V3.1" Ta "1 Temperature and 1 Humidity"

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ugold.c,v 1.24 2023/11/30 20:08:23 miod Exp $ */ /* $OpenBSD: ugold.c,v 1.25 2023/12/08 06:33:48 miod Exp $ */
/* /*
* Copyright (c) 2013 Takayoshi SASANO <uaa@openbsd.org> * Copyright (c) 2013 Takayoshi SASANO <uaa@openbsd.org>
@ -453,7 +453,8 @@ ugold_si700x_type(struct ugold_softc *sc)
} }
if (sc->sc_model_len >= 9 && if (sc->sc_model_len >= 9 &&
memcmp(sc->sc_model, "TEMPerHUM", 9) == 0) { memcmp(sc->sc_model, "TEMPerHUM", 9) == 0) {
if (memcmp(sc->sc_model + 9, "_V4.0 ", 16 - 9) == 0) { if (memcmp(sc->sc_model + 9, "_V3.9 ", 16 - 9) == 0 ||
memcmp(sc->sc_model + 9, "_V4.0 ", 16 - 9) == 0) {
sc->sc_type = UGOLD_TYPE_TEMPERX; sc->sc_type = UGOLD_TYPE_TEMPERX;
descr = "temperx (temperature and humidity)"; descr = "temperx (temperature and humidity)";
goto identified; goto identified;

View File

@ -1,4 +1,4 @@
/* $OpenBSD: exec_elf.h,v 1.101 2023/06/10 19:30:48 kettenis Exp $ */ /* $OpenBSD: exec_elf.h,v 1.102 2023/12/08 13:58:41 deraadt Exp $ */
/* /*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved. * Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
* *
@ -483,6 +483,7 @@ typedef struct {
#define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* fill with random data */ #define PT_OPENBSD_RANDOMIZE 0x65a3dbe6 /* fill with random data */
#define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* program performs W^X violations */ #define PT_OPENBSD_WXNEEDED 0x65a3dbe7 /* program performs W^X violations */
#define PT_OPENBSD_NOBTCFI 0x65a3dbe8 /* no branch target CFI */ #define PT_OPENBSD_NOBTCFI 0x65a3dbe8 /* no branch target CFI */
#define PT_OPENBSD_SYSCALLS 0x65a3dbe9 /* syscall locations */
#define PT_OPENBSD_BOOTDATA 0x65a41be6 /* section for boot arguments */ #define PT_OPENBSD_BOOTDATA 0x65a41be6 /* section for boot arguments */
/* Segment flags - p_flags */ /* Segment flags - p_flags */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshsig.c,v 1.33 2023/09/06 23:18:15 djm Exp $ */ /* $OpenBSD: sshsig.c,v 1.34 2023/12/08 09:18:39 markus Exp $ */
/* /*
* Copyright (c) 2019 Google LLC * Copyright (c) 2019 Google LLC
* *
@ -1119,12 +1119,11 @@ sshsig_match_principals(const char *path, const char *principal,
if (ret == 0) { if (ret == 0) {
if (nprincipals == 0) if (nprincipals == 0)
ret = SSH_ERR_KEY_NOT_FOUND; ret = SSH_ERR_KEY_NOT_FOUND;
if (nprincipalsp != 0)
*nprincipalsp = nprincipals;
if (principalsp != NULL) { if (principalsp != NULL) {
*principalsp = principals; *principalsp = principals;
principals = NULL; /* transferred */ principals = NULL; /* transferred */
}
if (nprincipalsp != 0) {
*nprincipalsp = nprincipals;
nprincipals = 0; nprincipals = 0;
} }
} }