sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-23 13:56:21 +00:00
parent 38dbdec412
commit 933c153850
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
49 changed files with 931 additions and 4156 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: tar.c,v 1.75 2023/12/21 01:20:54 jca Exp $ */ /* $OpenBSD: tar.c,v 1.77 2023/12/22 20:32:29 jca Exp $ */
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ /* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */
/*- /*-
@ -741,6 +741,7 @@ reset:
memset(arcn, 0, sizeof(*arcn)); memset(arcn, 0, sizeof(*arcn));
arcn->org_name = arcn->name; arcn->org_name = arcn->name;
arcn->sb.st_nlink = 1; arcn->sb.st_nlink = 1;
arcn->sb.st_size = (off_t)-1;
/* Process Extended headers. */ /* Process Extended headers. */
if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE) { if (hd->typeflag == XHDRTYPE || hd->typeflag == GHDRTYPE) {
@ -795,7 +796,10 @@ reset:
*/ */
arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) & arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
0xfff); 0xfff);
arcn->sb.st_size = (off_t)asc_ull(hd->size, sizeof(hd->size), OCT); if (arcn->sb.st_size == (off_t)-1) {
arcn->sb.st_size =
(off_t)asc_ull(hd->size, sizeof(hd->size), OCT);
}
if (arcn->sb.st_mtime == 0) { if (arcn->sb.st_mtime == 0) {
val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT); val = asc_ull(hd->mtime, sizeof(hd->mtime), OCT);
if (val > MAX_TIME_T) if (val > MAX_TIME_T)
@ -942,6 +946,38 @@ xheader_add(struct xheader *xhdr, const char *keyword,
return 0; return 0;
} }
static int
xheader_add_ull(struct xheader *xhdr, const char *keyword,
unsigned long long value)
{
struct xheader_record *rec;
int reclen, tmplen;
char *s;
tmplen = MINXHDRSZ;
do {
reclen = tmplen;
tmplen = snprintf(NULL, 0, "%d %s=%llu\n", reclen, keyword,
value);
} while (tmplen >= 0 && tmplen != reclen);
if (tmplen < 0)
return -1;
rec = calloc(1, sizeof(*rec));
if (rec == NULL)
return -1;
rec->reclen = reclen;
if (asprintf(&s, "%d %s=%llu\n", reclen, keyword, value) < 0) {
free(rec);
return -1;
}
rec->record = s;
SLIST_INSERT_HEAD(xhdr, rec, entry);
return 0;
}
static void static void
xheader_free(struct xheader *xhdr) xheader_free(struct xheader *xhdr)
{ {
@ -1160,9 +1196,20 @@ wr_ustar_or_pax(ARCHD *arcn, int ustar)
hd->typeflag = REGTYPE; hd->typeflag = REGTYPE;
arcn->pad = TAR_PAD(arcn->sb.st_size); arcn->pad = TAR_PAD(arcn->sb.st_size);
if (ull_oct(arcn->sb.st_size, hd->size, sizeof(hd->size), 3)) { if (ull_oct(arcn->sb.st_size, hd->size, sizeof(hd->size), 3)) {
paxwarn(1, "File is too long for ustar %s", if (ustar) {
arcn->org_name); paxwarn(1, "File is too long for ustar %s",
return(1); arcn->org_name);
return(1);
}
#ifndef SMALL
else if (xheader_add_ull(&xhdr, "size",
arcn->sb.st_size) == -1) {
paxwarn(1, "File is too long for pax %s",
arcn->org_name);
xheader_free(&xhdr);
return(1);
}
#endif
} }
break; break;
} }
@ -1408,6 +1455,21 @@ rd_time(struct timespec *ts, const char *keyword, char *p)
return 0; return 0;
} }
static int
rd_size(off_t *size, const char *keyword, char *p)
{
const char *errstr;
/* Assume off_t is a long long. */
*size = strtonum(p, 0, LLONG_MAX, &errstr);
if (errstr != NULL) {
paxwarn(1, "%s is %s: %s", keyword, errstr, p);
return -1;
}
return 0;
}
static int static int
rd_xheader(ARCHD *arcn, int global, off_t size) rd_xheader(ARCHD *arcn, int global, off_t size)
{ {
@ -1498,6 +1560,10 @@ rd_xheader(ARCHD *arcn, int global, off_t size)
ret = rd_time(&arcn->sb.st_ctim, keyword, p); ret = rd_time(&arcn->sb.st_ctim, keyword, p);
if (ret < 0) if (ret < 0)
break; break;
} else if (!strcmp(keyword, "size")) {
ret = rd_size(&arcn->sb.st_size, keyword, p);
if (ret < 0)
break;
} }
} }
p = nextp; p = nextp;

View file

@ -3209,6 +3209,7 @@
./usr/share/man/man9/startuphook_establish.9 ./usr/share/man/man9/startuphook_establish.9
./usr/share/man/man9/stoeplitz_to_key.9 ./usr/share/man/man9/stoeplitz_to_key.9
./usr/share/man/man9/strcmp.9 ./usr/share/man/man9/strcmp.9
./usr/share/man/man9/strnstr.9
./usr/share/man/man9/style.9 ./usr/share/man/man9/style.9
./usr/share/man/man9/syscall.9 ./usr/share/man/man9/syscall.9
./usr/share/man/man9/sysctl_int.9 ./usr/share/man/man9/sysctl_int.9

View file

