sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-29 22:23:51 +00:00
parent 18b0c95b14
commit 708141b7a2
Signed by: purplerain
GPG Key ID: F42C07F07E2E35B7
21 changed files with 232 additions and 72 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ECDH_compute_key.3,v 1.2 2021/03/12 05:18:00 jsg Exp $ .\" $OpenBSD: ECDH_compute_key.3,v 1.3 2023/08/29 10:07:42 tb Exp $
.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
.\" .\"
.\" Permission to use, copy, modify, and distribute this software for any .\" Permission to use, copy, modify, and distribute this software for any
@ -13,7 +13,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: March 12 2021 $ .Dd $Mdocdate: August 29 2023 $
.Dt ECDH_COMPUTE_KEY 3 .Dt ECDH_COMPUTE_KEY 3
.Os .Os
.Sh NAME .Sh NAME
@ -21,7 +21,7 @@
.Nm ECDH_size .Nm ECDH_size
.Nd Elliptic Curve Diffie-Hellman key exchange .Nd Elliptic Curve Diffie-Hellman key exchange
.Sh SYNOPSIS .Sh SYNOPSIS
.In openssl/ecdh.h .In openssl/ec.h
.Ft int .Ft int
.Fo ECDH_compute_key .Fo ECDH_compute_key
.Fa "void *out" .Fa "void *out"

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: ECDSA_SIG_new.3,v 1.19 2023/07/21 04:44:40 tb Exp $ .\" $OpenBSD: ECDSA_SIG_new.3,v 1.20 2023/08/29 10:07:42 tb Exp $
.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
.\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100 .\" selective merge up to: OpenSSL da4ea0cf Aug 5 16:13:24 2019 +0100
.\" .\"
@ -50,7 +50,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: July 21 2023 $ .Dd $Mdocdate: August 29 2023 $
.Dt ECDSA_SIG_NEW 3 .Dt ECDSA_SIG_NEW 3
.Os .Os
.Sh NAME .Sh NAME
@ -69,7 +69,7 @@
.Nm ECDSA_do_verify .Nm ECDSA_do_verify
.Nd Elliptic Curve Digital Signature Algorithm .Nd Elliptic Curve Digital Signature Algorithm
.Sh SYNOPSIS .Sh SYNOPSIS
.In openssl/ecdsa.h .In openssl/ec.h
.Ft ECDSA_SIG* .Ft ECDSA_SIG*
.Fo ECDSA_SIG_new .Fo ECDSA_SIG_new
.Fa void .Fa void

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.2 2023/07/20 09:28:30 tb Exp $ .\" $OpenBSD: EC_KEY_METHOD_new.3,v 1.3 2023/08/29 10:07:42 tb Exp $
.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> .\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
.\" .\"
.\" Permission to use, copy, modify, and distribute this software for any .\" Permission to use, copy, modify, and distribute this software for any
@ -13,7 +13,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: July 20 2023 $ .Dd $Mdocdate: August 29 2023 $
.Dt EC_KEY_METHOD_NEW 3 .Dt EC_KEY_METHOD_NEW 3
.Os .Os
.Sh NAME .Sh NAME
@ -66,7 +66,6 @@
.Fa "int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key)" .Fa "int (**pset_private)(EC_KEY *key, const BIGNUM *priv_key)"
.Fa "int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key)" .Fa "int (**pset_public)(EC_KEY *key, const EC_POINT *pub_key)"
.Fc .Fc
.In openssl/ecdsa.h
.Ft void .Ft void
.Fo EC_KEY_METHOD_set_sign .Fo EC_KEY_METHOD_set_sign
.Fa "EC_KEY_METHOD *meth" .Fa "EC_KEY_METHOD *meth"
@ -105,7 +104,6 @@
.Fa "int (**pverify_sig)(const unsigned char *dgst, int dgst_len,\ .Fa "int (**pverify_sig)(const unsigned char *dgst, int dgst_len,\
const ECDSA_SIG *sig, EC_KEY *eckey)" const ECDSA_SIG *sig, EC_KEY *eckey)"
.Fc .Fc
.In openssl/ec.h
.Ft void .Ft void
.Fo EC_KEY_METHOD_set_keygen .Fo EC_KEY_METHOD_set_keygen
.Fa "EC_KEY_METHOD *meth" .Fa "EC_KEY_METHOD *meth"

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: EC_KEY_new.3,v 1.17 2023/04/27 09:49:44 tb Exp $ .\" $OpenBSD: EC_KEY_new.3,v 1.18 2023/08/29 10:07:42 tb Exp $
.\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500 .\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500
.\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 .\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
.\" .\"
@ -49,7 +49,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: April 27 2023 $ .Dd $Mdocdate: August 29 2023 $
.Dt EC_KEY_NEW 3 .Dt EC_KEY_NEW 3
.Os .Os
.Sh NAME .Sh NAME
@ -387,10 +387,8 @@ The currently defined standard flags are
.Dv EC_FLAG_NON_FIPS_ALLOW .Dv EC_FLAG_NON_FIPS_ALLOW
and and
.Dv EC_FLAG_FIPS_CHECKED . .Dv EC_FLAG_FIPS_CHECKED .
In addition there is the flag In addition there is the ECDH-specific flag
.Dv EC_FLAG_COFACTOR_ECDH .Dv EC_FLAG_COFACTOR_ECDH .
which is specific to ECDH and is defined in
.In openssl/ecdh.h .
.Fn EC_KEY_get_flags .Fn EC_KEY_get_flags
returns the current flags that are set for this returns the current flags that are set for this
.Vt EC_KEY . .Vt EC_KEY .

View File

@ -1,4 +1,4 @@
// $OpenBSD: utils_unittest.cc,v 1.4 2022/11/10 14:51:01 kn Exp $ // $OpenBSD: utils_unittest.cc,v 1.5 2023/08/29 07:54:01 yasuoka Exp $
// //
// Copyright 2020 The Chromium Authors. All rights reserved. // Copyright 2020 The Chromium Authors. All rights reserved.
// //
@ -29,6 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstddef> #include <cstddef>
#include <cstdio>
#include <vector> #include <vector>
#include <assert.h> #include <assert.h>

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: dwiic.4,v 1.5 2023/04/23 00:44:44 dlg Exp $ .\" $OpenBSD: dwiic.4,v 1.6 2023/08/29 12:11:08 kettenis Exp $
.\" .\"
.\" Copyright (c) 2016 Jonathan Gray <jsg@openbsd.org> .\" Copyright (c) 2016 Jonathan Gray <jsg@openbsd.org>
.\" .\"
@ -14,7 +14,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: April 23 2023 $ .Dd $Mdocdate: August 29 2023 $
.Dt DWIIC 4 .Dt DWIIC 4
.Os .Os
.Sh NAME .Sh NAME
@ -22,6 +22,7 @@
.Nd Synopsys DesignWare I2C controller .Nd Synopsys DesignWare I2C controller
.Sh SYNOPSIS .Sh SYNOPSIS
.Cd "dwiic* at acpi?" .Cd "dwiic* at acpi?"
.Cd "dwiic* at fdt?"
.Cd "dwiic* at pci?" .Cd "dwiic* at pci?"
.Cd "iic* at dwiic?" .Cd "iic* at dwiic?"
.Sh DESCRIPTION .Sh DESCRIPTION

168
sys/dev/fdt/dwiic_fdt.c Normal file
View File

@ -0,0 +1,168 @@
/* $OpenBSD: dwiic_fdt.c,v 1.1 2023/08/29 12:09:40 kettenis Exp $ */
/*
* Copyright (c) 2023 Patrick Wildt <patrick@blueri.se>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/device.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <machine/bus.h>
#include <machine/fdt.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_clock.h>
#include <dev/ofw/ofw_pinctrl.h>
#include <dev/ofw/fdt.h>
#include <dev/ic/dwiicvar.h>
static inline uint32_t
round_closest(uint64_t num, uint64_t den)
{
return (num + (den / 2)) / den;
}
struct dwiic_fdt_softc {
struct dwiic_softc sc_sc;
int sc_node;
};
int dwiic_fdt_match(struct device *, void *, void *);
void dwiic_fdt_attach(struct device *, struct device *, void *);
const struct cfattach dwiic_fdt_ca = {
sizeof(struct dwiic_fdt_softc), dwiic_fdt_match, dwiic_fdt_attach
};
void dwiic_fdt_bus_scan(struct device *, struct i2cbus_attach_args *,
void *);
int
dwiic_fdt_match(struct device *parent, void *match, void *aux)
{
struct fdt_attach_args *faa = aux;
return OF_is_compatible(faa->fa_node, "snps,designware-i2c");
}
void
dwiic_fdt_attach(struct device *parent, struct device *self, void *aux)
{
struct dwiic_fdt_softc *fsc = (struct dwiic_fdt_softc *)self;
struct dwiic_softc *sc = &fsc->sc_sc;
struct fdt_attach_args *faa = aux;
struct i2cbus_attach_args iba;
uint32_t sda_hold, sda_fall, scl_fall;
uint64_t freq;
if (faa->fa_nreg < 1)
return;
sc->sc_iot = faa->fa_iot;
fsc->sc_node = faa->fa_node;
if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
printf(": can't map registers\n");
return;
}
pinctrl_byname(faa->fa_node, "default");
reset_deassert_all(faa->fa_node);
clock_enable(faa->fa_node, NULL);
freq = clock_get_frequency(faa->fa_node, NULL);
sda_hold = OF_getpropint(faa->fa_node, "i2c-sda-hold-time-ns", 300);
sda_fall = OF_getpropint(faa->fa_node, "i2c-sda-falling-time-ns", 300);
scl_fall = OF_getpropint(faa->fa_node, "i2c-scl-falling-time-ns", 300);
sc->sda_hold_time = round_closest(freq * sda_hold, 1000000000);
/* Standard-mode: tHIGH = 4.0 us; tLOW = 4.7 us */
sc->ss_hcnt = round_closest(freq * (4000 + sda_fall), 1000000000) - 3;
sc->ss_lcnt = round_closest(freq * (4700 + scl_fall), 1000000000) - 1;
/* Fast-mode: tHIGH = 0.6 us; tLOW = 1.3 us */
sc->fs_hcnt = round_closest(freq * (600 + sda_fall), 1000000000) - 3;
sc->fs_lcnt = round_closest(freq * (1300 + scl_fall), 1000000000) - 1;
if (dwiic_init(sc)) {
printf(": can't initialize\n");
bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size);
return;
}
/* leave the controller disabled */
dwiic_write(sc, DW_IC_INTR_MASK, 0);
dwiic_enable(sc, 0);
dwiic_read(sc, DW_IC_CLR_INTR);
sc->sc_ih = fdt_intr_establish(faa->fa_node, IPL_BIO,
dwiic_intr, sc, sc->sc_dev.dv_xname);
printf("\n");
rw_init(&sc->sc_i2c_lock, "dwiic");
sc->sc_i2c_tag.ic_cookie = sc;
sc->sc_i2c_tag.ic_acquire_bus = dwiic_i2c_acquire_bus;
sc->sc_i2c_tag.ic_release_bus = dwiic_i2c_release_bus;
sc->sc_i2c_tag.ic_exec = dwiic_i2c_exec;
bzero(&iba, sizeof iba);
iba.iba_name = "iic";
iba.iba_tag = &sc->sc_i2c_tag;
iba.iba_bus_scan = dwiic_fdt_bus_scan;
iba.iba_bus_scan_arg = &fsc->sc_node;
config_found(&sc->sc_dev, &iba, iicbus_print);
}
void
dwiic_fdt_bus_scan(struct device *self, struct i2cbus_attach_args *iba,
void *aux)
{
int iba_node = *(int *)aux;
extern int iic_print(void *, const char *);
struct i2c_attach_args ia;
char name[32], status[32];
uint32_t reg[1];
int node;
for (node = OF_child(iba_node); node; node = OF_peer(node)) {
memset(name, 0, sizeof(name));
memset(status, 0, sizeof(status));
memset(reg, 0, sizeof(reg));
if (OF_getprop(node, "compatible", name, sizeof(name)) == -1)
continue;
if (name[0] == '\0')
continue;
if (OF_getprop(node, "status", status, sizeof(status)) > 0 &&
strcmp(status, "disabled") == 0)
continue;
if (OF_getprop(node, "reg", &reg, sizeof(reg)) != sizeof(reg))
continue;
memset(&ia, 0, sizeof(ia));
ia.ia_tag = iba->iba_tag;
ia.ia_addr = bemtoh32(&reg[0]);
ia.ia_name = name;
ia.ia_cookie = &node;
config_found(self, &ia, iic_print);
}
}

View File

@ -1,4 +1,4 @@
# $OpenBSD: files.fdt,v 1.197 2023/07/31 09:00:43 kettenis Exp $ # $OpenBSD: files.fdt,v 1.198 2023/08/29 12:09:40 kettenis Exp $
# #
# Config file and device description for machine-independent FDT code. # Config file and device description for machine-independent FDT code.
# Included by ports that need it. # Included by ports that need it.
@ -422,6 +422,9 @@ device rkvop
attach rkvop at fdt attach rkvop at fdt
file dev/fdt/rkvop.c rkvop file dev/fdt/rkvop.c rkvop
attach dwiic at fdt with dwiic_fdt
file dev/fdt/dwiic_fdt.c dwiic_fdt
device dwmmc: sdmmcbus device dwmmc: sdmmcbus
attach dwmmc at fdt attach dwmmc at fdt
file dev/fdt/dwmmc.c dwmmc file dev/fdt/dwmmc.c dwmmc

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dwiic.c,v 1.14 2022/01/09 05:42:38 jsg Exp $ */ /* $OpenBSD: dwiic.c,v 1.15 2023/08/29 12:09:40 kettenis Exp $ */
/* /*
* Synopsys DesignWare I2C controller * Synopsys DesignWare I2C controller
* *
@ -21,11 +21,13 @@
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#ifdef __HAVE_ACPI
#include <dev/acpi/acpireg.h> #include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h> #include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h> #include <dev/acpi/acpidev.h>
#include <dev/acpi/amltypes.h> #include <dev/acpi/amltypes.h>
#include <dev/acpi/dsdt.h> #include <dev/acpi/dsdt.h>
#endif
#include <dev/i2c/i2cvar.h> #include <dev/i2c/i2cvar.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: dwiicvar.h,v 1.5 2022/08/31 15:14:01 kettenis Exp $ */ /* $OpenBSD: dwiicvar.h,v 1.6 2023/08/29 12:09:40 kettenis Exp $ */
/* /*
* Synopsys DesignWare I2C controller * Synopsys DesignWare I2C controller
* *
@ -21,11 +21,14 @@
#include <sys/systm.h> #include <sys/systm.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#ifdef __HAVE_ACPI
#include "acpi.h"
#include <dev/acpi/acpireg.h> #include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h> #include <dev/acpi/acpivar.h>
#include <dev/acpi/acpidev.h> #include <dev/acpi/acpidev.h>
#include <dev/acpi/amltypes.h> #include <dev/acpi/amltypes.h>
#include <dev/acpi/dsdt.h> #include <dev/acpi/dsdt.h>
#endif
#include <dev/pci/pcivar.h> #include <dev/pci/pcivar.h>
@ -33,8 +36,6 @@
#include <dev/ic/dwiicreg.h> #include <dev/ic/dwiicreg.h>
#include "acpi.h"
/* #define DWIIC_DEBUG */ /* #define DWIIC_DEBUG */
#ifdef DWIIC_DEBUG #ifdef DWIIC_DEBUG

View File

@ -1,4 +1,4 @@
/* $OpenBSD: init_main.c,v 1.321 2023/06/15 22:18:06 cheloha Exp $ */ /* $OpenBSD: init_main.c,v 1.322 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/* /*
@ -482,16 +482,12 @@ main(void *framep)
/* /*
* Now can look at time, having had a chance to verify the time * Now can look at time, having had a chance to verify the time
* from the file system. Reset p->p_rtime as it may have been * from the file system.
* munched in mi_switch() after the time got set.
*/ */
LIST_FOREACH(pr, &allprocess, ps_list) { LIST_FOREACH(pr, &allprocess, ps_list) {
nanouptime(&pr->ps_start); nanouptime(&pr->ps_start);
TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) {
nanouptime(&p->p_cpu->ci_schedstate.spc_runtime);
timespecclear(&p->p_rtime);
}
} }
nanouptime(&curcpu()->ci_schedstate.spc_runtime);
uvm_swap_init(); uvm_swap_init();

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_exit.c,v 1.211 2023/04/25 18:14:06 claudio Exp $ */ /* $OpenBSD: kern_exit.c,v 1.212 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/* /*
@ -118,6 +118,7 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
{ {
struct process *pr, *qr, *nqr; struct process *pr, *qr, *nqr;
struct rusage *rup; struct rusage *rup;
struct timespec ts;
int s; int s;
atomic_setbits_int(&p->p_flag, P_WEXIT); atomic_setbits_int(&p->p_flag, P_WEXIT);
@ -298,7 +299,14 @@ exit1(struct proc *p, int xexit, int xsig, int flags)
/* add thread's accumulated rusage into the process's total */ /* add thread's accumulated rusage into the process's total */
ruadd(rup, &p->p_ru); ruadd(rup, &p->p_ru);
tuagg(pr, p); nanouptime(&ts);
if (timespeccmp(&ts, &curcpu()->ci_schedstate.spc_runtime, <))
timespecclear(&ts);
else
timespecsub(&ts, &curcpu()->ci_schedstate.spc_runtime, &ts);
SCHED_LOCK(s);
tuagg_locked(pr, p, &ts);
SCHED_UNLOCK(s);
/* /*
* clear %cpu usage during swap * clear %cpu usage during swap

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_resource.c,v 1.77 2023/02/04 19:33:03 cheloha Exp $ */ /* $OpenBSD: kern_resource.c,v 1.78 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */
/*- /*-
@ -64,7 +64,7 @@ struct plimit *lim_copy(struct plimit *);
struct plimit *lim_write_begin(void); struct plimit *lim_write_begin(void);
void lim_write_commit(struct plimit *); void lim_write_commit(struct plimit *);
void tuagg_sub(struct tusage *, struct proc *); void tuagg_sub(struct tusage *, struct proc *, const struct timespec *);
/* /*
* Patchable maximum data and stack limits. * Patchable maximum data and stack limits.
@ -368,9 +368,10 @@ sys_getrlimit(struct proc *p, void *v, register_t *retval)
} }
void void
tuagg_sub(struct tusage *tup, struct proc *p) tuagg_sub(struct tusage *tup, struct proc *p, const struct timespec *ts)
{ {
timespecadd(&tup->tu_runtime, &p->p_rtime, &tup->tu_runtime); if (ts != NULL)
timespecadd(&tup->tu_runtime, ts, &tup->tu_runtime);
tup->tu_uticks += p->p_uticks; tup->tu_uticks += p->p_uticks;
tup->tu_sticks += p->p_sticks; tup->tu_sticks += p->p_sticks;
tup->tu_iticks += p->p_iticks; tup->tu_iticks += p->p_iticks;
@ -381,11 +382,10 @@ tuagg_sub(struct tusage *tup, struct proc *p)
* totals for the thread and process * totals for the thread and process
*/ */
void void
tuagg_unlocked(struct process *pr, struct proc *p) tuagg_locked(struct process *pr, struct proc *p, const struct timespec *ts)
{ {
tuagg_sub(&pr->ps_tu, p); tuagg_sub(&pr->ps_tu, p, ts);
tuagg_sub(&p->p_tu, p); tuagg_sub(&p->p_tu, p, ts);
timespecclear(&p->p_rtime);
p->p_uticks = 0; p->p_uticks = 0;
p->p_sticks = 0; p->p_sticks = 0;
p->p_iticks = 0; p->p_iticks = 0;
@ -397,7 +397,7 @@ tuagg(struct process *pr, struct proc *p)
int s; int s;
SCHED_LOCK(s); SCHED_LOCK(s);
tuagg_unlocked(pr, p); tuagg_locked(pr, p, NULL);
SCHED_UNLOCK(s); SCHED_UNLOCK(s);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sched.c,v 1.86 2023/08/14 08:33:24 mpi Exp $ */ /* $OpenBSD: kern_sched.c,v 1.87 2023/08/29 16:19:34 claudio Exp $ */
/* /*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
* *
@ -230,14 +230,9 @@ void
sched_exit(struct proc *p) sched_exit(struct proc *p)
{ {
struct schedstate_percpu *spc = &curcpu()->ci_schedstate; struct schedstate_percpu *spc = &curcpu()->ci_schedstate;
struct timespec ts;
struct proc *idle; struct proc *idle;
int s; int s;
nanouptime(&ts);
timespecsub(&ts, &spc->spc_runtime, &ts);
timespecadd(&p->p_rtime, &ts, &p->p_rtime);
if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) { if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) {
atomic_clearbits_int(&spc->spc_schedflags, SPCF_ITIMER); atomic_clearbits_int(&spc->spc_schedflags, SPCF_ITIMER);
clockintr_cancel(spc->spc_itimer); clockintr_cancel(spc->spc_itimer);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_time.c,v 1.164 2023/08/05 20:07:55 cheloha Exp $ */ /* $OpenBSD: kern_time.c,v 1.165 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/* /*
@ -130,13 +130,11 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
nanouptime(tp); nanouptime(tp);
timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp); timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp);
timespecadd(tp, &p->p_p->ps_tu.tu_runtime, tp); timespecadd(tp, &p->p_p->ps_tu.tu_runtime, tp);
timespecadd(tp, &p->p_rtime, tp);
break; break;
case CLOCK_THREAD_CPUTIME_ID: case CLOCK_THREAD_CPUTIME_ID:
nanouptime(tp); nanouptime(tp);
timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp); timespecsub(tp, &curcpu()->ci_schedstate.spc_runtime, tp);
timespecadd(tp, &p->p_tu.tu_runtime, tp); timespecadd(tp, &p->p_tu.tu_runtime, tp);
timespecadd(tp, &p->p_rtime, tp);
break; break;
default: default:
/* check for clock from pthread_getcpuclockid() */ /* check for clock from pthread_getcpuclockid() */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sched_bsd.c,v 1.83 2023/08/19 11:14:11 claudio Exp $ */ /* $OpenBSD: sched_bsd.c,v 1.84 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*- /*-
@ -385,13 +385,13 @@ mi_switch(void)
(long long)spc->spc_runtime.tv_sec, (long long)spc->spc_runtime.tv_sec,
spc->spc_runtime.tv_nsec); spc->spc_runtime.tv_nsec);
#endif #endif
timespecclear(&ts);
} else { } else {
timespecsub(&ts, &spc->spc_runtime, &ts); timespecsub(&ts, &spc->spc_runtime, &ts);
timespecadd(&p->p_rtime, &ts, &p->p_rtime);
} }
/* add the time counts for this thread to the process's total */ /* add the time counts for this thread to the process's total */
tuagg_unlocked(pr, p); tuagg_locked(pr, p, &ts);
/* Stop any optional clock interrupts. */ /* Stop any optional clock interrupts. */
if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) { if (ISSET(spc->spc_schedflags, SPCF_ITIMER)) {

View File

@ -1,4 +1,4 @@
/* $OpenBSD: proc.h,v 1.347 2023/08/05 20:07:56 cheloha Exp $ */ /* $OpenBSD: proc.h,v 1.348 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*- /*-
@ -354,7 +354,6 @@ struct proc {
struct rusage p_ru; /* Statistics */ struct rusage p_ru; /* Statistics */
struct tusage p_tu; /* accumulated times. */ struct tusage p_tu; /* accumulated times. */
struct timespec p_rtime; /* Real time. */
struct plimit *p_limit; /* [l] read ref. of p_p->ps_limit */ struct plimit *p_limit; /* [l] read ref. of p_p->ps_limit */
struct kcov_dev *p_kd; /* kcov device handle */ struct kcov_dev *p_kd; /* kcov device handle */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: resourcevar.h,v 1.27 2023/07/25 18:16:19 cheloha Exp $ */ /* $OpenBSD: resourcevar.h,v 1.28 2023/08/29 16:19:34 claudio Exp $ */
/* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */ /* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */
/* /*
@ -67,7 +67,7 @@ extern uint32_t profclock_period;
void addupc_intr(struct proc *, u_long, u_long); void addupc_intr(struct proc *, u_long, u_long);
void addupc_task(struct proc *, u_long, u_int); void addupc_task(struct proc *, u_long, u_int);
void profclock(struct clockintr *, void *); void profclock(struct clockintr *, void *);
void tuagg_unlocked(struct process *, struct proc *); void tuagg_locked(struct process *, struct proc *, const struct timespec *);
void tuagg(struct process *, struct proc *); void tuagg(struct process *, struct proc *);
struct tusage; struct tusage;
void calctsru(struct tusage *, struct timespec *, struct timespec *, void calctsru(struct tusage *, struct timespec *, struct timespec *,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: servconf.c,v 1.396 2023/07/17 05:26:38 djm Exp $ */ /* $OpenBSD: servconf.c,v 1.397 2023/08/29 02:50:10 djm Exp $ */
/* /*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved * All rights reserved
@ -1973,7 +1973,7 @@ process_server_config_line_depth(ServerOptions *options, char *line,
fatal("%s line %d: %s integer value %s.", fatal("%s line %d: %s integer value %s.",
filename, linenum, keyword, errstr); filename, linenum, keyword, errstr);
} }
if (*activep) if (*activep && options->per_source_max_startups == -1)
options->per_source_max_startups = value; options->per_source_max_startups = value;
break; break;

View File

@ -1,4 +1,4 @@
/* $Id: acctproc.c,v 1.31 2022/12/19 11:16:52 tb Exp $ */ /* $Id: acctproc.c,v 1.32 2023/08/29 14:44:53 op Exp $ */
/* /*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
* *
@ -27,7 +27,6 @@
#include <openssl/bn.h> #include <openssl/bn.h>
#include <openssl/ec.h> #include <openssl/ec.h>
#include <openssl/ecdsa.h>
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
#include <openssl/err.h> #include <openssl/err.h>

View File

@ -1,4 +1,4 @@
/* $Id: key.c,v 1.7 2022/12/18 12:08:49 tb Exp $ */ /* $Id: key.c,v 1.8 2023/08/29 14:44:53 op Exp $ */
/* /*
* Copyright (c) 2019 Renaud Allard <renaud@allard.it> * Copyright (c) 2019 Renaud Allard <renaud@allard.it>
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
@ -23,7 +23,6 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/rsa.h> #include <openssl/rsa.h>
#include <openssl/ecdsa.h>
#include <openssl/ec.h> #include <openssl/ec.h>
#include <openssl/obj_mac.h> #include <openssl/obj_mac.h>
@ -80,7 +79,7 @@ ec_key_create(FILE *f, const char *fname)
EC_KEY *eckey = NULL; EC_KEY *eckey = NULL;
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
if ((eckey = EC_KEY_new_by_curve_name(NID_secp384r1)) == NULL ) { if ((eckey = EC_KEY_new_by_curve_name(NID_secp384r1)) == NULL) {
warnx("EC_KEY_new_by_curve_name"); warnx("EC_KEY_new_by_curve_name");
goto err; goto err;
} }
@ -90,10 +89,6 @@ ec_key_create(FILE *f, const char *fname)
goto err; goto err;
} }
/* set OPENSSL_EC_NAMED_CURVE to be able to load the key */
EC_KEY_set_asn1_flag(eckey, OPENSSL_EC_NAMED_CURVE);
/* Serialise the key to the disc in EC format */ /* Serialise the key to the disc in EC format */
if (!PEM_write_ECPrivateKey(f, eckey, NULL, NULL, 0, NULL, NULL)) { if (!PEM_write_ECPrivateKey(f, eckey, NULL, NULL, 0, NULL, NULL)) {
@ -108,7 +103,7 @@ ec_key_create(FILE *f, const char *fname)
goto err; goto err;
} }
if (!EVP_PKEY_set1_EC_KEY(pkey, eckey)) { if (!EVP_PKEY_set1_EC_KEY(pkey, eckey)) {
warnx("EVP_PKEY_assign_EC_KEY"); warnx("EVP_PKEY_set1_EC_KEY");
goto err; goto err;
} }
@ -122,8 +117,6 @@ out:
return pkey; return pkey;
} }
EVP_PKEY * EVP_PKEY *
key_load(FILE *f, const char *fname) key_load(FILE *f, const char *fname)
{ {