@ -395,7 +395,7 @@ private:
// Futex Implementation // Futex Implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#ifdef __SecBSD__ #ifdef __OpenBSD__
#include <sys/futex.h> #include <sys/futex.h>
void PlatformFutexWait(int* addr, int expect) { void PlatformFutexWait(int* addr, int expect) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cms_smime.c,v 1.27 2023/07/08 08:26:26 beck Exp $ */ /* $OpenBSD: cms_smime.c,v 1.28 2023/12/22 10:23:11 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. * project.
@ -52,14 +52,21 @@
* ==================================================================== * ====================================================================
*/ */
#include "cryptlib.h" #include <sys/types.h>
#include <openssl/asn1t.h>
#include <openssl/x509.h> #include <stddef.h>
#include <openssl/x509v3.h>
#include <openssl/err.h> #include <openssl/asn1.h>
#include <openssl/bio.h>
#include <openssl/cms.h> #include <openssl/cms.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/pkcs7.h>
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include "cms_local.h" #include "cms_local.h"
#include "asn1/asn1_local.h"
static BIO * static BIO *
cms_get_text_bio(BIO *out, unsigned int flags) cms_get_text_bio(BIO *out, unsigned int flags)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_enc.c,v 1.74 2023/12/21 20:50:43 tb Exp $ */ /* $OpenBSD: evp_enc.c,v 1.79 2023/12/23 13:05:06 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.
* *
@ -83,44 +83,48 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
{ {
if (enc == -1) if (enc == -1)
enc = ctx->encrypt; enc = ctx->encrypt;
else { if (enc != 0)
if (enc) enc = 1;
enc = 1; ctx->encrypt = enc;
ctx->encrypt = enc;
}
if (cipher) {
/* Ensure a context left lying around from last time is cleared
* (the previous check attempted to avoid this if the same
* EVP_CIPHER could be used). */
if (ctx->cipher) {
unsigned long flags = ctx->flags;
EVP_CIPHER_CTX_cleanup(ctx);
/* Restore encrypt and flags */
ctx->encrypt = enc;
ctx->flags = flags;
}
if (cipher == NULL && ctx->cipher == NULL) {
EVPerror(EVP_R_NO_CIPHER_SET);
return 0;
}
/*
* If the ctx is reused and a cipher is passed in, reset the ctx but
* remember enc and whether key wrap was enabled.
*/
if (cipher != NULL && ctx->cipher != NULL) {
unsigned long flags = ctx->flags;
EVP_CIPHER_CTX_cleanup(ctx);
ctx->encrypt = enc;
ctx->flags = flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
}
/* Set up cipher. Allocate cipher data and initialize if necessary. */
if (cipher != NULL) {
ctx->cipher = cipher; ctx->cipher = cipher;
if (ctx->cipher->ctx_size) { ctx->key_len = cipher->key_len;
ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW;
if (ctx->cipher->ctx_size != 0) {
ctx->cipher_data = calloc(1, ctx->cipher->ctx_size); ctx->cipher_data = calloc(1, ctx->cipher->ctx_size);
if (ctx->cipher_data == NULL) { if (ctx->cipher_data == NULL) {
EVPerror(ERR_R_MALLOC_FAILURE); EVPerror(ERR_R_MALLOC_FAILURE);
return 0; return 0;
} }
} else {
ctx->cipher_data = NULL;
} }
ctx->key_len = cipher->key_len;
ctx->flags &= EVP_CIPHER_CTX_FLAG_WRAP_ALLOW; if ((ctx->cipher->flags & EVP_CIPH_CTRL_INIT) != 0) {
if (ctx->cipher->flags & EVP_CIPH_CTRL_INIT) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) { if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_INIT, 0, NULL)) {
EVPerror(EVP_R_INITIALIZATION_ERROR); EVPerror(EVP_R_INITIALIZATION_ERROR);
return 0; return 0;
} }
} }
} else if (!ctx->cipher) {
EVPerror(EVP_R_NO_CIPHER_SET);
return 0;
} }
/* Block sizes must be a power of 2 due to the use of block_mask. */ /* Block sizes must be a power of 2 due to the use of block_mask. */
@ -131,13 +135,13 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
return 0; return 0;
} }
if (!(ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW) && if ((ctx->flags & EVP_CIPHER_CTX_FLAG_WRAP_ALLOW) == 0 &&
EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_WRAP_MODE) { EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_WRAP_MODE) {
EVPerror(EVP_R_WRAP_MODE_NOT_ALLOWED); EVPerror(EVP_R_WRAP_MODE_NOT_ALLOWED);
return 0; return 0;
} }
if (!(EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV)) { if ((EVP_CIPHER_CTX_flags(ctx) & EVP_CIPH_CUSTOM_IV) == 0) {
int iv_len; int iv_len;
switch (EVP_CIPHER_CTX_mode(ctx)) { switch (EVP_CIPHER_CTX_mode(ctx)) {
@ -181,7 +185,7 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
} }
} }
if (key || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT)) { if (key != NULL || (ctx->cipher->flags & EVP_CIPH_ALWAYS_CALL_INIT) != 0) {
if (!ctx->cipher->init(ctx, key, iv, enc)) if (!ctx->cipher->init(ctx, key, iv, enc))
return 0; return 0;
} }
@ -203,7 +207,7 @@ EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
} }
int int
EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len) EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
{ {
if (ctx->encrypt) if (ctx->encrypt)
return EVP_EncryptFinal_ex(ctx, out, out_len); return EVP_EncryptFinal_ex(ctx, out, out_len);
@ -212,7 +216,7 @@ EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
} }
int int
EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len) EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
{ {
if (ctx->encrypt) if (ctx->encrypt)
return EVP_EncryptFinal_ex(ctx, out, out_len); return EVP_EncryptFinal_ex(ctx, out, out_len);
@ -234,20 +238,6 @@ EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine
return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 1); return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 1);
} }
int
EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv)
{
return EVP_CipherInit(ctx, cipher, key, iv, 0);
}
int
EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
const unsigned char *key, const unsigned char *iv)
{
return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0);
}
/* /*
* EVP_Cipher() is an implementation detail of EVP_Cipher{Update,Final}(). * EVP_Cipher() is an implementation detail of EVP_Cipher{Update,Final}().
* Behavior depends on EVP_CIPH_FLAG_CUSTOM_CIPHER being set on ctx->cipher. * Behavior depends on EVP_CIPH_FLAG_CUSTOM_CIPHER being set on ctx->cipher.
@ -320,13 +310,13 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
if (partial_len == 0 && (in_len & block_mask) == 0) if (partial_len == 0 && (in_len & block_mask) == 0)
return evp_cipher(ctx, out, out_len, in, in_len); return evp_cipher(ctx, out, out_len, in, in_len);
/* XXX - check that block_size > partial_len. */ if (partial_len < 0 || partial_len >= block_size ||
if (block_size > sizeof(ctx->buf)) { block_size > sizeof(ctx->buf)) {
EVPerror(EVP_R_BAD_BLOCK_LENGTH); EVPerror(EVP_R_BAD_BLOCK_LENGTH);
return 0; return 0;
} }
if (partial_len != 0) { if (partial_len > 0) {
int partial_needed; int partial_needed;
if ((partial_needed = block_size - partial_len) > in_len) { if ((partial_needed = block_size - partial_len) > in_len) {
@ -369,9 +359,8 @@ EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
total_len += len; total_len += len;
} }
if (partial_len != 0) if ((ctx->partial_len = partial_len) > 0)
memcpy(ctx->buf, &in[in_len], partial_len); memcpy(ctx->buf, &in[in_len], partial_len);
ctx->partial_len = partial_len;
*out_len = total_len; *out_len = total_len;
@ -396,8 +385,8 @@ EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0) if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) != 0)
return evp_cipher(ctx, out, out_len, NULL, 0); return evp_cipher(ctx, out, out_len, NULL, 0);
/* XXX - check that block_size > partial_len. */ if (partial_len < 0 || partial_len >= block_size ||
if (block_size > sizeof(ctx->buf)) { block_size > sizeof(ctx->buf)) {
EVPerror(EVP_R_BAD_BLOCK_LENGTH); EVPerror(EVP_R_BAD_BLOCK_LENGTH);
return 0; return 0;
} }
@ -418,6 +407,20 @@ EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len)
return evp_cipher(ctx, out, out_len, ctx->buf, block_size); return evp_cipher(ctx, out, out_len, ctx->buf, block_size);
} }
int
EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *iv)
{
return EVP_CipherInit(ctx, cipher, key, iv, 0);
}
int
EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
const unsigned char *key, const unsigned char *iv)
{
return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0);
}
int int
EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len, EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *out_len,
const unsigned char *in, int in_len) const unsigned char *in, int in_len)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_local.h,v 1.8 2023/12/20 14:10:03 tb Exp $ */ /* $OpenBSD: evp_local.h,v 1.9 2023/12/22 17:25:47 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 2000. * project 2000.
*/ */
@ -170,8 +170,8 @@ struct evp_cipher_ctx_st {
int encrypt; /* encrypt or decrypt */ int encrypt; /* encrypt or decrypt */
int partial_len; /* number of bytes written to buf */ int partial_len; /* number of bytes written to buf */
unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */ unsigned char oiv[EVP_MAX_IV_LENGTH]; /* original iv */
unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */ unsigned char iv[EVP_MAX_IV_LENGTH]; /* working iv */
unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */ unsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */
int num; /* used by cfb/ofb/ctr mode */ int num; /* used by cfb/ofb/ctr mode */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_local.h,v 1.11 2023/11/01 20:37:42 tb Exp $ */ /* $OpenBSD: x509_local.h,v 1.14 2023/12/22 13:31:35 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 2013. * project 2013.
*/ */
@ -299,15 +299,7 @@ struct x509_store_st {
/* Callbacks for various operations */ /* Callbacks for various operations */
int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup)(X509_STORE_CTX *ctx);
CRYPTO_EX_DATA ex_data; CRYPTO_EX_DATA ex_data;
int references; int references;
@ -344,14 +336,6 @@ struct x509_store_ctx_st {
int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */ int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */ int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
int (*check_policy)(X509_STORE_CTX *ctx);
STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
STACK_OF(X509_CRL) * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup)(X509_STORE_CTX *ctx);
/* The following is built up */ /* The following is built up */
int valid; /* if 0, rebuild chain */ int valid; /* if 0, rebuild chain */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_vfy.c,v 1.127 2023/11/27 00:51:12 tb Exp $ */ /* $OpenBSD: x509_vfy.c,v 1.135 2023/12/23 00:52:13 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.
* *
@ -116,16 +116,15 @@
#define CRL_SCORE_TIME_DELTA 0x002 #define CRL_SCORE_TIME_DELTA 0x002
static int x509_vfy_check_crl(X509_STORE_CTX *ctx, X509_CRL *crl);
static int x509_vfy_cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
static int null_callback(int ok, X509_STORE_CTX *e); static int null_callback(int ok, X509_STORE_CTX *e);
static int check_issued(X509_STORE_CTX *ctx, X509 *subject, X509 *issuer); static int check_issued(X509_STORE_CTX *ctx, X509 *subject, X509 *issuer);
static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x, static X509 *find_issuer(X509_STORE_CTX *ctx, STACK_OF(X509) *sk, X509 *x,
int allow_expired); int allow_expired);
static int check_chain_extensions(X509_STORE_CTX *ctx);
static int check_name_constraints(X509_STORE_CTX *ctx); static int check_name_constraints(X509_STORE_CTX *ctx);
static int check_trust(X509_STORE_CTX *ctx);
static int check_revocation(X509_STORE_CTX *ctx);
static int check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth); static int check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth);
static int check_policy(X509_STORE_CTX *ctx);
static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer, static int get_crl_score(X509_STORE_CTX *ctx, X509 **pissuer,
unsigned int *preasons, X509_CRL *crl, X509 *x); unsigned int *preasons, X509_CRL *crl, X509 *x);
@ -144,7 +143,6 @@ static int X509_cmp_time_internal(const ASN1_TIME *ctm, time_t *cmp_time,
int clamp_notafter); int clamp_notafter);
static int internal_verify(X509_STORE_CTX *ctx); static int internal_verify(X509_STORE_CTX *ctx);
static int get_trusted_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
static int check_key_level(X509_STORE_CTX *ctx, X509 *cert); static int check_key_level(X509_STORE_CTX *ctx, X509 *cert);
static int verify_cb_cert(X509_STORE_CTX *ctx, X509 *x, int depth, int err); static int verify_cb_cert(X509_STORE_CTX *ctx, X509 *x, int depth, int err);
@ -177,7 +175,7 @@ check_id_error(X509_STORE_CTX *ctx, int errcode)
} }
static int static int
check_hosts(X509 *x, X509_VERIFY_PARAM *vpm) x509_vfy_check_hosts(X509 *x, X509_VERIFY_PARAM *vpm)
{ {
int i, n; int i, n;
char *name; char *name;
@ -195,13 +193,13 @@ check_hosts(X509 *x, X509_VERIFY_PARAM *vpm)
return n == 0; return n == 0;
} }
static int int
check_id(X509_STORE_CTX *ctx) x509_vfy_check_id(X509_STORE_CTX *ctx)
{ {
X509_VERIFY_PARAM *vpm = ctx->param; X509_VERIFY_PARAM *vpm = ctx->param;
X509 *x = ctx->cert; X509 *x = ctx->cert;
if (vpm->hosts && check_hosts(x, vpm) <= 0) { if (vpm->hosts && x509_vfy_check_hosts(x, vpm) <= 0) {
if (!check_id_error(ctx, X509_V_ERR_HOSTNAME_MISMATCH)) if (!check_id_error(ctx, X509_V_ERR_HOSTNAME_MISMATCH))
return 0; return 0;
} }
@ -217,11 +215,6 @@ check_id(X509_STORE_CTX *ctx)
return 1; return 1;
} }
int
x509_vfy_check_id(X509_STORE_CTX *ctx) {
return check_id(ctx);
}
/* /*
* This is the effectively broken legacy OpenSSL chain builder. It * This is the effectively broken legacy OpenSSL chain builder. It
* might find an unvalidated chain and leave it sitting in * might find an unvalidated chain and leave it sitting in
@ -430,7 +423,7 @@ X509_verify_cert_legacy_build_chain(X509_STORE_CTX *ctx, int *bad, int *out_ok)
} }
/* we now have our chain, lets check it... */ /* we now have our chain, lets check it... */
trust = check_trust(ctx); trust = x509_vfy_check_trust(ctx);
/* If explicitly rejected error */ /* If explicitly rejected error */
if (trust == X509_TRUST_REJECTED) { if (trust == X509_TRUST_REJECTED) {
@ -532,7 +525,7 @@ X509_verify_cert_legacy(X509_STORE_CTX *ctx)
goto end; goto end;
/* We have the chain complete: now we need to check its purpose */ /* We have the chain complete: now we need to check its purpose */
ok = check_chain_extensions(ctx); ok = x509_vfy_check_chain_extensions(ctx);
if (!ok) if (!ok)
goto end; goto end;
@ -556,7 +549,7 @@ X509_verify_cert_legacy(X509_STORE_CTX *ctx)
goto end; goto end;
#endif #endif
ok = check_id(ctx); ok = x509_vfy_check_id(ctx);
if (!ok) if (!ok)
goto end; goto end;
@ -564,7 +557,7 @@ X509_verify_cert_legacy(X509_STORE_CTX *ctx)
* Check revocation status: we do this after copying parameters because * Check revocation status: we do this after copying parameters because
* they may be needed for CRL signature verification. * they may be needed for CRL signature verification.
*/ */
ok = ctx->check_revocation(ctx); ok = x509_vfy_check_revocation(ctx);
if (!ok) if (!ok)
goto end; goto end;
@ -578,7 +571,7 @@ X509_verify_cert_legacy(X509_STORE_CTX *ctx)
/* If we get this far evaluate policies */ /* If we get this far evaluate policies */
if (!bad_chain) if (!bad_chain)
ok = ctx->check_policy(ctx); ok = x509_vfy_check_policy(ctx);
end: end:
/* Safety net, error returns must set ctx->error */ /* Safety net, error returns must set ctx->error */
@ -696,7 +689,7 @@ check_issued(X509_STORE_CTX *ctx, X509 *subject, X509 *issuer)
/* Alternative lookup method: look from a STACK stored in ctx->trusted */ /* Alternative lookup method: look from a STACK stored in ctx->trusted */
static int static int
get_trusted_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x) x509_vfy_get_trusted_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x)
{ {
*issuer = find_issuer(ctx, ctx->trusted, x, 1); *issuer = find_issuer(ctx, ctx->trusted, x, 1);
if (*issuer) { if (*issuer) {
@ -813,11 +806,6 @@ end:
#endif #endif
} }
static int
check_chain_extensions(X509_STORE_CTX *ctx) {
return x509_vfy_check_chain_extensions(ctx);
}
static int static int
check_name_constraints(X509_STORE_CTX *ctx) check_name_constraints(X509_STORE_CTX *ctx)
{ {
@ -840,7 +828,7 @@ lookup_cert_match(X509_STORE_CTX *ctx, X509 *x)
size_t i; size_t i;
/* Lookup all certs with matching subject name */ /* Lookup all certs with matching subject name */
certs = ctx->lookup_certs(ctx, X509_get_subject_name(x)); certs = X509_STORE_CTX_get1_certs(ctx, X509_get_subject_name(x));
if (certs == NULL) if (certs == NULL)
return NULL; return NULL;
@ -863,14 +851,13 @@ lookup_cert_match(X509_STORE_CTX *ctx, X509 *x)
X509 * X509 *
x509_vfy_lookup_cert_match(X509_STORE_CTX *ctx, X509 *x) x509_vfy_lookup_cert_match(X509_STORE_CTX *ctx, X509 *x)
{ {
if (ctx->lookup_certs == NULL || ctx->store == NULL || if (ctx->store == NULL || ctx->store->objs == NULL)
ctx->store->objs == NULL)
return NULL; return NULL;
return lookup_cert_match(ctx, x); return lookup_cert_match(ctx, x);
} }
static int int
check_trust(X509_STORE_CTX *ctx) x509_vfy_check_trust(X509_STORE_CTX *ctx)
{ {
size_t i; size_t i;
int ok; int ok;
@ -925,13 +912,7 @@ check_trust(X509_STORE_CTX *ctx)
} }
int int
x509_vfy_check_trust(X509_STORE_CTX *ctx) x509_vfy_check_revocation(X509_STORE_CTX *ctx)
{
return check_trust(ctx);
}
static int
check_revocation(X509_STORE_CTX *ctx)
{ {
int i, last, ok; int i, last, ok;
@ -953,12 +934,6 @@ check_revocation(X509_STORE_CTX *ctx)
return 1; return 1;
} }
int
x509_vfy_check_revocation(X509_STORE_CTX *ctx)
{
return check_revocation(ctx);
}
static int static int
check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth) check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth)
{ {
@ -976,28 +951,22 @@ check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth)
while (ctx->current_reasons != CRLDP_ALL_REASONS) { while (ctx->current_reasons != CRLDP_ALL_REASONS) {
last_reasons = ctx->current_reasons; last_reasons = ctx->current_reasons;
/* Try to retrieve relevant CRL */ /* Try to retrieve relevant CRL */
if (ctx->get_crl) ok = get_crl_delta(ctx, &crl, &dcrl, x);
ok = ctx->get_crl(ctx, &crl, x);
else
ok = get_crl_delta(ctx, &crl, &dcrl, x);
/* If error looking up CRL, nothing we can do except
* notify callback
*/
if (!ok) { if (!ok) {
ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
ok = ctx->verify_cb(0, ctx); ok = ctx->verify_cb(0, ctx);
goto err; goto err;
} }
ctx->current_crl = crl; ctx->current_crl = crl;
ok = ctx->check_crl(ctx, crl); ok = x509_vfy_check_crl(ctx, crl);
if (!ok) if (!ok)
goto err; goto err;
if (dcrl) { if (dcrl) {
ok = ctx->check_crl(ctx, dcrl); ok = x509_vfy_check_crl(ctx, dcrl);
if (!ok) if (!ok)
goto err; goto err;
ok = ctx->cert_crl(ctx, dcrl, x); ok = x509_vfy_cert_crl(ctx, dcrl, x);
if (!ok) if (!ok)
goto err; goto err;
} else } else
@ -1005,7 +974,7 @@ check_cert(X509_STORE_CTX *ctx, STACK_OF(X509) *chain, int depth)
/* Don't look in full CRL if delta reason is removefromCRL */ /* Don't look in full CRL if delta reason is removefromCRL */
if (ok != 2) { if (ok != 2) {
ok = ctx->cert_crl(ctx, crl, x); ok = x509_vfy_cert_crl(ctx, crl, x);
if (!ok) if (!ok)
goto err; goto err;
} }
@ -1559,7 +1528,7 @@ get_crl_delta(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
goto done; goto done;
/* Lookup CRLs from store */ /* Lookup CRLs from store */
skcrl = ctx->lookup_crls(ctx, nm); skcrl = X509_STORE_CTX_get1_crls(ctx, nm);
/* If no CRLs found and a near match from get_crl_sk use that */ /* If no CRLs found and a near match from get_crl_sk use that */
if (!skcrl && crl) if (!skcrl && crl)
@ -1586,7 +1555,7 @@ done:
/* Check CRL validity */ /* Check CRL validity */
static int static int
check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) x509_vfy_check_crl(X509_STORE_CTX *ctx, X509_CRL *crl)
{ {
X509 *issuer = NULL; X509 *issuer = NULL;
EVP_PKEY *ikey = NULL; EVP_PKEY *ikey = NULL;
@ -1689,7 +1658,7 @@ err:
/* Check certificate against CRL */ /* Check certificate against CRL */
static int static int
cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x) x509_vfy_cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
{ {
int ok; int ok;
X509_REVOKED *rev; X509_REVOKED *rev;
@ -1756,12 +1725,6 @@ x509_vfy_check_policy(X509_STORE_CTX *ctx)
return 1; return 1;
} }
static int
check_policy(X509_STORE_CTX *ctx)
{
return x509_vfy_check_policy(ctx);
}
/* /*
* Inform the verify callback of an error. * Inform the verify callback of an error.
* *
@ -2338,52 +2301,8 @@ X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *leaf,
else else
ctx->verify_cb = null_callback; ctx->verify_cb = null_callback;
if (store && store->get_issuer) ctx->get_issuer = X509_STORE_CTX_get1_issuer;
ctx->get_issuer = store->get_issuer; ctx->check_issued = check_issued;
else
ctx->get_issuer = X509_STORE_CTX_get1_issuer;
if (store && store->check_issued)
ctx->check_issued = store->check_issued;
else
ctx->check_issued = check_issued;
if (store && store->check_revocation)
ctx->check_revocation = store->check_revocation;
else
ctx->check_revocation = check_revocation;
if (store && store->get_crl)
ctx->get_crl = store->get_crl;
else
ctx->get_crl = NULL;
if (store && store->check_crl)
ctx->check_crl = store->check_crl;
else
ctx->check_crl = check_crl;
if (store && store->cert_crl)
ctx->cert_crl = store->cert_crl;
else
ctx->cert_crl = cert_crl;
ctx->check_policy = check_policy;
if (store && store->lookup_certs)
ctx->lookup_certs = store->lookup_certs;
else
ctx->lookup_certs = X509_STORE_CTX_get1_certs;
if (store && store->lookup_crls)
ctx->lookup_crls = store->lookup_crls;
else
ctx->lookup_crls = X509_STORE_CTX_get1_crls;
if (store && store->cleanup)
ctx->cleanup = store->cleanup;
else
ctx->cleanup = NULL;
ctx->param = X509_VERIFY_PARAM_new(); ctx->param = X509_VERIFY_PARAM_new();
if (!ctx->param) { if (!ctx->param) {
@ -2432,15 +2351,13 @@ void
X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *trusted) X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *trusted)
{ {
ctx->trusted = trusted; ctx->trusted = trusted;
ctx->get_issuer = get_trusted_issuer; ctx->get_issuer = x509_vfy_get_trusted_issuer;
} }
LCRYPTO_ALIAS(X509_STORE_CTX_set0_trusted_stack); LCRYPTO_ALIAS(X509_STORE_CTX_set0_trusted_stack);
void void
X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx)
{ {
if (ctx->cleanup)
ctx->cleanup(ctx);
if (ctx->param != NULL) { if (ctx->param != NULL) {
if (ctx->parent == NULL) if (ctx->parent == NULL)
X509_VERIFY_PARAM_free(ctx->param); X509_VERIFY_PARAM_free(ctx->param);

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# $OpenBSD: xargs-L.sh,v 1.3 2017/10/16 13:48:22 anton Exp $ # $OpenBSD: xargs-L.sh,v 1.4 2023/12/22 17:12:13 millert Exp $
# #
# written by Ingo Schwarze <schwarze@openbsd.org> 2010 # written by Ingo Schwarze <schwarze@openbsd.org> 2010
# and placed in the public domain # and placed in the public domain
@ -97,3 +97,11 @@ test_xargs 'a\n\\\nb\0c' '-0 -L 1' 'a\n\\\nb|\nc|'
test_xargs 'a \\\nb\0c' '-0 -L 1' 'a \\\nb|\nc|' test_xargs 'a \\\nb\0c' '-0 -L 1' 'a \\\nb|\nc|'
test_xargs 'a\\\n b\0c' '-0 -L 1' 'a\\\n b|\nc|' test_xargs 'a\\\n b\0c' '-0 -L 1' 'a\\\n b|\nc|'
test_xargs 'a \\\n b\0c' '-0 -L 1' 'a \\\n b|\nc|' test_xargs 'a \\\n b\0c' '-0 -L 1' 'a \\\n b|\nc|'
test_xargs 'a' '-0 -L 1' 'a|\n'
test_xargs 'a\0' '-0 -L 1' 'a|\n'
test_xargs 'a\0\0' '-0 -L 1' 'a|\n|\n'
test_xargs 'a\0\0b' '-0 -L 2' 'a||\nb|'
test_xargs 'a\0\0b' '-0 -L 1' 'a|\n|\nb|'
test_xargs 'a\0\0b' '-0 -L 3' 'a||b|'
test_xargs 'a\0\0b' '-0 -L 9' 'a||b|'

View file

@ -1,7 +1,7 @@
.\" $OpenBSD: abcrtc.4,v 1.2 2019/01/11 20:39:46 jmc Exp $ .\" $OpenBSD: abcrtc.4,v 1.3 2023/12/23 02:42:51 jsg Exp $
.\" .\"
.\" Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org> .\" Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org>
.\" Copyright (c) 2018 Mark Kettenis <ketttenis@openbsd.org> .\" Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
.\" Copyright (c) 2018 Patrick Wildt <patrick@blueri.se> .\" Copyright (c) 2018 Patrick Wildt <patrick@blueri.se>
.\" .\"
.\" Permission to use, copy, modify, and distribute this software for any .\" Permission to use, copy, modify, and distribute this software for any
@ -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: January 11 2019 $ .Dd $Mdocdate: December 23 2023 $
.Dt ABCRTC 4 .Dt ABCRTC 4
.Os .Os
.Sh NAME .Sh NAME

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: python-module.5,v 1.8 2023/12/20 13:30:51 sthen Exp $ .\" $OpenBSD: python-module.5,v 1.9 2023/12/22 12:51:53 sthen Exp $
.\" .\"
.\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2008 Marc Espie
.\" .\"
@ -24,7 +24,7 @@
.\" (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.
.\" .\"
.Dd $Mdocdate: December 20 2023 $ .Dd $Mdocdate: December 22 2023 $
.Dt PYTHON-MODULE 5 .Dt PYTHON-MODULE 5
.Os .Os
.Sh NAME .Sh NAME
@ -113,8 +113,8 @@ If the port provides a
.Pa pyproject.toml .Pa pyproject.toml
file, check the "build-backend" line in the [build-system] section. file, check the "build-backend" line in the [build-system] section.
.Nm .Nm
currently supports flit_core, hatchling, hatch-vcs, poetry-core, setuptools currently supports flit_core, hatchling, hatch-vcs, jupyter_packaging,
and setuptools_scm. poetry-core, setuptools and setuptools_scm.
If no If no
.Pa pyproject.toml .Pa pyproject.toml
is provided then it probably uses setuptools. is provided then it probably uses setuptools.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: drm_linux.c,v 1.104 2023/10/20 03:38:58 jsg Exp $ */ /* $OpenBSD: drm_linux.c,v 1.105 2023/12/23 14:18:27 kettenis Exp $ */
/* /*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@ -1501,6 +1501,9 @@ acpi_format_exception(acpi_status status)
#endif #endif
SLIST_HEAD(,backlight_device) backlight_device_list =
SLIST_HEAD_INITIALIZER(backlight_device_list);
void void
backlight_do_update_status(void *arg) backlight_do_update_status(void *arg)
{ {
@ -1509,7 +1512,7 @@ backlight_do_update_status(void *arg)
struct backlight_device * struct backlight_device *
backlight_device_register(const char *name, void *kdev, void *data, backlight_device_register(const char *name, void *kdev, void *data,
const struct backlight_ops *ops, struct backlight_properties *props) const struct backlight_ops *ops, const struct backlight_properties *props)
{ {
struct backlight_device *bd; struct backlight_device *bd;
@ -1520,31 +1523,26 @@ backlight_device_register(const char *name, void *kdev, void *data,
task_set(&bd->task, backlight_do_update_status, bd); task_set(&bd->task, backlight_do_update_status, bd);
SLIST_INSERT_HEAD(&backlight_device_list, bd, next);
bd->name = name;
return bd; return bd;
} }
void void
backlight_device_unregister(struct backlight_device *bd) backlight_device_unregister(struct backlight_device *bd)
{ {
SLIST_REMOVE(&backlight_device_list, bd, backlight_device, next);
free(bd, M_DRM, sizeof(*bd)); free(bd, M_DRM, sizeof(*bd));
} }
struct backlight_device *
devm_backlight_device_register(void *dev, const char *name, void *parent,
void *data, const struct backlight_ops *bo,
const struct backlight_properties *bp)
{
STUB();
return NULL;
}
void void
backlight_schedule_update_status(struct backlight_device *bd) backlight_schedule_update_status(struct backlight_device *bd)
{ {
task_add(systq, &bd->task); task_add(systq, &bd->task);
} }
inline int int
backlight_enable(struct backlight_device *bd) backlight_enable(struct backlight_device *bd)
{ {
if (bd == NULL) if (bd == NULL)
@ -1555,7 +1553,7 @@ backlight_enable(struct backlight_device *bd)
return bd->ops->update_status(bd); return bd->ops->update_status(bd);
} }
inline int int
backlight_disable(struct backlight_device *bd) backlight_disable(struct backlight_device *bd)
{ {
if (bd == NULL) if (bd == NULL)
@ -1566,6 +1564,62 @@ backlight_disable(struct backlight_device *bd)
return bd->ops->update_status(bd); return bd->ops->update_status(bd);
} }
struct backlight_device *
backlight_device_get_by_name(const char *name)
{
struct backlight_device *bd;
SLIST_FOREACH(bd, &backlight_device_list, next) {
if (strcmp(name, bd->name) == 0)
return bd;
}
return NULL;
}
struct drvdata {
struct device *dev;
void *data;
SLIST_ENTRY(drvdata) next;
};
SLIST_HEAD(,drvdata) drvdata_list = SLIST_HEAD_INITIALIZER(drvdata_list);
void
dev_set_drvdata(struct device *dev, void *data)
{
struct drvdata *drvdata;
SLIST_FOREACH(drvdata, &drvdata_list, next) {
if (drvdata->dev == dev) {
drvdata->data = data;
return;
}
}
if (data == NULL)
return;
drvdata = malloc(sizeof(*drvdata), M_DRM, M_WAITOK);
drvdata->dev = dev;
drvdata->data = data;
SLIST_INSERT_HEAD(&drvdata_list, drvdata, next);
}
void *
dev_get_drvdata(struct device *dev)
{
struct drvdata *drvdata;
SLIST_FOREACH(drvdata, &drvdata_list, next) {
if (drvdata->dev == dev)
return drvdata->data;
}
return NULL;
}
void void
drm_sysfs_hotplug_event(struct drm_device *dev) drm_sysfs_hotplug_event(struct drm_device *dev)
{ {

View file

@ -73,9 +73,7 @@ struct drm_minor {
/* private: */ /* private: */
int index; /* Minor device number */ int index; /* Minor device number */
int type; /* Control or render */ int type; /* Control or render */
#ifdef __linux__
struct device *kdev; /* Linux device */ struct device *kdev; /* Linux device */
#endif
struct drm_device *dev; struct drm_device *dev;
struct dentry *debugfs_root; struct dentry *debugfs_root;

View file

@ -11,24 +11,32 @@ struct device;
struct backlight_properties { struct backlight_properties {
int type; int type;
#define BACKLIGHT_RAW 0
#define BACKLIGHT_FIRMWARE 1
#define BACKLIGHT_PLATFORM 2
int max_brightness; int max_brightness;
int brightness; int brightness;
int power; int power;
int scale;
#define BACKLIGHT_SCALE_LINEAR 0
int state;
#define BL_CORE_SUSPENDED 0x00000001
}; };
struct backlight_ops { struct backlight_ops {
int options; int options;
#define BL_CORE_SUSPENDRESUME 0x00000001
int (*update_status)(struct backlight_device *); int (*update_status)(struct backlight_device *);
int (*get_brightness)(struct backlight_device *); int (*get_brightness)(struct backlight_device *);
}; };
#define BL_CORE_SUSPENDRESUME 1
struct backlight_device { struct backlight_device {
const struct backlight_ops *ops; const struct backlight_ops *ops;
struct backlight_properties props; struct backlight_properties props;
struct task task; struct task task;
void *data; void *data;
SLIST_ENTRY(backlight_device) next;
const char *name;
}; };
static inline void * static inline void *
@ -37,18 +45,25 @@ bl_get_data(struct backlight_device *bd)
return bd->data; return bd->data;
} }
#define BACKLIGHT_RAW 0 static inline int
#define BACKLIGHT_FIRMWARE 1 backlight_get_brightness(struct backlight_device *bd)
{
return bd->props.brightness;
}
#define BACKLIGHT_UPDATE_HOTKEY 0 #define BACKLIGHT_UPDATE_HOTKEY 0
struct backlight_device *backlight_device_register(const char *, void *, struct backlight_device *backlight_device_register(const char *, void *,
void *, const struct backlight_ops *, struct backlight_properties *); void *, const struct backlight_ops *, const struct backlight_properties *);
void backlight_device_unregister(struct backlight_device *); void backlight_device_unregister(struct backlight_device *);
struct backlight_device *devm_backlight_device_register(void *, const char *, static inline struct backlight_device *
void *, void *, const struct backlight_ops *, devm_backlight_device_register(void *dev, const char *name, void *parent,
const struct backlight_properties *); void *data, const struct backlight_ops *bo,
const struct backlight_properties *bp)
{
return backlight_device_register(name, dev, data, bo, bp);
}
static inline void static inline void
backlight_update_status(struct backlight_device *bd) backlight_update_status(struct backlight_device *bd)
@ -82,10 +97,6 @@ devm_of_find_backlight(struct device *dev)
return NULL; return NULL;
} }
static inline struct backlight_device * struct backlight_device *backlight_device_get_by_name(const char *);
backlight_device_get_by_name(const char *name)
{
return NULL;
}
#endif #endif

View file

@ -16,6 +16,9 @@
struct device_node; struct device_node;
struct bus_type {
};
struct device_driver { struct device_driver {
struct device *dev; struct device *dev;
}; };
@ -33,12 +36,13 @@ struct device_attribute {
#define device_create_file(a, b) 0 #define device_create_file(a, b) 0
#define device_remove_file(a, b) #define device_remove_file(a, b)
#define dev_get_drvdata(x) NULL void *dev_get_drvdata(struct device *);
#define dev_set_drvdata(x, y) void dev_set_drvdata(struct device *, void *);
#define dev_pm_set_driver_flags(x, y) #define dev_pm_set_driver_flags(x, y)
#define devm_kzalloc(x, y, z) kzalloc(y, z) #define devm_kzalloc(x, y, z) kzalloc(y, z)
#define devm_kfree(x, y) kfree(y)
#define dev_warn(dev, fmt, arg...) \ #define dev_warn(dev, fmt, arg...) \
printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \ printf("drm:pid%d:%s *WARNING* " fmt, curproc->p_p->ps_pid, \
@ -79,6 +83,10 @@ struct device_attribute {
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \ printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg) __func__ , ## arg)
#define dev_err_probe(dev, err, fmt, arg...) \
printf("drm:pid%d:%s *ERROR* " fmt, curproc->p_p->ps_pid, \
__func__ , ## arg), err
#ifdef DRMDEBUG #ifdef DRMDEBUG
#define dev_info(dev, fmt, arg...) \ #define dev_info(dev, fmt, arg...) \
printf("drm: " fmt, ## arg) printf("drm: " fmt, ## arg)

View file

@ -169,6 +169,9 @@ iowrite64(u64 val, volatile void __iomem *addr)
#define readq(p) ioread64(p) #define readq(p) ioread64(p)
#define writeq(v, p) iowrite64(v, p) #define writeq(v, p) iowrite64(v, p)
#define readl_relaxed(p) readl(p)
#define writel_relaxed(v, p) writel(v, p)
int drm_mtrr_add(unsigned long, size_t, int); int drm_mtrr_add(unsigned long, size_t, int);
int drm_mtrr_del(int, unsigned long, size_t, int); int drm_mtrr_del(int, unsigned long, size_t, int);

View file

@ -5,6 +5,8 @@
#include <linux/types.h> #include <linux/types.h>
#define IORESOURCE_MEM 0x0001
struct resource { struct resource {
u_long start; u_long start;
u_long end; u_long end;

View file

@ -40,7 +40,12 @@ jiffies_to_nsecs(const unsigned long x)
#define usecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000) #define usecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000)
#define nsecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000000) #define nsecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000000000)
#define nsecs_to_jiffies64(x) (((uint64_t)(x)) * hz / 1000000000) #define nsecs_to_jiffies64(x) (((uint64_t)(x)) * hz / 1000000000)
#define get_jiffies_64() jiffies
static inline uint64_t
get_jiffies_64(void)
{
return jiffies;
}
static inline int static inline int
time_after(const unsigned long a, const unsigned long b) time_after(const unsigned long a, const unsigned long b)
@ -55,6 +60,12 @@ time_after_eq(const unsigned long a, const unsigned long b)
return((long)(b - a) <= 0); return((long)(b - a) <= 0);
} }
static inline int
time_after_eq64(const unsigned long long a, const unsigned long long b)
{
return((long long)(b - a) <= 0);
}
#define time_after32(a,b) ((int32_t)((uint32_t)(b) - (uint32_t)(a)) < 0) #define time_after32(a,b) ((int32_t)((uint32_t)(b) - (uint32_t)(a)) < 0)
#endif #endif

View file

@ -149,4 +149,6 @@ _in_dbg_master(void)
#define STUB() do { printf("%s: stub\n", __func__); } while(0) #define STUB() do { printf("%s: stub\n", __func__); } while(0)
#define CONCATENATE(x, y) __CONCAT(x, y)
#endif #endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pci.h,v 1.14 2023/09/13 12:31:49 jsg Exp $ */ /* $OpenBSD: pci.h,v 1.15 2023/12/23 14:18:27 kettenis Exp $ */
/* /*
* Copyright (c) 2015 Mark Kettenis * Copyright (c) 2015 Mark Kettenis
* *
@ -482,6 +482,14 @@ pci_set_power_state(struct pci_dev *dev, int state)
return 0; return 0;
} }
struct pci_driver;
static inline int
pci_register_driver(struct pci_driver *pci_drv)
{
return 0;
}
static inline void static inline void
pci_unregister_driver(void *d) pci_unregister_driver(void *d)
{ {

View file

@ -37,7 +37,7 @@ typedef uint32_t __be32;
typedef uint64_t __le64; typedef uint64_t __le64;
typedef uint64_t __be64; typedef uint64_t __be64;
typedef bus_addr_t dma_addr_t; typedef uint64_t dma_addr_t;
typedef paddr_t phys_addr_t; typedef paddr_t phys_addr_t;
typedef paddr_t resource_size_t; typedef paddr_t resource_size_t;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if.c,v 1.711 2023/11/11 14:24:03 bluhm Exp $ */ /* $OpenBSD: if.c,v 1.713 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_aggr.c,v 1.40 2023/05/16 14:32:54 jan Exp $ */ /* $OpenBSD: if_aggr.c,v 1.42 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2019 The University of Queensland * Copyright (c) 2019 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_bpe.c,v 1.20 2023/10/27 20:56:47 jan Exp $ */ /* $OpenBSD: if_bpe.c,v 1.22 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2018 David Gwynne <dlg@openbsd.org> * Copyright (c) 2018 David Gwynne <dlg@openbsd.org>
* *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_etherip.c,v 1.52 2023/11/28 13:23:20 bluhm Exp $ */ /* $OpenBSD: if_etherip.c,v 1.54 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2015 Kazuya GODA <goda@openbsd.org> * Copyright (c) 2015 Kazuya GODA <goda@openbsd.org>
* *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_gif.c,v 1.134 2023/11/28 13:23:20 bluhm Exp $ */ /* $OpenBSD: if_gif.c,v 1.136 2023/12/23 10:52:54 bluhm Exp $ */
/* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */ /* $KAME: if_gif.c,v 1.43 2001/02/20 08:51:07 itojun Exp $ */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_gre.c,v 1.176 2023/11/28 13:23:20 bluhm Exp $ */ /* $OpenBSD: if_gre.c,v 1.178 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */ /* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpe.c,v 1.102 2022/08/29 07:51:45 bluhm Exp $ */ /* $OpenBSD: if_mpe.c,v 1.104 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpip.c,v 1.16 2022/08/29 07:51:45 bluhm Exp $ */ /* $OpenBSD: if_mpip.c,v 1.18 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_mpw.c,v 1.63 2022/08/29 07:51:45 bluhm Exp $ */ /* $OpenBSD: if_mpw.c,v 1.65 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org> * Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pflow.c,v 1.107 2023/12/19 20:34:10 mvs Exp $ */ /* $OpenBSD: if_pflow.c,v 1.109 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2011 Florian Obser <florian@narrans.de> * Copyright (c) 2011 Florian Obser <florian@narrans.de>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pfsync.c,v 1.322 2023/10/03 10:22:10 sthen Exp $ */ /* $OpenBSD: if_pfsync.c,v 1.324 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2002 Michael Shalayeff * Copyright (c) 2002 Michael Shalayeff

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pppx.c,v 1.126 2023/02/10 14:34:17 visa Exp $ */ /* $OpenBSD: if_pppx.c,v 1.128 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org> * Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_sec.c,v 1.7 2023/08/15 09:46:30 dlg Exp $ */ /* $OpenBSD: if_sec.c,v 1.9 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2022 The University of Queensland * Copyright (c) 2022 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_tpmr.c,v 1.33 2023/05/16 14:32:54 jan Exp $ */ /* $OpenBSD: if_tpmr.c,v 1.35 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2019 The University of Queensland * Copyright (c) 2019 The University of Queensland

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_trunk.c,v 1.152 2021/08/02 21:10:55 mvs Exp $ */ /* $OpenBSD: if_trunk.c,v 1.154 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_tun.c,v 1.238 2023/02/10 14:39:18 visa Exp $ */ /* $OpenBSD: if_tun.c,v 1.240 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_var.h,v 1.130 2023/11/11 14:24:03 bluhm Exp $ */ /* $OpenBSD: if_var.h,v 1.132 2023/12/23 10:52:54 bluhm Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/* /*

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_veb.c,v 1.32 2023/11/23 23:45:10 dlg Exp $ */ /* $OpenBSD: if_veb.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org> * Copyright (c) 2021 David Gwynne <dlg@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vlan.c,v 1.216 2023/10/27 20:56:47 jan Exp $ */ /* $OpenBSD: if_vlan.c,v 1.218 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright 1998 Massachusetts Institute of Technology * Copyright 1998 Massachusetts Institute of Technology

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_vxlan.c,v 1.97 2023/11/29 18:46:37 denis Exp $ */ /* $OpenBSD: if_vxlan.c,v 1.99 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2021 David Gwynne <dlg@openbsd.org> * Copyright (c) 2021 David Gwynne <dlg@openbsd.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_wg.c,v 1.32 2023/10/23 10:22:05 mvs Exp $ */ /* $OpenBSD: if_wg.c,v 1.34 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. * Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_carp.c,v 1.358 2023/09/16 09:33:27 mpi Exp $ */ /* $OpenBSD: ip_carp.c,v 1.360 2023/12/23 10:52:54 bluhm Exp $ */
/* /*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved. * Copyright (c) 2002 Michael Shalayeff. All rights reserved.

View file

@ -1,4 +1,4 @@
/* $OpenBSD: xargs.c,v 1.36 2022/12/04 23:50:50 cheloha Exp $ */ /* $OpenBSD: xargs.c,v 1.38 2023/12/23 15:58:58 millert Exp $ */
/* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */ /* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */
/*- /*-
@ -296,8 +296,12 @@ arg2:
foundeof = *eofstr != '\0' && foundeof = *eofstr != '\0' &&
strcmp(argp, eofstr) == 0; strcmp(argp, eofstr) == 0;
/* Do not make empty args unless they are quoted */ /*
if ((argp != p || wasquoted) && !foundeof) { * Do not make empty args unless they are quoted or
* we are run as "find -0" and not at EOF.
*/
if (((zflag && ch != EOF) || argp != p || wasquoted) &&
!foundeof) {
*p++ = '\0'; *p++ = '\0';
*xp++ = argp; *xp++ = argp;
if (Iflag) { if (Iflag) {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: smtp_session.c,v 1.437 2023/11/03 13:38:28 op Exp $ */ /* $OpenBSD: smtp_session.c,v 1.438 2023/12/23 10:29:05 op Exp $ */
/* /*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>

View file

@ -1,4 +1,4 @@
/* $OpenBSD: snmpd.c,v 1.49 2023/12/21 12:43:31 martijn Exp $ */ /* $OpenBSD: snmpd.c,v 1.50 2023/12/22 13:04:30 martijn Exp $ */
/* /*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org> * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@ -192,6 +192,8 @@ main(int argc, char *argv[])
if (argc > 0) if (argc > 0)
usage(); usage();
log_setverbose(verbose);
if ((env = parse_config(conffile, flags)) == NULL) if ((env = parse_config(conffile, flags)) == NULL)
exit(1); exit(1);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: usm.c,v 1.29 2023/12/21 12:43:31 martijn Exp $ */ /* $OpenBSD: usm.c,v 1.30 2023/12/22 13:03:16 martijn Exp $ */
/* /*
* Copyright (c) 2012 GeNUA mbH * Copyright (c) 2012 GeNUA mbH
@ -208,8 +208,6 @@ usm_finduser(char *name)
int int
usm_checkuser(struct usmuser *up, const char **errp) usm_checkuser(struct usmuser *up, const char **errp)
{ {
char *auth = NULL, *priv = NULL;
if (up->uu_auth != AUTH_NONE && up->uu_authkey == NULL) { if (up->uu_auth != AUTH_NONE && up->uu_authkey == NULL) {
*errp = "missing auth passphrase"; *errp = "missing auth passphrase";
goto fail; goto fail;
@ -230,45 +228,26 @@ usm_checkuser(struct usmuser *up, const char **errp)
switch (up->uu_auth) { switch (up->uu_auth) {
case AUTH_NONE: case AUTH_NONE:
auth = "none";
break; break;
case AUTH_MD5: case AUTH_MD5:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "HMAC-MD5-96";
break;
case AUTH_SHA1: case AUTH_SHA1:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "HMAC-SHA1-96";
break;
case AUTH_SHA224: case AUTH_SHA224:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "usmHMAC128SHA224AuthProtocol";
case AUTH_SHA256: case AUTH_SHA256:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "usmHMAC192SHA256AuthProtocol";
case AUTH_SHA384: case AUTH_SHA384:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "usmHMAC256SHA384AuthProtocol";
case AUTH_SHA512: case AUTH_SHA512:
up->uu_seclevel |= SNMP_MSGFLAG_AUTH; up->uu_seclevel |= SNMP_MSGFLAG_AUTH;
auth = "usmHMAC384SHA512AuthProtocol"; break;
} }
switch (up->uu_priv) { switch (up->uu_priv) {
case PRIV_NONE: case PRIV_NONE:
priv = "none";
break; break;
case PRIV_DES: case PRIV_DES:
up->uu_seclevel |= SNMP_MSGFLAG_PRIV;
priv = "CBC-DES";
break;
case PRIV_AES: case PRIV_AES:
up->uu_seclevel |= SNMP_MSGFLAG_PRIV; up->uu_seclevel |= SNMP_MSGFLAG_PRIV;
priv = "CFB128-AES-128";
break; break;
} }
log_debug("user \"%s\" auth %s enc %s", up->uu_name, auth, priv);
return 0; return 0;
fail: fail: