sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
691f97cc10
commit
371ae113c6
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: tar.1,v 1.64 2022/03/31 17:27:14 naddy Exp $
|
||||
.\" $OpenBSD: tar.1,v 1.65 2023/08/03 18:17:54 aisha Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996 SigmaSoft, Th. Lockert
|
||||
.\" All rights reserved.
|
||||
@ -23,7 +23,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: March 31 2022 $
|
||||
.Dd $Mdocdate: August 3 2023 $
|
||||
.Dt TAR 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -331,16 +331,16 @@ and
|
||||
.Pp
|
||||
.Dl $ tar c bonvole sekve
|
||||
.Pp
|
||||
Output a
|
||||
Create a
|
||||
.Xr gzip 1
|
||||
compressed archive containing the files
|
||||
compressed archive, called
|
||||
.Pa foriru.tar.gz ,
|
||||
containing the files
|
||||
.Pa bonvole
|
||||
and
|
||||
.Pa sekve
|
||||
to a file called
|
||||
.Pa foriru.tar.gz :
|
||||
.Pa sekve :
|
||||
.Pp
|
||||
.Dl $ tar zcf foriru.tar.gz bonvole sekve
|
||||
.Dl $ tar czf foriru.tar.gz bonvole sekve
|
||||
.Pp
|
||||
Verbosely create an archive, called
|
||||
.Pa backup.tar.gz ,
|
||||
@ -349,7 +349,7 @@ of all files matching the shell
|
||||
function
|
||||
.Pa *.c :
|
||||
.Pp
|
||||
.Dl $ tar zcvf backup.tar.gz *.c
|
||||
.Dl $ tar cvzf backup.tar.gz *.c
|
||||
.Pp
|
||||
Verbosely list, but do not extract, all files ending in
|
||||
.Pa .jpeg
|
||||
@ -359,6 +359,13 @@ Note that the glob pattern has been quoted to avoid expansion by the shell:
|
||||
.Pp
|
||||
.Dl $ tar tvzf backup.tar.gz '*.jpeg'
|
||||
.Pp
|
||||
Verbosely extract an archive, called
|
||||
.Pa foo.tar.gz ,
|
||||
to the directory
|
||||
.Pa /var/foo :
|
||||
.Pp
|
||||
.Dl $ tar xvzf foo.tar.gz -C /var/foo
|
||||
.Pp
|
||||
For more detailed examples, see
|
||||
.Xr pax 1 .
|
||||
.Sh DIAGNOSTICS
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/ksh
|
||||
# $OpenBSD: install.sub,v 1.1251 2023/07/08 15:01:09 kn Exp $
|
||||
# $OpenBSD: install.sub,v 1.1252 2023/08/02 08:51:16 kn Exp $
|
||||
#
|
||||
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
|
||||
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
|
||||
@ -1643,7 +1643,7 @@ install_files() {
|
||||
|
||||
if [[ -z $_sets ]]; then
|
||||
echo -n "Looked at $_src "
|
||||
echo "and found no $OBSD sets. The set names looked for were:"
|
||||
echo "and found no $SBSD sets. The set names looked for were:"
|
||||
|
||||
let COLUMNS=_col-8
|
||||
for _n in $ALLSETS; do echo $_n; done | show_cols | sed 's/^/ /'
|
||||
@ -3091,7 +3091,7 @@ encrypt_root() {
|
||||
# e.g. auto-assembled at boot or done in (S)hell.
|
||||
[[ -z $(get_softraid_volumes) ]] || return
|
||||
|
||||
ask_yn 'Encrypt the root disk? (passphrase CRYPTO softraid)' || return
|
||||
ask_yn 'Encrypt the root disk with a passphrase?' || return
|
||||
|
||||
_chunk=$ROOTDISK
|
||||
echo "\nConfiguring the crypto chunk $_chunk...\n"
|
||||
|
@ -1,9 +1,9 @@
|
||||
dnl $OpenBSD: hardware,v 1.19 2022/09/07 10:30:03 jsg Exp $
|
||||
dnl $OpenBSD: hardware,v 1.20 2023/08/04 10:29:09 fcambus Exp $
|
||||
The following machines are targeted by SecBSD/MACHINE:
|
||||
|
||||
Allwinner A64/H5/H6
|
||||
Pine64 Pine 64/64+
|
||||
Pine64 Pine H64
|
||||
Pine64 H64
|
||||
Pine64 Pinebook
|
||||
NanoPi A64
|
||||
Orange Pi PC2
|
||||
@ -13,6 +13,7 @@ The following machines are targeted by SecBSD/MACHINE:
|
||||
SoftIron OverDrive 1000
|
||||
SoftIron OverDrive 3000
|
||||
Amlogic G12B/SM1
|
||||
Banana Pi BPI-M5
|
||||
Hardkernel ODROID-N2
|
||||
Hardkernel ODROID-C4
|
||||
Hardkernel ODROID-HC4
|
||||
@ -45,6 +46,8 @@ The following machines are targeted by SecBSD/MACHINE:
|
||||
GL.iNet Brume
|
||||
Marvell ARMADA 7K/8K
|
||||
SolidRun/Marvell MACCHIATObin
|
||||
Qualcomm Snapdragon 7cx (SC7180/SC7180P)
|
||||
Acer Aspire One
|
||||
Qualcomm Snapdragon 8cx Gen 3 (SC8280XP)
|
||||
Lenovo ThinkPad X13s Gen 1
|
||||
Rockchip RK3328/RK3399(pro)
|
||||
@ -55,5 +58,10 @@ The following machines are targeted by SecBSD/MACHINE:
|
||||
FriendlyElec NanoPC-T4
|
||||
Theobroma Systems RK3399-Q7
|
||||
Radxa Rock Pi N10
|
||||
Rockchip RK3566/RK3568
|
||||
Pine64 Quartz64 Model A
|
||||
Pine64 Quartz64 Model B
|
||||
ROC-RK3566-PC
|
||||
NanoPi R5S
|
||||
Socionext SC2A11
|
||||
Socionext SynQuacer-E Developerbox
|
||||
|
@ -1,6 +1,6 @@
|
||||
From purplerain@secbsd.org Wed Jul 26 00:00:00 UTC 2023
|
||||
From purplerain@secbsd.org Tue Aug 8 00:00:00 UTC 2023
|
||||
Return-Path: root
|
||||
Date: Jul 26 00:00:00 UTC 2023
|
||||
Date: Aug 8 00:00:00 UTC 2023
|
||||
From: purplerain@secbsd.org (Purple Rain)
|
||||
To: root
|
||||
Subject: Welcome to SecBSD 1.3!
|
||||
|
@ -1 +1 @@
|
||||
# SecBSD 1.3-6971d2f: Thu Jul 27 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
# SecBSD 1.3-637dfdf: Tue Aug 8 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: ualarm.3,v 1.17 2019/07/26 12:08:18 millert Exp $
|
||||
.\" $OpenBSD: ualarm.3,v 1.18 2023/08/01 01:17:25 cheloha Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1986, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -27,12 +27,12 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 26 2019 $
|
||||
.Dd $Mdocdate: August 1 2023 $
|
||||
.Dt UALARM 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ualarm
|
||||
.Nd schedule signal after specified time
|
||||
.Nd schedule high resolution SIGALRM delivery
|
||||
.Sh SYNOPSIS
|
||||
.In unistd.h
|
||||
.Ft useconds_t
|
||||
@ -45,31 +45,37 @@ This is a simplified interface to
|
||||
.Pp
|
||||
The
|
||||
.Fn ualarm
|
||||
function waits a count of
|
||||
.Fa microseconds
|
||||
before asserting the terminating signal
|
||||
.Dv SIGALRM .
|
||||
System activity or time used in processing the call may cause a slight
|
||||
delay.
|
||||
.Pp
|
||||
If the
|
||||
.Fa interval
|
||||
argument is non-zero, the
|
||||
function schedules the
|
||||
.Dv SIGALRM
|
||||
signal will be sent
|
||||
to the process every
|
||||
signal for delivery to the calling process after at least the given number of
|
||||
.Fa microseconds
|
||||
have elapsed.
|
||||
If
|
||||
.Fa interval
|
||||
microseconds after the timer expires (e.g., after
|
||||
.Fa microseconds
|
||||
number of microseconds have passed).
|
||||
.Sh RETURN VALUES
|
||||
When the signal has successfully been caught,
|
||||
is non-zero,
|
||||
the
|
||||
.Dv SIGALRM
|
||||
signal is scheduled for redelivery to the calling process every
|
||||
.Fa interval
|
||||
microseconds thereafter.
|
||||
.Pp
|
||||
If an alarm is already pending,
|
||||
an additional call to
|
||||
.Fn ualarm
|
||||
returns the amount of time left on the clock.
|
||||
The maximum value for
|
||||
supersedes the prior call.
|
||||
.Pp
|
||||
If
|
||||
.Fa microseconds
|
||||
allowed
|
||||
is 2147483647.
|
||||
is zero,
|
||||
any pending alarm is cancelled and the value of
|
||||
.Fa interval
|
||||
is ignored.
|
||||
.Sh RETURN VALUES
|
||||
The
|
||||
.Fn ualarm
|
||||
function returns the number of microseconds remaining until the next
|
||||
alarm is scheduled for delivery,
|
||||
or zero if no alarm is pending.
|
||||
.Sh SEE ALSO
|
||||
.Xr setitimer 2 ,
|
||||
.Xr sigaction 2 ,
|
||||
@ -86,5 +92,17 @@ function conforms to
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Fn ualarm
|
||||
function appeared in
|
||||
function first appeared in
|
||||
.Bx 4.3 .
|
||||
.Sh CAVEATS
|
||||
The
|
||||
.Fn ualarm
|
||||
function is implemented with the per-process
|
||||
.Dv ITIMER_REAL
|
||||
timer described in
|
||||
.Xr setitimer 2 .
|
||||
Use of both
|
||||
.Fn ualarm
|
||||
and
|
||||
.Xr setitimer 2
|
||||
in the same program may yield confusing behavior.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: aes.h,v 1.14 2014/07/09 09:10:07 miod Exp $ */
|
||||
/* $OpenBSD: aes.h,v 1.15 2023/07/31 05:04:06 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
@ -79,8 +79,6 @@ struct aes_key_st {
|
||||
};
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
|
||||
const char *AES_options(void);
|
||||
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: blowfish.h,v 1.16 2022/11/11 12:08:29 jsing Exp $ */
|
||||
/* $OpenBSD: blowfish.h,v 1.17 2023/07/31 05:04:06 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -102,7 +102,6 @@ void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
|
||||
void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int *num);
|
||||
const char *BF_options(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bio_lib.c,v 1.47 2023/07/10 02:33:33 tb Exp $ */
|
||||
/* $OpenBSD: bio_lib.c,v 1.48 2023/08/07 10:58:56 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -816,7 +816,8 @@ LCRYPTO_ALIAS(BIO_free_all);
|
||||
BIO *
|
||||
BIO_dup_chain(BIO *in)
|
||||
{
|
||||
BIO *ret = NULL, *eoc = NULL, *bio, *new_bio;
|
||||
BIO *new_chain = NULL, *new_bio = NULL, *tail = NULL;
|
||||
BIO *bio;
|
||||
|
||||
for (bio = in; bio != NULL; bio = bio->next_bio) {
|
||||
if ((new_bio = BIO_new(bio->method)) == NULL)
|
||||
@ -827,33 +828,30 @@ BIO_dup_chain(BIO *in)
|
||||
new_bio->init = bio->init;
|
||||
new_bio->shutdown = bio->shutdown;
|
||||
new_bio->flags = bio->flags;
|
||||
|
||||
/* This will let SSL_s_sock() work with stdin/stdout */
|
||||
new_bio->num = bio->num;
|
||||
|
||||
if (!BIO_dup_state(bio, (char *)new_bio)) {
|
||||
BIO_free(new_bio);
|
||||
if (!BIO_dup_state(bio, new_bio))
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* copy app data */
|
||||
if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO,
|
||||
&new_bio->ex_data, &bio->ex_data))
|
||||
goto err;
|
||||
|
||||
if (ret == NULL) {
|
||||
eoc = new_bio;
|
||||
ret = eoc;
|
||||
} else {
|
||||
BIO_push(eoc, new_bio);
|
||||
eoc = new_bio;
|
||||
}
|
||||
}
|
||||
return (ret);
|
||||
err:
|
||||
BIO_free(ret);
|
||||
return (NULL);
|
||||
if (BIO_push(tail, new_bio) == NULL)
|
||||
goto err;
|
||||
|
||||
tail = new_bio;
|
||||
if (new_chain == NULL)
|
||||
new_chain = new_bio;
|
||||
}
|
||||
|
||||
return new_chain;
|
||||
|
||||
err:
|
||||
BIO_free(new_bio);
|
||||
BIO_free_all(new_chain);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
LCRYPTO_ALIAS(BIO_dup_chain);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bss_sock.c,v 1.26 2023/07/05 21:23:37 beck Exp $ */
|
||||
/* $OpenBSD: bss_sock.c,v 1.27 2023/08/07 10:54:14 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -173,7 +173,7 @@ sock_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
switch (cmd) {
|
||||
case BIO_C_SET_FD:
|
||||
sock_free(b);
|
||||
b->num= *((int *)ptr);
|
||||
b->num = *((int *)ptr);
|
||||
b->shutdown = (int)num;
|
||||
b->init = 1;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn.h,v 1.74 2023/07/28 10:07:30 tb Exp $ */
|
||||
/* $OpenBSD: bn.h,v 1.75 2023/07/31 05:04:06 tb Exp $ */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -318,7 +318,6 @@ void BN_zero(BIGNUM *a);
|
||||
int BN_one(BIGNUM *a);
|
||||
|
||||
const BIGNUM *BN_value_one(void);
|
||||
char * BN_options(void);
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
void BN_CTX_free(BN_CTX *c);
|
||||
void BN_CTX_start(BN_CTX *ctx);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_blind.c,v 1.24 2023/07/28 10:05:16 tb Exp $ */
|
||||
/* $OpenBSD: bn_blind.c,v 1.32 2023/08/02 09:25:36 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
@ -123,27 +123,25 @@ struct bn_blinding_st {
|
||||
BIGNUM *A;
|
||||
BIGNUM *Ai;
|
||||
BIGNUM *e;
|
||||
BIGNUM *mod; /* just a reference */
|
||||
BIGNUM *mod;
|
||||
CRYPTO_THREADID tid;
|
||||
int counter;
|
||||
unsigned long flags;
|
||||
BN_MONT_CTX *m_ctx;
|
||||
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
};
|
||||
|
||||
BN_BLINDING *
|
||||
static BN_BLINDING *
|
||||
BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
|
||||
{
|
||||
BN_BLINDING *ret = NULL;
|
||||
|
||||
|
||||
if ((ret = calloc(1, sizeof(BN_BLINDING))) == NULL) {
|
||||
BNerror(ERR_R_MALLOC_FAILURE);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
if (A != NULL) {
|
||||
if ((ret->A = BN_dup(A)) == NULL)
|
||||
if ((ret->A = BN_dup(A)) == NULL)
|
||||
goto err;
|
||||
}
|
||||
if (Ai != NULL) {
|
||||
@ -164,10 +162,11 @@ BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
|
||||
CRYPTO_THREADID_current(&ret->tid);
|
||||
return (ret);
|
||||
|
||||
err:
|
||||
err:
|
||||
if (ret != NULL)
|
||||
BN_BLINDING_free(ret);
|
||||
return (NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -183,12 +182,12 @@ BN_BLINDING_free(BN_BLINDING *r)
|
||||
free(r);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if ((b->A == NULL) || (b->Ai == NULL)) {
|
||||
if (b->A == NULL || b->Ai == NULL) {
|
||||
BNerror(BN_R_NOT_INITIALIZED);
|
||||
goto err;
|
||||
}
|
||||
@ -196,12 +195,11 @@ BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
|
||||
if (b->counter == -1)
|
||||
b->counter = 0;
|
||||
|
||||
if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL &&
|
||||
!(b->flags & BN_BLINDING_NO_RECREATE)) {
|
||||
if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL) {
|
||||
/* re-create blinding parameters */
|
||||
if (!BN_BLINDING_create_param(b, NULL, NULL, ctx, NULL, NULL))
|
||||
goto err;
|
||||
} else if (!(b->flags & BN_BLINDING_NO_UPDATE)) {
|
||||
} else {
|
||||
if (!BN_mod_mul(b->A, b->A, b->A, b->mod, ctx))
|
||||
goto err;
|
||||
if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx))
|
||||
@ -210,58 +208,45 @@ BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
err:
|
||||
if (b->counter == BN_BLINDING_COUNTER)
|
||||
b->counter = 0;
|
||||
return (ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
|
||||
{
|
||||
return BN_BLINDING_convert_ex(n, NULL, b, ctx);
|
||||
}
|
||||
|
||||
int
|
||||
BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
{
|
||||
int ret = 1;
|
||||
|
||||
|
||||
if ((b->A == NULL) || (b->Ai == NULL)) {
|
||||
if (b->A == NULL || b->Ai == NULL) {
|
||||
BNerror(BN_R_NOT_INITIALIZED);
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (b->counter == -1)
|
||||
/* Fresh blinding, doesn't need updating. */
|
||||
b->counter = 0;
|
||||
else if (!BN_BLINDING_update(b, ctx))
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
if (r != NULL) {
|
||||
if (!bn_copy(r, b->Ai))
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (!BN_mod_mul(n, n,b->A, b->mod, ctx))
|
||||
if (!BN_mod_mul(n, n, b->A, b->mod, ctx))
|
||||
ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
|
||||
{
|
||||
return BN_BLINDING_invert_ex(n, NULL, b, ctx);
|
||||
}
|
||||
|
||||
int
|
||||
BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
if (r != NULL)
|
||||
ret = BN_mod_mul(n, n, r, b->mod, ctx);
|
||||
else {
|
||||
@ -272,7 +257,7 @@ BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
|
||||
ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CRYPTO_THREADID *
|
||||
@ -281,25 +266,13 @@ BN_BLINDING_thread_id(BN_BLINDING *b)
|
||||
return &b->tid;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
BN_BLINDING_get_flags(const BN_BLINDING *b)
|
||||
{
|
||||
return b->flags;
|
||||
}
|
||||
|
||||
void
|
||||
BN_BLINDING_set_flags(BN_BLINDING *b, unsigned long flags)
|
||||
{
|
||||
b->flags = flags;
|
||||
}
|
||||
|
||||
BN_BLINDING *
|
||||
BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m,
|
||||
BN_CTX *ctx, int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx)
|
||||
BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx)
|
||||
{
|
||||
int retry_counter = 32;
|
||||
BN_BLINDING *ret = NULL;
|
||||
int retry_counter = 32;
|
||||
|
||||
if (b == NULL)
|
||||
ret = BN_BLINDING_new(NULL, NULL, m);
|
||||
@ -309,7 +282,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m,
|
||||
if (ret == NULL)
|
||||
goto err;
|
||||
|
||||
if (ret->A == NULL && (ret->A = BN_new()) == NULL)
|
||||
if (ret->A == NULL && (ret->A = BN_new()) == NULL)
|
||||
goto err;
|
||||
if (ret->Ai == NULL && (ret->Ai = BN_new()) == NULL)
|
||||
goto err;
|
||||
@ -355,7 +328,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m,
|
||||
|
||||
return ret;
|
||||
|
||||
err:
|
||||
err:
|
||||
if (b == NULL && ret != NULL) {
|
||||
BN_BLINDING_free(ret);
|
||||
ret = NULL;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_bpsw.c,v 1.10 2023/05/10 21:05:24 tb Exp $ */
|
||||
/* $OpenBSD: bn_bpsw.c,v 1.11 2023/08/03 18:53:55 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Martin Grenouilloux <martin.grenouilloux@lse.epita.fr>
|
||||
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
|
||||
@ -385,7 +385,7 @@ bn_miller_rabin(int *is_pseudoprime, const BIGNUM *n, BN_CTX *ctx,
|
||||
size_t rounds)
|
||||
{
|
||||
BN_MONT_CTX *mctx = NULL;
|
||||
BIGNUM *base, *k, *n_minus_one, *three;
|
||||
BIGNUM *base, *k, *n_minus_one;
|
||||
size_t i;
|
||||
int s;
|
||||
int ret = 0;
|
||||
@ -398,8 +398,6 @@ bn_miller_rabin(int *is_pseudoprime, const BIGNUM *n, BN_CTX *ctx,
|
||||
goto err;
|
||||
if ((n_minus_one = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((three = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
if (BN_is_word(n, 2) || BN_is_word(n, 3)) {
|
||||
*is_pseudoprime = 1;
|
||||
@ -451,11 +449,8 @@ bn_miller_rabin(int *is_pseudoprime, const BIGNUM *n, BN_CTX *ctx,
|
||||
* risk of false positives in BPSW.
|
||||
*/
|
||||
|
||||
if (!BN_set_word(three, 3))
|
||||
goto err;
|
||||
|
||||
for (i = 0; i < rounds; i++) {
|
||||
if (!bn_rand_interval(base, three, n_minus_one))
|
||||
if (!bn_rand_interval(base, 3, n_minus_one))
|
||||
goto err;
|
||||
|
||||
if (!bn_fermat(is_pseudoprime, n, n_minus_one, k, s, base, ctx,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_local.h,v 1.27 2023/07/28 10:05:16 tb Exp $ */
|
||||
/* $OpenBSD: bn_local.h,v 1.33 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -274,7 +274,8 @@ void bn_div_rem_words(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q,
|
||||
BN_ULONG *out_r);
|
||||
|
||||
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int bn_rand_interval(BIGNUM *rnd, const BIGNUM *lower_inc, const BIGNUM *upper_exc);
|
||||
int bn_rand_in_range(BIGNUM *rnd, const BIGNUM *lower_inc, const BIGNUM *upper_exc);
|
||||
int bn_rand_interval(BIGNUM *rnd, BN_ULONG lower_word, const BIGNUM *upper_exc);
|
||||
|
||||
void BN_init(BIGNUM *);
|
||||
|
||||
@ -291,21 +292,11 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
|
||||
/* BN_BLINDING flags */
|
||||
#define BN_BLINDING_NO_UPDATE 0x00000001
|
||||
#define BN_BLINDING_NO_RECREATE 0x00000002
|
||||
|
||||
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
|
||||
void BN_BLINDING_free(BN_BLINDING *b);
|
||||
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||
|
||||
CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
|
||||
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_mod_sqrt.c,v 1.2 2023/07/08 12:21:58 beck Exp $ */
|
||||
/* $OpenBSD: bn_mod_sqrt.c,v 1.3 2023/08/03 18:53:55 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
|
||||
@ -237,7 +237,7 @@ static int
|
||||
bn_mod_sqrt_find_sylow_generator(BIGNUM *out_generator, const BIGNUM *p,
|
||||
const BIGNUM *q, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *n, *p_abs, *thirty_two;
|
||||
BIGNUM *n, *p_abs;
|
||||
int i, is_non_residue;
|
||||
int ret = 0;
|
||||
|
||||
@ -245,8 +245,6 @@ bn_mod_sqrt_find_sylow_generator(BIGNUM *out_generator, const BIGNUM *p,
|
||||
|
||||
if ((n = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((thirty_two = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((p_abs = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
@ -259,14 +257,12 @@ bn_mod_sqrt_find_sylow_generator(BIGNUM *out_generator, const BIGNUM *p,
|
||||
goto found;
|
||||
}
|
||||
|
||||
if (!BN_set_word(thirty_two, 32))
|
||||
goto err;
|
||||
if (!bn_copy(p_abs, p))
|
||||
goto err;
|
||||
BN_set_negative(p_abs, 0);
|
||||
|
||||
for (i = 0; i < 128; i++) {
|
||||
if (!bn_rand_interval(n, thirty_two, p_abs))
|
||||
if (!bn_rand_interval(n, 32, p_abs))
|
||||
goto err;
|
||||
if (!bn_mod_sqrt_n_is_non_residue(&is_non_residue, n, p, ctx))
|
||||
goto err;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_rand.c,v 1.28 2023/07/08 12:21:58 beck Exp $ */
|
||||
/* $OpenBSD: bn_rand.c,v 1.29 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -284,29 +284,46 @@ BN_rand_range(BIGNUM *r, const BIGNUM *range)
|
||||
LCRYPTO_ALIAS(BN_rand_range);
|
||||
|
||||
int
|
||||
bn_rand_interval(BIGNUM *rnd, const BIGNUM *lower_inc, const BIGNUM *upper_exc)
|
||||
bn_rand_in_range(BIGNUM *rnd, const BIGNUM *lower_inc, const BIGNUM *upper_exc)
|
||||
{
|
||||
BIGNUM *len = NULL;
|
||||
BIGNUM *len;
|
||||
int ret = 0;
|
||||
|
||||
if (BN_cmp(lower_inc, upper_exc) >= 0)
|
||||
goto err;
|
||||
|
||||
if ((len = BN_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!BN_sub(len, upper_exc, lower_inc))
|
||||
goto err;
|
||||
|
||||
if (!bn_rand_range(0, rnd, len))
|
||||
if (!BN_rand_range(rnd, len))
|
||||
goto err;
|
||||
|
||||
if (!BN_add(rnd, rnd, lower_inc))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
BN_free(len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
bn_rand_interval(BIGNUM *rnd, BN_ULONG lower_word, const BIGNUM *upper_exc)
|
||||
{
|
||||
BIGNUM *lower_inc = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if ((lower_inc = BN_new()) == NULL)
|
||||
goto err;
|
||||
if (!BN_set_word(lower_inc, lower_word))
|
||||
goto err;
|
||||
if (!bn_rand_in_range(rnd, lower_inc, upper_exc))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
BN_free(lower_inc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: des.h,v 1.20 2023/07/08 07:11:07 beck Exp $ */
|
||||
/* $OpenBSD: des.h,v 1.21 2023/07/31 05:04:06 tb Exp $ */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -107,7 +107,6 @@ typedef struct DES_ks {
|
||||
extern int DES_check_key; /* defaults to false */
|
||||
extern int DES_rw_mode; /* defaults to DES_PCBC_MODE */
|
||||
|
||||
const char *DES_options(void);
|
||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, int enc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ecb_enc.c,v 1.18 2023/07/08 07:11:07 beck Exp $ */
|
||||
/* $OpenBSD: ecb_enc.c,v 1.19 2023/07/31 05:04:06 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -60,46 +60,6 @@
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/bio.h>
|
||||
|
||||
const char *
|
||||
DES_options(void)
|
||||
{
|
||||
static int init = 1;
|
||||
static char buf[32];
|
||||
|
||||
if (init) {
|
||||
const char *ptr, *unroll, *risc, *size;
|
||||
|
||||
#ifdef DES_PTR
|
||||
ptr = "ptr";
|
||||
#else
|
||||
ptr = "idx";
|
||||
#endif
|
||||
#if defined(DES_RISC1) || defined(DES_RISC2)
|
||||
#ifdef DES_RISC1
|
||||
risc = "risc1";
|
||||
#endif
|
||||
#ifdef DES_RISC2
|
||||
risc = "risc2";
|
||||
#endif
|
||||
#else
|
||||
risc = "cisc";
|
||||
#endif
|
||||
#ifdef DES_UNROLL
|
||||
unroll = "16";
|
||||
#else
|
||||
unroll = "2";
|
||||
#endif
|
||||
if (sizeof(DES_LONG) != sizeof(long))
|
||||
size = "int";
|
||||
else
|
||||
size = "long";
|
||||
snprintf(buf, sizeof buf, "des(%s,%s,%s,%s)", ptr, risc, unroll,
|
||||
size);
|
||||
init = 0;
|
||||
}
|
||||
return (buf);
|
||||
}
|
||||
|
||||
void
|
||||
DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks, int enc)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dh_key.c,v 1.39 2023/07/08 15:29:03 beck Exp $ */
|
||||
/* $OpenBSD: dh_key.c,v 1.40 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -109,7 +109,7 @@ generate_key(DH *dh)
|
||||
unsigned l;
|
||||
BN_CTX *ctx;
|
||||
BN_MONT_CTX *mont = NULL;
|
||||
BIGNUM *pub_key = NULL, *priv_key = NULL, *two = NULL;
|
||||
BIGNUM *pub_key = NULL, *priv_key = NULL;
|
||||
|
||||
if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
|
||||
DHerror(DH_R_MODULUS_TOO_LARGE);
|
||||
@ -139,11 +139,7 @@ generate_key(DH *dh)
|
||||
|
||||
if (dh->priv_key == NULL) {
|
||||
if (dh->q) {
|
||||
if ((two = BN_new()) == NULL)
|
||||
goto err;
|
||||
if (!BN_add(two, BN_value_one(), BN_value_one()))
|
||||
goto err;
|
||||
if (!bn_rand_interval(priv_key, two, dh->q))
|
||||
if (!bn_rand_interval(priv_key, 2, dh->q))
|
||||
goto err;
|
||||
} else {
|
||||
/* secret exponent length */
|
||||
@ -169,7 +165,7 @@ generate_key(DH *dh)
|
||||
if (dh->priv_key == NULL)
|
||||
BN_free(priv_key);
|
||||
BN_CTX_free(ctx);
|
||||
BN_free(two);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dsa_key.c,v 1.34 2023/07/08 14:28:15 beck Exp $ */
|
||||
/* $OpenBSD: dsa_key.c,v 1.35 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -95,7 +95,7 @@ dsa_builtin_keygen(DSA *dsa)
|
||||
if ((ctx = BN_CTX_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!bn_rand_interval(priv_key, BN_value_one(), dsa->q))
|
||||
if (!bn_rand_interval(priv_key, 1, dsa->q))
|
||||
goto err;
|
||||
if (!BN_mod_exp_ct(pub_key, dsa->g, priv_key, dsa->p, ctx))
|
||||
goto err;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dsa_ossl.c,v 1.52 2023/07/08 14:28:15 beck Exp $ */
|
||||
/* $OpenBSD: dsa_ossl.c,v 1.53 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -172,7 +172,7 @@ dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
|
||||
*
|
||||
* Where b is a random value in the range [1, q).
|
||||
*/
|
||||
if (!bn_rand_interval(b, BN_value_one(), dsa->q))
|
||||
if (!bn_rand_interval(b, 1, dsa->q))
|
||||
goto err;
|
||||
if (BN_mod_inverse_ct(binv, b, dsa->q, ctx) == NULL)
|
||||
goto err;
|
||||
@ -261,7 +261,7 @@ dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
|
||||
!BN_set_bit(m, q_bits))
|
||||
goto err;
|
||||
|
||||
if (!bn_rand_interval(k, BN_value_one(), dsa->q))
|
||||
if (!bn_rand_interval(k, 1, dsa->q))
|
||||
goto err;
|
||||
|
||||
BN_set_flags(k, BN_FLG_CONSTTIME);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ec_key.c,v 1.36 2023/07/07 13:54:45 beck Exp $ */
|
||||
/* $OpenBSD: ec_key.c,v 1.37 2023/08/03 18:53:56 tb Exp $ */
|
||||
/*
|
||||
* Written by Nils Larsch for the OpenSSL project.
|
||||
*/
|
||||
@ -269,7 +269,7 @@ ec_key_gen(EC_KEY *eckey)
|
||||
|
||||
if ((order = EC_GROUP_get0_order(eckey->group)) == NULL)
|
||||
goto err;
|
||||
if (!bn_rand_interval(priv_key, BN_value_one(), order))
|
||||
if (!bn_rand_interval(priv_key, 1, order))
|
||||
goto err;
|
||||
if (!EC_POINT_mul(eckey->group, pub_key, priv_key, NULL, NULL, NULL))
|
||||
goto err;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ecp_smpl.c,v 1.55 2023/07/26 17:15:25 tb Exp $ */
|
||||
/* $OpenBSD: ecp_smpl.c,v 1.56 2023/08/03 18:53:56 tb Exp $ */
|
||||
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
|
||||
* for the OpenSSL project.
|
||||
* Includes code written by Bodo Moeller for the OpenSSL project.
|
||||
@ -1227,7 +1227,7 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx)
|
||||
goto err;
|
||||
|
||||
/* Generate lambda in [1, group->field). */
|
||||
if (!bn_rand_interval(lambda, BN_value_one(), &group->field))
|
||||
if (!bn_rand_interval(lambda, 1, &group->field))
|
||||
goto err;
|
||||
|
||||
if (group->meth->field_encode != NULL &&
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ecdsa.c,v 1.16 2023/07/28 09:18:10 tb Exp $ */
|
||||
/* $OpenBSD: ecdsa.c,v 1.17 2023/08/03 18:53:56 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
@ -338,7 +338,7 @@ ecdsa_sign_setup(EC_KEY *key, BN_CTX *in_ctx, BIGNUM **out_kinv, BIGNUM **out_r)
|
||||
/* Step 11: repeat until r != 0. */
|
||||
do {
|
||||
/* Step 3: generate random k. */
|
||||
if (!bn_rand_interval(k, BN_value_one(), order))
|
||||
if (!bn_rand_interval(k, 1, order))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
@ -472,7 +472,7 @@ ecdsa_compute_s(BIGNUM **out_s, const BIGNUM *e, const BIGNUM *kinv,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (!bn_rand_interval(b, BN_value_one(), order)) {
|
||||
if (!bn_rand_interval(b, 1, order)) {
|
||||
ECerror(ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: engine.h,v 1.41 2023/07/28 09:22:26 tb Exp $ */
|
||||
/* $OpenBSD: engine.h,v 1.42 2023/08/04 05:44:51 tb Exp $ */
|
||||
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
|
||||
* project 2000.
|
||||
*/
|
||||
@ -246,8 +246,8 @@ void ENGINE_load_openssl(void);
|
||||
int ENGINE_register_all_complete(void);
|
||||
|
||||
void ENGINE_cleanup(void);
|
||||
ENGINE *ENGINE_new(void);
|
||||
|
||||
ENGINE *ENGINE_new(void);
|
||||
int ENGINE_free(ENGINE *engine);
|
||||
int ENGINE_init(ENGINE *engine);
|
||||
int ENGINE_finish(ENGINE *engine);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: BF_set_key.3,v 1.11 2023/07/29 03:05:35 tb Exp $
|
||||
.\" $OpenBSD: BF_set_key.3,v 1.12 2023/08/05 18:27:55 jmc Exp $
|
||||
.\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400
|
||||
.\"
|
||||
.\" This file was written by Richard Levitte <levitte@openssl.org>.
|
||||
@ -49,7 +49,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 29 2023 $
|
||||
.Dd $Mdocdate: August 5 2023 $
|
||||
.Dt BF_SET_KEY 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -59,7 +59,7 @@
|
||||
.Nm BF_ecb_encrypt ,
|
||||
.Nm BF_cbc_encrypt ,
|
||||
.Nm BF_cfb64_encrypt ,
|
||||
.Nm BF_ofb64_encrypt ,
|
||||
.Nm BF_ofb64_encrypt
|
||||
.Nd Blowfish encryption
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/blowfish.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rsa_eay.c,v 1.62 2023/07/08 12:26:45 beck Exp $ */
|
||||
/* $OpenBSD: rsa_eay.c,v 1.63 2023/08/02 08:44:38 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -282,7 +282,7 @@ rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx)
|
||||
* Local blinding: store the unblinding factor
|
||||
* in BN_BLINDING.
|
||||
*/
|
||||
return BN_BLINDING_convert_ex(f, NULL, b, ctx);
|
||||
return BN_BLINDING_convert(f, NULL, b, ctx);
|
||||
else {
|
||||
/*
|
||||
* Shared blinding: store the unblinding factor
|
||||
@ -290,7 +290,7 @@ rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx)
|
||||
*/
|
||||
int ret;
|
||||
CRYPTO_w_lock(CRYPTO_LOCK_RSA_BLINDING);
|
||||
ret = BN_BLINDING_convert_ex(f, unblind, b, ctx);
|
||||
ret = BN_BLINDING_convert(f, unblind, b, ctx);
|
||||
CRYPTO_w_unlock(CRYPTO_LOCK_RSA_BLINDING);
|
||||
return ret;
|
||||
}
|
||||
@ -300,14 +300,14 @@ static int
|
||||
rsa_blinding_invert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, BN_CTX *ctx)
|
||||
{
|
||||
/*
|
||||
* For local blinding, unblind is set to NULL, and BN_BLINDING_invert_ex
|
||||
* For local blinding, unblind is set to NULL, and BN_BLINDING_invert()
|
||||
* will use the unblinding factor stored in BN_BLINDING.
|
||||
* If BN_BLINDING is shared between threads, unblind must be non-null:
|
||||
* BN_BLINDING_invert_ex will then use the local unblinding factor,
|
||||
* BN_BLINDING_invert() will then use the local unblinding factor,
|
||||
* and will only read the modulus from BN_BLINDING.
|
||||
* In both cases it's safe to access the blinding without a lock.
|
||||
*/
|
||||
return BN_BLINDING_invert_ex(f, unblind, b, ctx);
|
||||
return BN_BLINDING_invert(f, unblind, b, ctx);
|
||||
}
|
||||
|
||||
/* signing */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: safestack.h,v 1.28 2023/07/28 10:26:33 tb Exp $ */
|
||||
/* $OpenBSD: safestack.h,v 1.29 2023/08/03 16:32:15 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
@ -125,13 +125,6 @@ typedef const char *OPENSSL_CSTRING;
|
||||
|
||||
DECLARE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
|
||||
|
||||
/* Similarly, we sometimes use a block of characters, NOT
|
||||
* nul-terminated. These should also be distinguished from "normal"
|
||||
* stacks. */
|
||||
|
||||
typedef void *OPENSSL_BLOCK;
|
||||
DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
|
||||
/* SKM_sk_... stack macros are internal to safestack.h:
|
||||
* never use them directly, use sk_<type>_... instead */
|
||||
#define SKM_sk_new(type, cmp) \
|
||||
@ -685,50 +678,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))
|
||||
#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))
|
||||
|
||||
#define sk_ENGINE_new(cmp) SKM_sk_new(ENGINE, (cmp))
|
||||
#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)
|
||||
#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st))
|
||||
#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st))
|
||||
#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i))
|
||||
#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val))
|
||||
#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st))
|
||||
#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val))
|
||||
#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val))
|
||||
#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val))
|
||||
#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val))
|
||||
#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i))
|
||||
#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr))
|
||||
#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i))
|
||||
#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp))
|
||||
#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st)
|
||||
#define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func))
|
||||
#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st))
|
||||
#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st))
|
||||
#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))
|
||||
#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))
|
||||
|
||||
#define sk_ENGINE_CLEANUP_ITEM_new(cmp) SKM_sk_new(ENGINE_CLEANUP_ITEM, (cmp))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM)
|
||||
#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st)
|
||||
#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st))
|
||||
#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st))
|
||||
|
||||
#define sk_ESS_CERT_ID_new(cmp) SKM_sk_new(ESS_CERT_ID, (cmp))
|
||||
#define sk_ESS_CERT_ID_new_null() SKM_sk_new_null(ESS_CERT_ID)
|
||||
#define sk_ESS_CERT_ID_free(st) SKM_sk_free(ESS_CERT_ID, (st))
|
||||
@ -973,28 +922,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st))
|
||||
#define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st))
|
||||
|
||||
#define sk_MEM_OBJECT_DATA_new(cmp) SKM_sk_new(MEM_OBJECT_DATA, (cmp))
|
||||
#define sk_MEM_OBJECT_DATA_new_null() SKM_sk_new_null(MEM_OBJECT_DATA)
|
||||
#define sk_MEM_OBJECT_DATA_free(st) SKM_sk_free(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_num(st) SKM_sk_num(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_value(st, i) SKM_sk_value(MEM_OBJECT_DATA, (st), (i))
|
||||
#define sk_MEM_OBJECT_DATA_set(st, i, val) SKM_sk_set(MEM_OBJECT_DATA, (st), (i), (val))
|
||||
#define sk_MEM_OBJECT_DATA_zero(st) SKM_sk_zero(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_push(st, val) SKM_sk_push(MEM_OBJECT_DATA, (st), (val))
|
||||
#define sk_MEM_OBJECT_DATA_unshift(st, val) SKM_sk_unshift(MEM_OBJECT_DATA, (st), (val))
|
||||
#define sk_MEM_OBJECT_DATA_find(st, val) SKM_sk_find(MEM_OBJECT_DATA, (st), (val))
|
||||
#define sk_MEM_OBJECT_DATA_find_ex(st, val) SKM_sk_find_ex(MEM_OBJECT_DATA, (st), (val))
|
||||
#define sk_MEM_OBJECT_DATA_delete(st, i) SKM_sk_delete(MEM_OBJECT_DATA, (st), (i))
|
||||
#define sk_MEM_OBJECT_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(MEM_OBJECT_DATA, (st), (ptr))
|
||||
#define sk_MEM_OBJECT_DATA_insert(st, val, i) SKM_sk_insert(MEM_OBJECT_DATA, (st), (val), (i))
|
||||
#define sk_MEM_OBJECT_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MEM_OBJECT_DATA, (st), (cmp))
|
||||
#define sk_MEM_OBJECT_DATA_dup(st) SKM_sk_dup(MEM_OBJECT_DATA, st)
|
||||
#define sk_MEM_OBJECT_DATA_pop_free(st, free_func) SKM_sk_pop_free(MEM_OBJECT_DATA, (st), (free_func))
|
||||
#define sk_MEM_OBJECT_DATA_shift(st) SKM_sk_shift(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_pop(st) SKM_sk_pop(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_sort(st) SKM_sk_sort(MEM_OBJECT_DATA, (st))
|
||||
#define sk_MEM_OBJECT_DATA_is_sorted(st) SKM_sk_is_sorted(MEM_OBJECT_DATA, (st))
|
||||
|
||||
#define sk_MIME_HEADER_new(cmp) SKM_sk_new(MIME_HEADER, (cmp))
|
||||
#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)
|
||||
#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st))
|
||||
@ -1855,30 +1782,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
#define sk_OPENSSL_STRING_sort(st) SKM_sk_sort(OPENSSL_STRING, (st))
|
||||
#define sk_OPENSSL_STRING_is_sorted(st) SKM_sk_is_sorted(OPENSSL_STRING, (st))
|
||||
|
||||
#define sk_OPENSSL_BLOCK_new(cmp) ((STACK_OF(OPENSSL_BLOCK) *)sk_new(CHECKED_SK_CMP_FUNC(void, cmp)))
|
||||
#define sk_OPENSSL_BLOCK_new_null() ((STACK_OF(OPENSSL_BLOCK) *)sk_new_null())
|
||||
#define sk_OPENSSL_BLOCK_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
|
||||
#define sk_OPENSSL_BLOCK_find(st, val) sk_find(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
|
||||
#define sk_OPENSSL_BLOCK_value(st, i) ((OPENSSL_BLOCK)sk_value(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i))
|
||||
#define sk_OPENSSL_BLOCK_num(st) SKM_sk_num(OPENSSL_BLOCK, st)
|
||||
#define sk_OPENSSL_BLOCK_pop_free(st, free_func) sk_pop_free(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_FREE_FUNC2(OPENSSL_BLOCK, free_func))
|
||||
#define sk_OPENSSL_BLOCK_insert(st, val, i) sk_insert(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val), i)
|
||||
#define sk_OPENSSL_BLOCK_free(st) SKM_sk_free(OPENSSL_BLOCK, st)
|
||||
#define sk_OPENSSL_BLOCK_set(st, i, val) sk_set(CHECKED_STACK_OF(OPENSSL_BLOCK, st), i, CHECKED_PTR_OF(void, val))
|
||||
#define sk_OPENSSL_BLOCK_zero(st) SKM_sk_zero(OPENSSL_BLOCK, (st))
|
||||
#define sk_OPENSSL_BLOCK_unshift(st, val) sk_unshift(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, val))
|
||||
#define sk_OPENSSL_BLOCK_find_ex(st, val) sk_find_ex((_STACK *)CHECKED_CONST_PTR_OF(STACK_OF(OPENSSL_BLOCK), st), CHECKED_CONST_PTR_OF(void, val))
|
||||
#define sk_OPENSSL_BLOCK_delete(st, i) SKM_sk_delete(OPENSSL_BLOCK, (st), (i))
|
||||
#define sk_OPENSSL_BLOCK_delete_ptr(st, ptr) (OPENSSL_BLOCK *)sk_delete_ptr(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_PTR_OF(void, ptr))
|
||||
#define sk_OPENSSL_BLOCK_set_cmp_func(st, cmp) \
|
||||
((int (*)(const void * const *,const void * const *)) \
|
||||
sk_set_cmp_func(CHECKED_STACK_OF(OPENSSL_BLOCK, st), CHECKED_SK_CMP_FUNC(void, cmp)))
|
||||
#define sk_OPENSSL_BLOCK_dup(st) SKM_sk_dup(OPENSSL_BLOCK, st)
|
||||
#define sk_OPENSSL_BLOCK_shift(st) SKM_sk_shift(OPENSSL_BLOCK, (st))
|
||||
#define sk_OPENSSL_BLOCK_pop(st) (void *)sk_pop(CHECKED_STACK_OF(OPENSSL_BLOCK, st))
|
||||
#define sk_OPENSSL_BLOCK_sort(st) SKM_sk_sort(OPENSSL_BLOCK, (st))
|
||||
#define sk_OPENSSL_BLOCK_is_sorted(st) SKM_sk_is_sorted(OPENSSL_BLOCK, (st))
|
||||
|
||||
#define sk_OPENSSL_PSTRING_new(cmp) ((STACK_OF(OPENSSL_PSTRING) *)sk_new(CHECKED_SK_CMP_FUNC(OPENSSL_STRING, cmp)))
|
||||
#define sk_OPENSSL_PSTRING_new_null() ((STACK_OF(OPENSSL_PSTRING) *)sk_new_null())
|
||||
#define sk_OPENSSL_PSTRING_push(st, val) sk_push(CHECKED_STACK_OF(OPENSSL_PSTRING, st), CHECKED_PTR_OF(OPENSSL_STRING, val))
|
||||
@ -1921,24 +1824,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
LHM_lh_stats_bio(ADDED_OBJ,lh,out)
|
||||
#define lh_ADDED_OBJ_free(lh) LHM_lh_free(ADDED_OBJ,lh)
|
||||
|
||||
#define lh_APP_INFO_new() LHM_lh_new(APP_INFO,app_info)
|
||||
#define lh_APP_INFO_insert(lh,inst) LHM_lh_insert(APP_INFO,lh,inst)
|
||||
#define lh_APP_INFO_retrieve(lh,inst) LHM_lh_retrieve(APP_INFO,lh,inst)
|
||||
#define lh_APP_INFO_delete(lh,inst) LHM_lh_delete(APP_INFO,lh,inst)
|
||||
#define lh_APP_INFO_doall(lh,fn) LHM_lh_doall(APP_INFO,lh,fn)
|
||||
#define lh_APP_INFO_doall_arg(lh,fn,arg_type,arg) \
|
||||
LHM_lh_doall_arg(APP_INFO,lh,fn,arg_type,arg)
|
||||
#define lh_APP_INFO_error(lh) LHM_lh_error(APP_INFO,lh)
|
||||
#define lh_APP_INFO_num_items(lh) LHM_lh_num_items(APP_INFO,lh)
|
||||
#define lh_APP_INFO_down_load(lh) LHM_lh_down_load(APP_INFO,lh)
|
||||
#define lh_APP_INFO_node_stats_bio(lh,out) \
|
||||
LHM_lh_node_stats_bio(APP_INFO,lh,out)
|
||||
#define lh_APP_INFO_node_usage_stats_bio(lh,out) \
|
||||
LHM_lh_node_usage_stats_bio(APP_INFO,lh,out)
|
||||
#define lh_APP_INFO_stats_bio(lh,out) \
|
||||
LHM_lh_stats_bio(APP_INFO,lh,out)
|
||||
#define lh_APP_INFO_free(lh) LHM_lh_free(APP_INFO,lh)
|
||||
|
||||
#define lh_CONF_VALUE_new() LHM_lh_new(CONF_VALUE,conf_value)
|
||||
#define lh_CONF_VALUE_insert(lh,inst) LHM_lh_insert(CONF_VALUE,lh,inst)
|
||||
#define lh_CONF_VALUE_retrieve(lh,inst) LHM_lh_retrieve(CONF_VALUE,lh,inst)
|
||||
@ -1957,24 +1842,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
LHM_lh_stats_bio(CONF_VALUE,lh,out)
|
||||
#define lh_CONF_VALUE_free(lh) LHM_lh_free(CONF_VALUE,lh)
|
||||
|
||||
#define lh_ENGINE_PILE_new() LHM_lh_new(ENGINE_PILE,engine_pile)
|
||||
#define lh_ENGINE_PILE_insert(lh,inst) LHM_lh_insert(ENGINE_PILE,lh,inst)
|
||||
#define lh_ENGINE_PILE_retrieve(lh,inst) LHM_lh_retrieve(ENGINE_PILE,lh,inst)
|
||||
#define lh_ENGINE_PILE_delete(lh,inst) LHM_lh_delete(ENGINE_PILE,lh,inst)
|
||||
#define lh_ENGINE_PILE_doall(lh,fn) LHM_lh_doall(ENGINE_PILE,lh,fn)
|
||||
#define lh_ENGINE_PILE_doall_arg(lh,fn,arg_type,arg) \
|
||||
LHM_lh_doall_arg(ENGINE_PILE,lh,fn,arg_type,arg)
|
||||
#define lh_ENGINE_PILE_error(lh) LHM_lh_error(ENGINE_PILE,lh)
|
||||
#define lh_ENGINE_PILE_num_items(lh) LHM_lh_num_items(ENGINE_PILE,lh)
|
||||
#define lh_ENGINE_PILE_down_load(lh) LHM_lh_down_load(ENGINE_PILE,lh)
|
||||
#define lh_ENGINE_PILE_node_stats_bio(lh,out) \
|
||||
LHM_lh_node_stats_bio(ENGINE_PILE,lh,out)
|
||||
#define lh_ENGINE_PILE_node_usage_stats_bio(lh,out) \
|
||||
LHM_lh_node_usage_stats_bio(ENGINE_PILE,lh,out)
|
||||
#define lh_ENGINE_PILE_stats_bio(lh,out) \
|
||||
LHM_lh_stats_bio(ENGINE_PILE,lh,out)
|
||||
#define lh_ENGINE_PILE_free(lh) LHM_lh_free(ENGINE_PILE,lh)
|
||||
|
||||
#define lh_ERR_STATE_new() LHM_lh_new(ERR_STATE,err_state)
|
||||
#define lh_ERR_STATE_insert(lh,inst) LHM_lh_insert(ERR_STATE,lh,inst)
|
||||
#define lh_ERR_STATE_retrieve(lh,inst) LHM_lh_retrieve(ERR_STATE,lh,inst)
|
||||
@ -2047,24 +1914,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
LHM_lh_stats_bio(FUNCTION,lh,out)
|
||||
#define lh_FUNCTION_free(lh) LHM_lh_free(FUNCTION,lh)
|
||||
|
||||
#define lh_MEM_new() LHM_lh_new(MEM,mem)
|
||||
#define lh_MEM_insert(lh,inst) LHM_lh_insert(MEM,lh,inst)
|
||||
#define lh_MEM_retrieve(lh,inst) LHM_lh_retrieve(MEM,lh,inst)
|
||||
#define lh_MEM_delete(lh,inst) LHM_lh_delete(MEM,lh,inst)
|
||||
#define lh_MEM_doall(lh,fn) LHM_lh_doall(MEM,lh,fn)
|
||||
#define lh_MEM_doall_arg(lh,fn,arg_type,arg) \
|
||||
LHM_lh_doall_arg(MEM,lh,fn,arg_type,arg)
|
||||
#define lh_MEM_error(lh) LHM_lh_error(MEM,lh)
|
||||
#define lh_MEM_num_items(lh) LHM_lh_num_items(MEM,lh)
|
||||
#define lh_MEM_down_load(lh) LHM_lh_down_load(MEM,lh)
|
||||
#define lh_MEM_node_stats_bio(lh,out) \
|
||||
LHM_lh_node_stats_bio(MEM,lh,out)
|
||||
#define lh_MEM_node_usage_stats_bio(lh,out) \
|
||||
LHM_lh_node_usage_stats_bio(MEM,lh,out)
|
||||
#define lh_MEM_stats_bio(lh,out) \
|
||||
LHM_lh_stats_bio(MEM,lh,out)
|
||||
#define lh_MEM_free(lh) LHM_lh_free(MEM,lh)
|
||||
|
||||
#define lh_OBJ_NAME_new() LHM_lh_new(OBJ_NAME,obj_name)
|
||||
#define lh_OBJ_NAME_insert(lh,inst) LHM_lh_insert(OBJ_NAME,lh,inst)
|
||||
#define lh_OBJ_NAME_retrieve(lh,inst) LHM_lh_retrieve(OBJ_NAME,lh,inst)
|
||||
@ -2083,24 +1932,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
|
||||
LHM_lh_stats_bio(OBJ_NAME,lh,out)
|
||||
#define lh_OBJ_NAME_free(lh) LHM_lh_free(OBJ_NAME,lh)
|
||||
|
||||
#define lh_OPENSSL_CSTRING_new() LHM_lh_new(OPENSSL_CSTRING,openssl_cstring)
|
||||
#define lh_OPENSSL_CSTRING_insert(lh,inst) LHM_lh_insert(OPENSSL_CSTRING,lh,inst)
|
||||
#define lh_OPENSSL_CSTRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_CSTRING,lh,inst)
|
||||
#define lh_OPENSSL_CSTRING_delete(lh,inst) LHM_lh_delete(OPENSSL_CSTRING,lh,inst)
|
||||
#define lh_OPENSSL_CSTRING_doall(lh,fn) LHM_lh_doall(OPENSSL_CSTRING,lh,fn)
|
||||
#define lh_OPENSSL_CSTRING_doall_arg(lh,fn,arg_type,arg) \
|
||||
LHM_lh_doall_arg(OPENSSL_CSTRING,lh,fn,arg_type,arg)
|
||||
#define lh_OPENSSL_CSTRING_error(lh) LHM_lh_error(OPENSSL_CSTRING,lh)
|
||||
#define lh_OPENSSL_CSTRING_num_items(lh) LHM_lh_num_items(OPENSSL_CSTRING,lh)
|
||||
#define lh_OPENSSL_CSTRING_down_load(lh) LHM_lh_down_load(OPENSSL_CSTRING,lh)
|
||||
#define lh_OPENSSL_CSTRING_node_stats_bio(lh,out) \
|
||||
LHM_lh_node_stats_bio(OPENSSL_CSTRING,lh,out)
|
||||
#define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh,out) \
|
||||
LHM_lh_node_usage_stats_bio(OPENSSL_CSTRING,lh,out)
|
||||
#define lh_OPENSSL_CSTRING_stats_bio(lh,out) \
|
||||
LHM_lh_stats_bio(OPENSSL_CSTRING,lh,out)
|
||||
#define lh_OPENSSL_CSTRING_free(lh) LHM_lh_free(OPENSSL_CSTRING,lh)
|
||||
|
||||
#define lh_OPENSSL_STRING_new() LHM_lh_new(OPENSSL_STRING,openssl_string)
|
||||
#define lh_OPENSSL_STRING_insert(lh,inst) LHM_lh_insert(OPENSSL_STRING,lh,inst)
|
||||
#define lh_OPENSSL_STRING_retrieve(lh,inst) LHM_lh_retrieve(OPENSSL_STRING,lh,inst)
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: compress.3,v 1.23 2022/12/27 17:10:08 jmc Exp $
|
||||
.\" $OpenBSD: compress.3,v 1.24 2023/07/30 16:43:28 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
||||
.\"
|
||||
@ -23,7 +23,7 @@
|
||||
.\"
|
||||
.\" This page corresponds to zlib version 1.2.3
|
||||
.\"
|
||||
.Dd $Mdocdate: December 27 2022 $
|
||||
.Dd $Mdocdate: July 30 2023 $
|
||||
.Dt COMPRESS 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -353,6 +353,12 @@ are set to
|
||||
.Dv NULL ,
|
||||
.Fn deflateInit
|
||||
updates them to use default allocation functions.
|
||||
.Fa total_in ,
|
||||
.Fa total_out ,
|
||||
.Fa adler ,
|
||||
and
|
||||
.Fa msg
|
||||
are initialized.
|
||||
.Pp
|
||||
The compression level must be
|
||||
.Dv Z_DEFAULT_COMPRESSION ,
|
||||
@ -702,6 +708,12 @@ are set to
|
||||
.Dv NULL ,
|
||||
.Fn inflateInit
|
||||
updates them to use default allocation functions.
|
||||
.Fa total_in ,
|
||||
.Fa total_out ,
|
||||
.Fa adler ,
|
||||
and
|
||||
.Fa msg
|
||||
are initialized.
|
||||
.Pp
|
||||
.Fn inflateInit
|
||||
returns
|
||||
@ -1315,6 +1327,12 @@ followed by
|
||||
but does not free and reallocate the internal compression state.
|
||||
The stream will leave the compression level and any other attributes
|
||||
that may have been set unchanged.
|
||||
.Fa total_in ,
|
||||
.Fa total_out ,
|
||||
.Fa adler ,
|
||||
and
|
||||
.Fa msg
|
||||
are initialized.
|
||||
.Pp
|
||||
.Fn deflateReset
|
||||
returns
|
||||
@ -1562,8 +1580,8 @@ and give up.
|
||||
If
|
||||
.Fn deflateSetHeader
|
||||
is not used, the default gzip header has text false,
|
||||
the time set to zero, and os set to 255, with no extra, name, or comment
|
||||
fields.
|
||||
the time set to zero, and os set to the current operating system, with no
|
||||
extra, name, or comment fields.
|
||||
The gzip header is returned to the default state by
|
||||
.Fn deflateReset .
|
||||
.Pp
|
||||
@ -1828,6 +1846,12 @@ followed by
|
||||
but does not free and reallocate the internal decompression state.
|
||||
The stream will keep attributes that may have been set by
|
||||
.Fn inflateInit2 .
|
||||
.Fa total_in ,
|
||||
.Fa total_out ,
|
||||
.Fa adler ,
|
||||
and
|
||||
.Fa msg
|
||||
are initialized.
|
||||
.Pp
|
||||
.Fn inflateReset
|
||||
returns
|
||||
|
@ -722,8 +722,8 @@ unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
|
||||
words = (z_word_t const *)buf;
|
||||
|
||||
/* Do endian check at execution time instead of compile time, since ARM
|
||||
processors can change the endianess at execution time. If the
|
||||
compiler knows what the endianess will be, it can optimize out the
|
||||
processors can change the endianness at execution time. If the
|
||||
compiler knows what the endianness will be, it can optimize out the
|
||||
check and the unused branch. */
|
||||
endian = 1;
|
||||
if (*(unsigned char *)&endian) {
|
||||
|
@ -7,9 +7,8 @@
|
||||
# ifndef _LARGEFILE_SOURCE
|
||||
# define _LARGEFILE_SOURCE 1
|
||||
# endif
|
||||
# ifdef _FILE_OFFSET_BITS
|
||||
# undef _FILE_OFFSET_BITS
|
||||
# endif
|
||||
# undef _FILE_OFFSET_BITS
|
||||
# undef _TIME_BITS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HIDDEN
|
||||
|
@ -230,7 +230,7 @@ ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
|
||||
Initializes the internal stream state for compression. The fields
|
||||
zalloc, zfree and opaque must be initialized before by the caller. If
|
||||
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
|
||||
allocation functions.
|
||||
allocation functions. total_in, total_out, adler, and msg are initialized.
|
||||
|
||||
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
|
||||
1 gives best speed, 9 gives best compression, 0 gives no compression at all
|
||||
@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
|
||||
read or consumed. The allocation of a sliding window will be deferred to
|
||||
the first call of inflate (if the decompression does not complete on the
|
||||
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
|
||||
them to use default allocation functions.
|
||||
them to use default allocation functions. total_in, total_out, adler, and
|
||||
msg are initialized.
|
||||
|
||||
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
||||
@ -696,7 +697,7 @@ ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
|
||||
This function is equivalent to deflateEnd followed by deflateInit, but
|
||||
does not free and reallocate the internal compression state. The stream
|
||||
will leave the compression level and any other attributes that may have been
|
||||
set unchanged.
|
||||
set unchanged. total_in, total_out, adler, and msg are initialized.
|
||||
|
||||
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
||||
@ -821,8 +822,9 @@ ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
|
||||
gzip file" and give up.
|
||||
|
||||
If deflateSetHeader is not used, the default gzip header has text false,
|
||||
the time set to zero, and os set to 255, with no extra, name, or comment
|
||||
fields. The gzip header is returned to the default state by deflateReset().
|
||||
the time set to zero, and os set to the current operating system, with no
|
||||
extra, name, or comment fields. The gzip header is returned to the default
|
||||
state by deflateReset().
|
||||
|
||||
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent.
|
||||
@ -961,6 +963,7 @@ ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
|
||||
This function is equivalent to inflateEnd followed by inflateInit,
|
||||
but does not free and reallocate the internal decompression state. The
|
||||
stream will keep attributes that may have been set by inflateInit2.
|
||||
total_in, total_out, adler, and msg are initialized.
|
||||
|
||||
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bio_chain.c,v 1.15 2023/03/04 12:13:11 tb Exp $ */
|
||||
/* $OpenBSD: bio_chain.c,v 1.16 2023/08/07 11:00:54 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
|
||||
*
|
||||
@ -460,6 +460,47 @@ bio_set_next_link_test(void)
|
||||
return link_chains(use_bio_push);
|
||||
}
|
||||
|
||||
static long
|
||||
dup_leak_cb(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret)
|
||||
{
|
||||
if (argi == BIO_CTRL_DUP)
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
bio_dup_chain_leak(void)
|
||||
{
|
||||
BIO *bio[CHAIN_POP_LEN];
|
||||
BIO *dup;
|
||||
int failed = 1;
|
||||
|
||||
if (!bio_chain_create(BIO_s_null(), bio, nitems(bio)))
|
||||
goto err;
|
||||
|
||||
if ((dup = BIO_dup_chain(bio[0])) == NULL) {
|
||||
fprintf(stderr, "BIO_set_callback() failed\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
BIO_set_callback(bio[CHAIN_POP_LEN - 1], dup_leak_cb);
|
||||
|
||||
BIO_free_all(dup);
|
||||
if ((dup = BIO_dup_chain(bio[0])) != NULL) {
|
||||
fprintf(stderr, "BIO_dup_chain() succeeded unexpectedly\n");
|
||||
BIO_free_all(dup);
|
||||
goto err;
|
||||
}
|
||||
|
||||
failed = 0;
|
||||
|
||||
err:
|
||||
bio_chain_destroy(bio, nitems(bio));
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -468,6 +509,7 @@ main(int argc, char **argv)
|
||||
failed |= bio_chain_pop_test();
|
||||
failed |= bio_push_link_test();
|
||||
failed |= bio_set_next_link_test();
|
||||
failed |= bio_dup_chain_leak();
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.34 2023/07/06 15:08:54 tb Exp $
|
||||
# $OpenBSD: Makefile,v 1.35 2023/08/03 18:44:31 tb Exp $
|
||||
|
||||
PROGS += bn_add_sub
|
||||
PROGS += bn_cmp
|
||||
@ -13,7 +13,6 @@ PROGS += bn_mont
|
||||
PROGS += bn_mul_div
|
||||
PROGS += bn_primes
|
||||
PROGS += bn_print
|
||||
PROGS += bn_rand_interval
|
||||
PROGS += bn_shift
|
||||
PROGS += bn_test
|
||||
PROGS += bn_to_string
|
||||
@ -24,7 +23,6 @@ STATIC_LINK += bn_gcd
|
||||
STATIC_LINK += bn_isqrt
|
||||
STATIC_LINK += bn_mod_exp
|
||||
STATIC_LINK += bn_print
|
||||
STATIC_LINK += bn_rand_interval
|
||||
STATIC_LINK += bn_test
|
||||
|
||||
LDADD = -lcrypto
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: bn_isqrt.c,v 1.3 2023/03/08 06:28:08 tb Exp $ */
|
||||
/* $OpenBSD: bn_isqrt.c,v 1.4 2023/08/03 18:53:56 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
|
||||
*
|
||||
@ -194,8 +194,8 @@ isqrt_test(void)
|
||||
if (!BN_set_bit(upper, UPPER_BITS))
|
||||
errx(1, "BN_set_bit(upper, %d)", UPPER_BITS);
|
||||
|
||||
if (!bn_rand_interval(n, lower, upper))
|
||||
errx(1, "bn_rand_interval n");
|
||||
if (!bn_rand_in_range(n, lower, upper))
|
||||
errx(1, "bn_rand_in_range n");
|
||||
|
||||
/* n_sqr = n^2 */
|
||||
if (!BN_sqr(n_sqr, n, ctx))
|
||||
@ -246,8 +246,8 @@ isqrt_test(void)
|
||||
*/
|
||||
|
||||
for (i = 0; i < N_TESTS; i++) {
|
||||
if (!bn_rand_interval(testcase, n_sqr, upper))
|
||||
errx(1, "bn_rand_interval testcase");
|
||||
if (!bn_rand_in_range(testcase, n_sqr, upper))
|
||||
errx(1, "bn_rand_in_range testcase");
|
||||
|
||||
if (!bn_isqrt(isqrt, &is_perfect_square, testcase, ctx))
|
||||
errx(1, "bn_isqrt testcase");
|
||||
|
@ -1,112 +0,0 @@
|
||||
/* $OpenBSD: bn_rand_interval.c,v 1.2 2023/03/08 06:44:45 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
|
||||
*
|
||||
* 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 <err.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <openssl/bn.h>
|
||||
|
||||
#define NUM_TESTS 10000
|
||||
|
||||
int bn_rand_interval(BIGNUM *rnd, const BIGNUM *lower_incl,
|
||||
const BIGNUM *upper_excl);
|
||||
void print_triple(BIGNUM *a, BIGNUM *b, BIGNUM *x);
|
||||
|
||||
void
|
||||
print_triple(BIGNUM *a, BIGNUM *b, BIGNUM *x) {
|
||||
if (a != NULL) {
|
||||
printf("a = ");
|
||||
BN_print_fp(stdout, a);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (b != NULL) {
|
||||
printf("b = ");
|
||||
BN_print_fp(stdout, b);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (x != NULL) {
|
||||
printf("x = ");
|
||||
BN_print_fp(stdout, x);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
BIGNUM *a, *b, *x;
|
||||
int i, success = 1;
|
||||
|
||||
if ((a = BN_new()) == NULL)
|
||||
errx(1, "BN_new(a)");
|
||||
if ((b = BN_new()) == NULL)
|
||||
errx(1, "BN_new(b)");
|
||||
if ((x = BN_new()) == NULL)
|
||||
errx(1, "BN_new(c)");
|
||||
|
||||
for (i = 0; i < NUM_TESTS; i++) {
|
||||
if (!BN_rand(a, 256, 0, 0))
|
||||
errx(1, "BN_rand(a)");
|
||||
|
||||
if (bn_rand_interval(x, a, a) != 0) {
|
||||
success = 0;
|
||||
|
||||
printf("bn_rand_interval(a == a) succeeded\n");
|
||||
print_triple(a, NULL, x);
|
||||
}
|
||||
|
||||
if (!BN_rand(b, 256, 0, 0))
|
||||
errx(1, "BN_rand(b)");
|
||||
|
||||
switch(BN_cmp(a, b)) {
|
||||
case 0: /* a == b */
|
||||
continue;
|
||||
|
||||
case 1: /* a > b */
|
||||
BN_swap(a, b);
|
||||
break;
|
||||
|
||||
default: /* a < b */
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bn_rand_interval(x, a, b))
|
||||
errx(1, "bn_rand_interval() failed");
|
||||
|
||||
if (BN_cmp(x, a) < 0 || BN_cmp(x, b) >= 0) {
|
||||
success = 0;
|
||||
|
||||
printf("generated number x not inside [a,b)\n");
|
||||
print_triple(a, b, x);
|
||||
}
|
||||
|
||||
if (bn_rand_interval(x, b, a) != 0) {
|
||||
success = 0;
|
||||
|
||||
printf("bn_rand_interval(x, b, a) succeeded\n");
|
||||
print_triple(a, b, x);
|
||||
}
|
||||
}
|
||||
|
||||
BN_free(a);
|
||||
BN_free(b);
|
||||
BN_free(x);
|
||||
|
||||
return 1 - success;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ec_point_conversion.c,v 1.13 2023/04/26 09:31:12 tb Exp $ */
|
||||
/* $OpenBSD: ec_point_conversion.c,v 1.14 2023/08/01 17:19:49 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
|
||||
* Copyright (c) 2021 Joel Sing <jsing@openbsd.org>
|
||||
@ -24,8 +24,6 @@
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
int bn_rand_interval(BIGNUM *, const BIGNUM *, const BIGNUM *);
|
||||
|
||||
int forms[] = {
|
||||
POINT_CONVERSION_COMPRESSED,
|
||||
POINT_CONVERSION_UNCOMPRESSED,
|
||||
|
@ -45,11 +45,13 @@ my %obsolete = (
|
||||
ASN1_i2d_bio ASN1_i2d_bio_of ASN1_i2d_bio_of_const
|
||||
ASN1_i2d_fp ASN1_i2d_fp_of ASN1_i2d_fp_of_const
|
||||
ASN1_LONG_UNDEF
|
||||
BIT_STRING_BITNAME
|
||||
ub_title
|
||||
V_ASN1_PRIMATIVE_TAG
|
||||
X509_algor_st
|
||||
)],
|
||||
bio => [qw(
|
||||
asn1_ps_func
|
||||
BIO_C_GET_PROXY_PARAM BIO_C_GET_SOCKS
|
||||
BIO_C_SET_PROXY_PARAM BIO_C_SET_SOCKS
|
||||
BIO_get_no_connect_return BIO_get_proxies
|
||||
@ -59,7 +61,6 @@ my %obsolete = (
|
||||
)],
|
||||
bn => [qw(
|
||||
BN_HEX_FMT1 BN_HEX_FMT2 BN_MASK
|
||||
BN_options BN_prime_checks
|
||||
)],
|
||||
objects => [qw(
|
||||
_DECLARE_OBJ_BSEARCH_CMP_FN
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: tlsfuzzer.py,v 1.50 2023/07/02 17:21:33 beck Exp $
|
||||
# $OpenBSD: tlsfuzzer.py,v 1.51 2023/08/03 20:13:12 tb Exp $
|
||||
#
|
||||
# Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
|
||||
#
|
||||
@ -385,6 +385,12 @@ tls12_tests = TestGroup("TLSv1.2 tests", [
|
||||
"-e", "2^14 bytes of AppData with 256 bytes of padding (SHA1 + Encrypt then MAC)",
|
||||
]
|
||||
),
|
||||
Test(
|
||||
"test-ccs.py", [
|
||||
"-x", "two bytes long CCS",
|
||||
"-X", "does not match received \"decode_error\"",
|
||||
]
|
||||
),
|
||||
Test(
|
||||
"test-dhe-rsa-key-exchange-signatures.py", [
|
||||
"-e", "TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA sha224 signature",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ca.c,v 1.95 2023/06/28 14:10:24 tobhe Exp $ */
|
||||
/* $OpenBSD: ca.c,v 1.96 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
|
||||
@ -207,7 +207,7 @@ int
|
||||
ca_certbundle_add(struct ibuf *buf, struct iked_id *id)
|
||||
{
|
||||
uint8_t type = id->id_type;
|
||||
size_t len = ibuf_length(id->id_buf);
|
||||
size_t len = ibuf_size(id->id_buf);
|
||||
void *val = ibuf_data(id->id_buf);
|
||||
|
||||
if (id == NULL ||
|
||||
@ -416,16 +416,16 @@ ca_setcert(struct iked *env, struct iked_sahdr *sh, struct iked_id *id,
|
||||
/* Must send the cert and a valid Id to the ca process */
|
||||
if (procid == PROC_CERT) {
|
||||
if (id == NULL || id->id_type == IKEV2_ID_NONE ||
|
||||
ibuf_length(id->id_buf) > IKED_ID_SIZE)
|
||||
ibuf_size(id->id_buf) > IKED_ID_SIZE)
|
||||
return (-1);
|
||||
bzero(&idb, sizeof(idb));
|
||||
|
||||
/* Convert to a static Id */
|
||||
idb.id_type = id->id_type;
|
||||
idb.id_offset = id->id_offset;
|
||||
idb.id_length = ibuf_length(id->id_buf);
|
||||
idb.id_length = ibuf_size(id->id_buf);
|
||||
memcpy(&idb.id_data, ibuf_data(id->id_buf),
|
||||
ibuf_length(id->id_buf));
|
||||
ibuf_size(id->id_buf));
|
||||
|
||||
iov[iovcnt].iov_base = &idb;
|
||||
iov[iovcnt].iov_len = sizeof(idb);
|
||||
@ -491,13 +491,13 @@ ca_setreq(struct iked *env, struct iked_sa *sa,
|
||||
if (ikev2_policy2id(localid, &id, 1) != 0)
|
||||
return (-1);
|
||||
|
||||
if (ibuf_length(id.id_buf) > IKED_ID_SIZE)
|
||||
if (ibuf_size(id.id_buf) > IKED_ID_SIZE)
|
||||
return (-1);
|
||||
bzero(&idb, sizeof(idb));
|
||||
idb.id_type = id.id_type;
|
||||
idb.id_offset = id.id_offset;
|
||||
idb.id_length = ibuf_length(id.id_buf);
|
||||
memcpy(&idb.id_data, ibuf_data(id.id_buf), ibuf_length(id.id_buf));
|
||||
idb.id_length = ibuf_size(id.id_buf);
|
||||
memcpy(&idb.id_data, ibuf_data(id.id_buf), ibuf_size(id.id_buf));
|
||||
iov[iovcnt].iov_base = &idb;
|
||||
iov[iovcnt].iov_len = sizeof(idb);
|
||||
iovcnt++;
|
||||
@ -637,7 +637,7 @@ ca_getcert(struct iked *env, struct imsg *imsg)
|
||||
ret = ca_pubkey_serialize(certkey, &key);
|
||||
if (ret == 0) {
|
||||
ptr = ibuf_data(key.id_buf);
|
||||
len = ibuf_length(key.id_buf);
|
||||
len = ibuf_size(key.id_buf);
|
||||
type = key.id_type;
|
||||
break;
|
||||
}
|
||||
@ -668,7 +668,7 @@ ca_getcert(struct iked *env, struct imsg *imsg)
|
||||
ret = ca_validate_pubkey(env, &id, NULL, 0, &key);
|
||||
if (ret == 0) {
|
||||
ptr = ibuf_data(key.id_buf);
|
||||
len = ibuf_length(key.id_buf);
|
||||
len = ibuf_size(key.id_buf);
|
||||
type = key.id_type;
|
||||
}
|
||||
break;
|
||||
@ -1060,18 +1060,18 @@ ca_reload(struct iked *env)
|
||||
}
|
||||
}
|
||||
|
||||
if (ibuf_length(env->sc_certreq)) {
|
||||
if (ibuf_size(env->sc_certreq)) {
|
||||
env->sc_certreqtype = IKEV2_CERT_X509_CERT;
|
||||
iov[0].iov_base = &env->sc_certreqtype;
|
||||
iov[0].iov_len = sizeof(env->sc_certreqtype);
|
||||
iovcnt++;
|
||||
iov[1].iov_base = ibuf_data(env->sc_certreq);
|
||||
iov[1].iov_len = ibuf_length(env->sc_certreq);
|
||||
iov[1].iov_len = ibuf_size(env->sc_certreq);
|
||||
iovcnt++;
|
||||
|
||||
log_debug("%s: loaded %zu ca certificate%s", __func__,
|
||||
ibuf_length(env->sc_certreq) / SHA_DIGEST_LENGTH,
|
||||
ibuf_length(env->sc_certreq) == SHA_DIGEST_LENGTH ?
|
||||
ibuf_size(env->sc_certreq) / SHA_DIGEST_LENGTH,
|
||||
ibuf_size(env->sc_certreq) == SHA_DIGEST_LENGTH ?
|
||||
"" : "s");
|
||||
|
||||
(void)proc_composev(&env->sc_ps, PROC_IKEV2, IMSG_CERTREQ,
|
||||
@ -1252,7 +1252,7 @@ ca_cert_local(struct iked *env, X509 *cert)
|
||||
int ret = 0;
|
||||
|
||||
if ((localpub = ca_bytes_to_pkey(ibuf_data(store->ca_pubkey.id_buf),
|
||||
ibuf_length(store->ca_pubkey.id_buf))) == NULL)
|
||||
ibuf_size(store->ca_pubkey.id_buf))) == NULL)
|
||||
goto done;
|
||||
|
||||
if ((certkey = X509_get0_pubkey(cert)) == NULL) {
|
||||
@ -1579,7 +1579,7 @@ ca_privkey_to_method(struct iked_id *privkey)
|
||||
break;
|
||||
case IKEV2_CERT_ECDSA:
|
||||
if ((rawcert = BIO_new_mem_buf(ibuf_data(privkey->id_buf),
|
||||
ibuf_length(privkey->id_buf))) == NULL)
|
||||
ibuf_size(privkey->id_buf))) == NULL)
|
||||
goto out;
|
||||
if ((ec = d2i_ECPrivateKey_bio(rawcert, NULL)) == NULL)
|
||||
goto out;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: config.c,v 1.92 2023/05/23 13:12:19 claudio Exp $ */
|
||||
/* $OpenBSD: config.c,v 1.93 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
|
||||
@ -1042,7 +1042,7 @@ config_setkeys(struct iked *env)
|
||||
iov[0].iov_base = &privkey;
|
||||
iov[0].iov_len = sizeof(privkey);
|
||||
iov[1].iov_base = ibuf_data(privkey.id_buf);
|
||||
iov[1].iov_len = ibuf_length(privkey.id_buf);
|
||||
iov[1].iov_len = ibuf_size(privkey.id_buf);
|
||||
|
||||
if (proc_composev(&env->sc_ps, PROC_CERT, IMSG_PRIVKEY, iov, 2) == -1) {
|
||||
log_warnx("%s: failed to send private key", __func__);
|
||||
@ -1052,7 +1052,7 @@ config_setkeys(struct iked *env)
|
||||
iov[0].iov_base = &pubkey;
|
||||
iov[0].iov_len = sizeof(pubkey);
|
||||
iov[1].iov_base = ibuf_data(pubkey.id_buf);
|
||||
iov[1].iov_len = ibuf_length(pubkey.id_buf);
|
||||
iov[1].iov_len = ibuf_size(pubkey.id_buf);
|
||||
|
||||
if (proc_composev(&env->sc_ps, PROC_CERT, IMSG_PUBKEY, iov, 2) == -1) {
|
||||
log_warnx("%s: failed to send public key", __func__);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: crypto.c,v 1.45 2023/07/28 07:31:38 claudio Exp $ */
|
||||
/* $OpenBSD: crypto.c,v 1.46 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
|
||||
@ -328,7 +328,7 @@ void
|
||||
hash_init(struct iked_hash *hash)
|
||||
{
|
||||
HMAC_Init_ex(hash->hash_ctx, ibuf_data(hash->hash_key),
|
||||
ibuf_length(hash->hash_key), hash->hash_priv, NULL);
|
||||
ibuf_size(hash->hash_key), hash->hash_priv, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -923,7 +923,7 @@ dsa_init(struct iked_dsa *dsa, const void *buf, size_t len)
|
||||
|
||||
if (dsa->dsa_hmac) {
|
||||
if (!HMAC_Init_ex(dsa->dsa_ctx, ibuf_data(dsa->dsa_keydata),
|
||||
ibuf_length(dsa->dsa_keydata), dsa->dsa_priv, NULL))
|
||||
ibuf_size(dsa->dsa_keydata), dsa->dsa_priv, NULL))
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ikev2.c,v 1.376 2023/07/28 11:23:03 claudio Exp $ */
|
||||
/* $OpenBSD: ikev2.c,v 1.377 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
|
||||
@ -671,7 +671,7 @@ ikev2_recv(struct iked *env, struct iked_message *msg)
|
||||
msg->msg_msgid,
|
||||
print_addr(&msg->msg_peer),
|
||||
print_addr(&msg->msg_local),
|
||||
ibuf_length(msg->msg_data),
|
||||
ibuf_size(msg->msg_data),
|
||||
msg->msg_policy->pol_name);
|
||||
log_debug("%s: ispi %s rspi %s", __func__,
|
||||
print_spi(betoh64(hdr->ike_ispi), 8),
|
||||
@ -733,9 +733,9 @@ ikev2_recv(struct iked *env, struct iked_message *msg)
|
||||
if (sa->sa_state == IKEV2_STATE_CLOSED && sa->sa_1stmsg &&
|
||||
hdr->ike_exchange == IKEV2_EXCHANGE_IKE_SA_INIT &&
|
||||
msg->msg_msgid == 0 &&
|
||||
(ibuf_length(msg->msg_data) != ibuf_length(sa->sa_1stmsg) ||
|
||||
(ibuf_size(msg->msg_data) != ibuf_size(sa->sa_1stmsg) ||
|
||||
memcmp(ibuf_data(msg->msg_data), ibuf_data(sa->sa_1stmsg),
|
||||
ibuf_length(sa->sa_1stmsg)) != 0)) {
|
||||
ibuf_size(sa->sa_1stmsg)) != 0)) {
|
||||
ikev2_ike_sa_setreason(sa, NULL);
|
||||
sa_free(env, sa);
|
||||
msg->msg_sa = sa = NULL;
|
||||
@ -897,7 +897,7 @@ ikev2_auth_verify(struct iked *env, struct iked_sa *sa)
|
||||
|
||||
ret = ikev2_msg_authverify(env, sa, &ikeauth,
|
||||
ibuf_data(sa->sa_peerauth.id_buf),
|
||||
ibuf_length(sa->sa_peerauth.id_buf),
|
||||
ibuf_size(sa->sa_peerauth.id_buf),
|
||||
authmsg);
|
||||
ibuf_free(authmsg);
|
||||
if (ret != 0) {
|
||||
@ -1115,7 +1115,7 @@ ikev2_ike_auth_recv(struct iked *env, struct iked_sa *sa,
|
||||
if (msg->msg_cert.id_type) {
|
||||
certtype = msg->msg_cert.id_type;
|
||||
cert = ibuf_data(msg->msg_cert.id_buf);
|
||||
certlen = ibuf_length(msg->msg_cert.id_buf);
|
||||
certlen = ibuf_size(msg->msg_cert.id_buf);
|
||||
}
|
||||
sa->sa_stateflags &= ~IKED_REQ_CERTVALID;
|
||||
if (ca_setcert(env, &sa->sa_hdr, id, certtype, cert, certlen, PROC_CERT) == -1)
|
||||
@ -1471,7 +1471,7 @@ ikev2_init_ike_sa_peer(struct iked *env, struct iked_policy *pol,
|
||||
ke->kex_dhgroup = htobe16(group->id);
|
||||
if (ikev2_add_buf(buf, sa->sa_dhiexchange) == -1)
|
||||
goto done;
|
||||
len = sizeof(*ke) + ibuf_length(sa->sa_dhiexchange);
|
||||
len = sizeof(*ke) + ibuf_size(sa->sa_dhiexchange);
|
||||
|
||||
if (ikev2_next_payload(pld, len, IKEV2_PAYLOAD_NONCE) == -1)
|
||||
goto done;
|
||||
@ -2215,7 +2215,7 @@ ikev2_add_vendor_id(struct ibuf *e, struct ikev2_payload **pld,
|
||||
if (ibuf_add_buf(e, id) == -1)
|
||||
return (-1);
|
||||
|
||||
return (ibuf_length(id));
|
||||
return (ibuf_size(id));
|
||||
}
|
||||
|
||||
ssize_t
|
||||
@ -3744,7 +3744,7 @@ ikev2_handle_certreq(struct iked* env, struct iked_message *msg)
|
||||
|
||||
ca_setreq(env, sa, &sa->sa_policy->pol_localid,
|
||||
cr->cr_type, more, ibuf_data(cr->cr_data),
|
||||
ibuf_length(cr->cr_data),
|
||||
ibuf_size(cr->cr_data),
|
||||
PROC_CERT);
|
||||
|
||||
ibuf_free(cr->cr_data);
|
||||
@ -4210,7 +4210,7 @@ ikev2_send_create_child_sa(struct iked *env, struct iked_sa *sa,
|
||||
ke->kex_dhgroup = htobe16(group->id);
|
||||
if (ikev2_add_buf(e, sa->sa_dhiexchange) == -1)
|
||||
goto done;
|
||||
len = sizeof(*ke) + ibuf_length(sa->sa_dhiexchange);
|
||||
len = sizeof(*ke) + ibuf_size(sa->sa_dhiexchange);
|
||||
}
|
||||
|
||||
if ((len = ikev2_add_ts(e, &pld, len, sa, !initiator)) == -1)
|
||||
@ -4343,7 +4343,7 @@ ikev2_ike_sa_rekey(struct iked *env, void *arg)
|
||||
ke->kex_dhgroup = htobe16(group->id);
|
||||
if (ikev2_add_buf(e, nsa->sa_dhiexchange) == -1)
|
||||
goto done;
|
||||
len = sizeof(*ke) + ibuf_length(nsa->sa_dhiexchange);
|
||||
len = sizeof(*ke) + ibuf_size(nsa->sa_dhiexchange);
|
||||
|
||||
if (ikev2_next_payload(pld, len, IKEV2_PAYLOAD_NONE) == -1)
|
||||
goto done;
|
||||
@ -4377,8 +4377,8 @@ ikev2_nonce_cmp(struct ibuf *a, struct ibuf *b)
|
||||
size_t alen, blen, len;
|
||||
int ret;
|
||||
|
||||
alen = ibuf_length(a);
|
||||
blen = ibuf_length(b);
|
||||
alen = ibuf_size(a);
|
||||
blen = ibuf_size(b);
|
||||
len = MINIMUM(alen, blen);
|
||||
ret = memcmp(ibuf_data(a), ibuf_data(b), len);
|
||||
if (ret == 0)
|
||||
@ -5078,7 +5078,7 @@ ikev2_resp_create_child_sa(struct iked *env, struct iked_message *msg)
|
||||
ke->kex_dhgroup = htobe16(kex->kex_dhgroup->id);
|
||||
if (ikev2_add_buf(e, kex->kex_dhrexchange) == -1)
|
||||
goto done;
|
||||
len = sizeof(*ke) + ibuf_length(kex->kex_dhrexchange);
|
||||
len = sizeof(*ke) + ibuf_size(kex->kex_dhrexchange);
|
||||
}
|
||||
|
||||
if (protoid != IKEV2_SAPROTO_IKE)
|
||||
@ -5641,7 +5641,7 @@ ikev2_sa_responder(struct iked *env, struct iked_sa *sa, struct iked_sa *osa,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (!ibuf_length(sa->sa_rnonce) &&
|
||||
if (sa->sa_rnonce == NULL &&
|
||||
(sa->sa_rnonce = ibuf_random(IKED_NONCE_SIZE)) == NULL) {
|
||||
log_debug("%s: failed to get local nonce", __func__);
|
||||
return (-1);
|
||||
@ -5737,7 +5737,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key)
|
||||
}
|
||||
|
||||
log_debug("%s: DHSECRET with %zu bytes", SPI_SA(sa, __func__),
|
||||
ibuf_length(dhsecret));
|
||||
ibuf_size(dhsecret));
|
||||
print_hexbuf(dhsecret);
|
||||
|
||||
if (!key) {
|
||||
@ -5763,7 +5763,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key)
|
||||
}
|
||||
}
|
||||
|
||||
if ((hash_setkey(prf, ibuf_data(key), ibuf_length(key))) == NULL) {
|
||||
if ((hash_setkey(prf, ibuf_data(key), ibuf_size(key))) == NULL) {
|
||||
log_info("%s: failed to set prf key", SPI_SA(sa, __func__));
|
||||
goto done;
|
||||
}
|
||||
@ -5776,7 +5776,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key)
|
||||
|
||||
tmplen = 0;
|
||||
hash_init(prf);
|
||||
hash_update(prf, ibuf_data(dhsecret), ibuf_length(dhsecret));
|
||||
hash_update(prf, ibuf_data(dhsecret), ibuf_size(dhsecret));
|
||||
hash_final(prf, ibuf_data(skeyseed), &tmplen);
|
||||
|
||||
log_debug("%s: SKEYSEED with %zu bytes", __func__, tmplen);
|
||||
@ -5809,7 +5809,7 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key)
|
||||
goto done;
|
||||
}
|
||||
|
||||
log_debug("%s: S with %zu bytes", SPI_SA(sa, __func__), ibuf_length(s));
|
||||
log_debug("%s: S with %zu bytes", SPI_SA(sa, __func__), ibuf_size(s));
|
||||
print_hexbuf(s);
|
||||
|
||||
/*
|
||||
@ -5848,28 +5848,27 @@ ikev2_sa_keys(struct iked *env, struct iked_sa *sa, struct ibuf *key)
|
||||
goto done;
|
||||
}
|
||||
|
||||
log_debug("%s: SK_d with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_d));
|
||||
log_debug("%s: SK_d with %zu bytes", __func__, ibuf_size(sa->sa_key_d));
|
||||
print_hexbuf(sa->sa_key_d);
|
||||
if (!isaead) {
|
||||
log_debug("%s: SK_ai with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_iauth));
|
||||
ibuf_size(sa->sa_key_iauth));
|
||||
print_hexbuf(sa->sa_key_iauth);
|
||||
log_debug("%s: SK_ar with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_rauth));
|
||||
ibuf_size(sa->sa_key_rauth));
|
||||
print_hexbuf(sa->sa_key_rauth);
|
||||
}
|
||||
log_debug("%s: SK_ei with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_iencr));
|
||||
ibuf_size(sa->sa_key_iencr));
|
||||
print_hexbuf(sa->sa_key_iencr);
|
||||
log_debug("%s: SK_er with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_rencr));
|
||||
ibuf_size(sa->sa_key_rencr));
|
||||
print_hexbuf(sa->sa_key_rencr);
|
||||
log_debug("%s: SK_pi with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_iprf));
|
||||
ibuf_size(sa->sa_key_iprf));
|
||||
print_hexbuf(sa->sa_key_iprf);
|
||||
log_debug("%s: SK_pr with %zu bytes", __func__,
|
||||
ibuf_length(sa->sa_key_rprf));
|
||||
ibuf_size(sa->sa_key_rprf));
|
||||
print_hexbuf(sa->sa_key_rprf);
|
||||
|
||||
ret = 0;
|
||||
@ -5928,7 +5927,7 @@ ikev2_prfplus(struct iked_hash *prf, struct ibuf *key, struct ibuf *seed,
|
||||
|
||||
for (i = 0; i < rlen; i++) {
|
||||
if (t1 != NULL) {
|
||||
t2 = ibuf_new(ibuf_data(t1), ibuf_length(t1));
|
||||
t2 = ibuf_new(ibuf_data(t1), ibuf_size(t1));
|
||||
ibuf_free(t1);
|
||||
} else
|
||||
t2 = ibuf_new(NULL, 0);
|
||||
@ -5939,7 +5938,7 @@ ikev2_prfplus(struct iked_hash *prf, struct ibuf *key, struct ibuf *seed,
|
||||
ibuf_add(t2, &pad, 1);
|
||||
|
||||
hash_init(prf);
|
||||
hash_update(prf, ibuf_data(t2), ibuf_length(t2));
|
||||
hash_update(prf, ibuf_data(t2), ibuf_size(t2));
|
||||
hash_final(prf, ibuf_data(t1), &hashlen);
|
||||
|
||||
if (hashlen != hash_length(prf))
|
||||
@ -5949,11 +5948,11 @@ ikev2_prfplus(struct iked_hash *prf, struct ibuf *key, struct ibuf *seed,
|
||||
ibuf_add_buf(t, t1);
|
||||
|
||||
log_debug("%s: T%d with %zu bytes", __func__,
|
||||
pad, ibuf_length(t1));
|
||||
pad, ibuf_size(t1));
|
||||
print_hexbuf(t1);
|
||||
}
|
||||
|
||||
log_debug("%s: Tn with %zu bytes", __func__, ibuf_length(t));
|
||||
log_debug("%s: Tn with %zu bytes", __func__, ibuf_size(t));
|
||||
print_hexbuf(t);
|
||||
|
||||
ibuf_free(t1);
|
||||
@ -6179,7 +6178,7 @@ ikev2_childsa_negotiate(struct iked *env, struct iked_sa *sa,
|
||||
if (pfs) {
|
||||
log_debug("%s: using PFS", __func__);
|
||||
if (kex->kex_dhpeer == NULL ||
|
||||
ibuf_length(kex->kex_dhpeer) == 0 ||
|
||||
ibuf_size(kex->kex_dhpeer) == 0 ||
|
||||
(group = kex->kex_dhgroup) == NULL) {
|
||||
log_debug("%s: no dh group for pfs", __func__);
|
||||
goto done;
|
||||
@ -7649,7 +7648,7 @@ ikev2_log_cert_info(const char *msg, struct iked_id *certid)
|
||||
certid->id_buf == NULL)
|
||||
return;
|
||||
if ((rawcert = BIO_new_mem_buf(ibuf_data(certid->id_buf),
|
||||
ibuf_length(certid->id_buf))) == NULL ||
|
||||
ibuf_size(certid->id_buf))) == NULL ||
|
||||
(cert = d2i_X509_bio(rawcert, NULL)) == NULL)
|
||||
goto out;
|
||||
ca_cert_info(msg, cert);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ikev2_msg.c,v 1.99 2023/07/28 11:23:03 claudio Exp $ */
|
||||
/* $OpenBSD: ikev2_msg.c,v 1.100 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
|
||||
@ -292,7 +292,7 @@ ikev2_msg_send(struct iked *env, struct iked_message *msg)
|
||||
betoh32(hdr->ike_msgid),
|
||||
print_addr(&msg->msg_peer),
|
||||
print_addr(&msg->msg_local),
|
||||
ibuf_length(buf), isnatt ? ", NAT-T" : "");
|
||||
ibuf_size(buf), isnatt ? ", NAT-T" : "");
|
||||
|
||||
if (isnatt) {
|
||||
struct ibuf *new;
|
||||
@ -448,7 +448,7 @@ ikev2_msg_encrypt(struct iked *env, struct iked_sa *sa, struct ibuf *src,
|
||||
log_debug("%s: padded length %zu", __func__, ibuf_size(src));
|
||||
print_hexbuf(src);
|
||||
|
||||
cipher_setkey(sa->sa_encr, ibuf_data(encr), ibuf_length(encr));
|
||||
cipher_setkey(sa->sa_encr, ibuf_data(encr), ibuf_size(encr));
|
||||
cipher_setiv(sa->sa_encr, NULL, 0); /* XXX ivlen */
|
||||
if (cipher_init_encrypt(sa->sa_encr) == -1) {
|
||||
log_info("%s: error initiating cipher.", __func__);
|
||||
@ -466,8 +466,8 @@ ikev2_msg_encrypt(struct iked *env, struct iked_sa *sa, struct ibuf *src,
|
||||
|
||||
/* Add AAD for AEAD ciphers */
|
||||
if (sa->sa_integr->hash_isaead)
|
||||
cipher_aad(sa->sa_encr, ibuf_data(aad),
|
||||
ibuf_length(aad), &outlen);
|
||||
cipher_aad(sa->sa_encr, ibuf_data(aad), ibuf_size(aad),
|
||||
&outlen);
|
||||
|
||||
if (cipher_update(sa->sa_encr, ibuf_data(src), encrlen,
|
||||
ibuf_data(out), &outlen) == -1) {
|
||||
@ -620,7 +620,7 @@ ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa,
|
||||
goto done;
|
||||
|
||||
hash_setkey(sa->sa_integr, ibuf_data(integr),
|
||||
ibuf_length(integr));
|
||||
ibuf_size(integr));
|
||||
hash_init(sa->sa_integr);
|
||||
hash_update(sa->sa_integr, ibuf_data(msg),
|
||||
ibuf_size(msg) - integrlen);
|
||||
@ -649,7 +649,7 @@ ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa,
|
||||
goto done;
|
||||
}
|
||||
|
||||
cipher_setkey(sa->sa_encr, ibuf_data(encr), ibuf_length(encr));
|
||||
cipher_setkey(sa->sa_encr, ibuf_data(encr), ibuf_size(encr));
|
||||
cipher_setiv(sa->sa_encr, ibuf_seek(src, ivoff, ivlen), ivlen);
|
||||
if (cipher_init_decrypt(sa->sa_encr) == -1) {
|
||||
log_info("%s: error initiating cipher.", __func__);
|
||||
@ -675,13 +675,14 @@ ikev2_msg_decrypt(struct iked *env, struct iked_sa *sa,
|
||||
* Add additional authenticated data for AEAD ciphers
|
||||
*/
|
||||
if (sa->sa_integr->hash_isaead) {
|
||||
log_debug("%s: AAD length %zu", __func__, ibuf_length(msg) - ibuf_length(src));
|
||||
print_hex(ibuf_data(msg), 0, ibuf_length(msg) - ibuf_length(src));
|
||||
log_debug("%s: AAD length %zu", __func__,
|
||||
ibuf_size(msg) - ibuf_size(src));
|
||||
print_hex(ibuf_data(msg), 0, ibuf_size(msg) - ibuf_size(src));
|
||||
cipher_aad(sa->sa_encr, ibuf_data(msg),
|
||||
ibuf_length(msg) - ibuf_length(src), &outlen);
|
||||
ibuf_size(msg) - ibuf_size(src), &outlen);
|
||||
}
|
||||
|
||||
if ((outlen = ibuf_length(out)) != 0) {
|
||||
if ((outlen = ibuf_size(out)) != 0) {
|
||||
if (cipher_update(sa->sa_encr, ibuf_seek(src, encroff, encrlen),
|
||||
encrlen, ibuf_data(out), &outlen) == -1) {
|
||||
log_info("%s: error updating cipher.", __func__);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ikev2_pld.c,v 1.131 2023/06/28 14:10:24 tobhe Exp $ */
|
||||
/* $OpenBSD: ikev2_pld.c,v 1.132 2023/08/04 19:06:25 claudio Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
|
||||
@ -685,7 +685,7 @@ ikev2_pld_ke(struct iked *env, struct ikev2_payload *pld,
|
||||
print_hex(buf, 0, len);
|
||||
|
||||
if (ikev2_msg_frompeer(msg)) {
|
||||
if (ibuf_length(msg->msg_parent->msg_ke)) {
|
||||
if (msg->msg_parent->msg_ke != NULL) {
|
||||
log_info("%s: duplicate KE payload", __func__);
|
||||
return (-1);
|
||||
}
|
||||
@ -1008,7 +1008,7 @@ ikev2_pld_nonce(struct iked *env, struct ikev2_payload *pld,
|
||||
print_hex(buf, 0, len);
|
||||
|
||||
if (ikev2_msg_frompeer(msg)) {
|
||||
if (ibuf_length(msg->msg_parent->msg_nonce)) {
|
||||
if (msg->msg_parent->msg_nonce != NULL) {
|
||||
log_info("%s: duplicate NONCE payload", __func__);
|
||||
return (-1);
|
||||
}
|
||||
@ -1665,7 +1665,7 @@ ikev2_pld_ef(struct iked *env, struct ikev2_payload *pld,
|
||||
__func__, frag_num, frag_total);
|
||||
goto done;
|
||||
}
|
||||
elen = ibuf_length(e);
|
||||
elen = ibuf_size(e);
|
||||
|
||||
/* Check new fragmented message */
|
||||
if (sa_frag->frag_arr == NULL) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ike.c,v 1.83 2022/06/25 20:33:40 mbuhl Exp $ */
|
||||
/* $OpenBSD: ike.c,v 1.84 2023/08/07 04:10:08 dlg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
|
||||
*
|
||||
@ -148,6 +148,10 @@ ike_section_ipsec(struct ipsec_rule *r, FILE *fd)
|
||||
|
||||
if (r->tag)
|
||||
fprintf(fd, SET "[%s]:PF-Tag=%s force\n", r->p2name, r->tag);
|
||||
if (r->flags & IPSEC_RULE_F_IFACE) {
|
||||
fprintf(fd, SET "[%s]:Interface=%u force\n", r->p2name,
|
||||
r->iface);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -842,21 +846,30 @@ ike_setup_ids(struct ipsec_rule *r)
|
||||
err(1, "ike_setup_ids");
|
||||
|
||||
/* Phase 2 name is from and to network, protocol, port*/
|
||||
sproto[0] = ssport[0] = sdport[0] = 0;
|
||||
if (r->proto)
|
||||
snprintf(sproto, sizeof sproto, "=%u", r->proto);
|
||||
if (r->sport)
|
||||
snprintf(ssport, sizeof ssport, ":%u", ntohs(r->sport));
|
||||
if (r->dport)
|
||||
snprintf(sdport, sizeof sdport, ":%u", ntohs(r->dport));
|
||||
/* from-network/masklen=proto:port */
|
||||
if (asprintf(&r->p2lid, "from-%s%s%s", r->src->name, sproto, ssport)
|
||||
== -1)
|
||||
err(1, "ike_setup_ids");
|
||||
/* to-network/masklen=proto:port */
|
||||
if (asprintf(&r->p2rid, "to-%s%s%s", r->dst->name, sproto, sdport)
|
||||
== -1)
|
||||
err(1, "ike_setup_ids");
|
||||
if (r->flags & IPSEC_RULE_F_IFACE) {
|
||||
if (asprintf(&r->p2lid, "from-sec%u", r->iface) == -1)
|
||||
err(1, "ike_setup_ids");
|
||||
if (asprintf(&r->p2rid, "to-sec%u", r->iface) == -1)
|
||||
err(1, "ike_setup_ids");
|
||||
} else {
|
||||
sproto[0] = ssport[0] = sdport[0] = 0;
|
||||
if (r->proto)
|
||||
snprintf(sproto, sizeof sproto, "=%u", r->proto);
|
||||
if (r->sport)
|
||||
snprintf(ssport, sizeof ssport, ":%u", ntohs(r->sport));
|
||||
if (r->dport)
|
||||
snprintf(sdport, sizeof sdport, ":%u", ntohs(r->dport));
|
||||
|
||||
/* from-network/masklen=proto:port */
|
||||
if (asprintf(&r->p2lid, "from-%s%s%s", r->src->name,
|
||||
sproto, ssport) == -1)
|
||||
err(1, "ike_setup_ids");
|
||||
/* to-network/masklen=proto:port */
|
||||
if (asprintf(&r->p2rid, "to-%s%s%s", r->dst->name,
|
||||
sproto, sdport) == -1)
|
||||
err(1, "ike_setup_ids");
|
||||
}
|
||||
|
||||
/* from-network/masklen=proto:port-to-network/masklen=proto:port */
|
||||
if (asprintf(&r->p2name, "%s-%s", r->p2lid , r->p2rid) == -1)
|
||||
err(1, "ike_setup_ids");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ipsecctl.h,v 1.75 2021/10/22 12:30:54 bluhm Exp $ */
|
||||
/* $OpenBSD: ipsecctl.h,v 1.76 2023/08/07 04:10:08 dlg Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
|
||||
*
|
||||
@ -178,6 +178,9 @@ TAILQ_HEAD(dst_bundle_queue, ipsec_rule);
|
||||
struct ipsec_rule {
|
||||
u_int8_t type;
|
||||
|
||||
unsigned int flags;
|
||||
#define IPSEC_RULE_F_IFACE (1 << 0) /* iface is valid */
|
||||
|
||||
struct ipsec_addr_wrap *src;
|
||||
struct ipsec_addr_wrap *dst;
|
||||
struct ipsec_addr_wrap *dst2;
|
||||
@ -215,6 +218,7 @@ struct ipsec_rule {
|
||||
u_int32_t spi;
|
||||
u_int32_t spi2;
|
||||
u_int32_t nr;
|
||||
unsigned int iface;
|
||||
|
||||
TAILQ_ENTRY(ipsec_rule) rule_entry;
|
||||
TAILQ_ENTRY(ipsec_rule) bundle_entry;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: parse.y,v 1.182 2023/04/19 13:33:37 jsg Exp $ */
|
||||
/* $OpenBSD: parse.y,v 1.183 2023/08/07 04:10:08 dlg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
|
||||
@ -232,6 +232,7 @@ struct ipsec_transforms *ipsec_transforms;
|
||||
typedef struct {
|
||||
union {
|
||||
int64_t number;
|
||||
uint32_t unit;
|
||||
u_int8_t ikemode;
|
||||
u_int8_t dir;
|
||||
u_int8_t satype; /* encapsulating prococol */
|
||||
@ -284,9 +285,10 @@ typedef struct {
|
||||
%token AUTHKEY ENCKEY FILENAME AUTHXF ENCXF ERROR IKE MAIN QUICK AGGRESSIVE
|
||||
%token PASSIVE ACTIVE ANY IPIP IPCOMP COMPXF TUNNEL TRANSPORT DYNAMIC LIFETIME
|
||||
%token TYPE DENY BYPASS LOCAL PROTO USE ACQUIRE REQUIRE DONTACQ GROUP PORT TAG
|
||||
%token INCLUDE BUNDLE UDPENCAP
|
||||
%token INCLUDE BUNDLE UDPENCAP INTERFACE
|
||||
%token <v.string> STRING
|
||||
%token <v.number> NUMBER
|
||||
%type <v.unit> iface
|
||||
%type <v.string> string
|
||||
%type <v.dir> dir
|
||||
%type <v.satype> satype
|
||||
@ -401,6 +403,41 @@ ikerule : IKE ikemode satype tmode proto hosts peers
|
||||
if (expand_rule(r, &$7, 0, 0, NULL, NULL, NULL))
|
||||
errx(1, "ikerule: expand_rule");
|
||||
}
|
||||
|
||||
/* ike interface sec0 local $h_self peer $h_s2s1 ... */
|
||||
| IKE ikemode iface peers
|
||||
phase1mode phase2mode ids ikeauth {
|
||||
uint8_t proto = 0; // IPPROTO_IPIP;
|
||||
struct ipsec_hosts hosts;
|
||||
struct ike_mode *phase1mode = $5;
|
||||
struct ike_mode *phase2mode = $6;
|
||||
uint8_t satype = IPSEC_ESP;
|
||||
uint8_t tmode = IPSEC_TUNNEL;
|
||||
uint8_t mode = $2;
|
||||
struct ike_auth *authtype = &$8;
|
||||
char *tag = NULL;
|
||||
|
||||
struct ipsec_rule *r;
|
||||
|
||||
hosts.src = host_v4("0.0.0.0/0", 1);
|
||||
hosts.sport = htons(0);
|
||||
hosts.dst = host_v4("0.0.0.0/0", 1);
|
||||
hosts.dport = htons(0);
|
||||
|
||||
r = create_ike(proto, &hosts, phase1mode, phase2mode,
|
||||
satype, tmode, mode, $7.srcid, $7.dstid,
|
||||
authtype, tag);
|
||||
if (r == NULL) {
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
r->flags |= IPSEC_RULE_F_IFACE;
|
||||
r->iface = $3;
|
||||
|
||||
if (expand_rule(r, &$4, 0, 0, NULL, NULL, NULL))
|
||||
errx(1, "ikerule: expand interface rule");
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
satype : /* empty */ { $$ = IPSEC_ESP; }
|
||||
@ -909,6 +946,30 @@ tag : /* empty */
|
||||
}
|
||||
;
|
||||
|
||||
iface : INTERFACE STRING {
|
||||
static const char prefix[] = "sec";
|
||||
const char *errstr = NULL;
|
||||
size_t len, plen;
|
||||
|
||||
plen = strlen(prefix);
|
||||
len = strlen($2);
|
||||
|
||||
if (len <= plen || memcmp($2, prefix, plen) != 0) {
|
||||
yyerror("invalid %s interface name", prefix);
|
||||
free($2);
|
||||
YYERROR;
|
||||
}
|
||||
|
||||
$$ = strtonum($2 + plen, 0, UINT_MAX, &errstr);
|
||||
free($2);
|
||||
if (errstr != NULL) {
|
||||
yyerror("invalid %s interface unit: %s",
|
||||
prefix, errstr);
|
||||
YYERROR;
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
string : string STRING
|
||||
{
|
||||
if (asprintf(&$$, "%s %s", $1, $2) == -1)
|
||||
@ -1009,6 +1070,7 @@ lookup(char *s)
|
||||
{ "ike", IKE },
|
||||
{ "in", IN },
|
||||
{ "include", INCLUDE },
|
||||
{ "interface", INTERFACE },
|
||||
{ "ipcomp", IPCOMP },
|
||||
{ "ipip", IPIP },
|
||||
{ "lifetime", LIFETIME },
|
||||
@ -2216,6 +2278,7 @@ copyrule(struct ipsec_rule *rule)
|
||||
r->enckey = copykey(rule->enckey);
|
||||
r->tag = copytag(rule->tag);
|
||||
|
||||
r->flags = rule->flags;
|
||||
r->p1ie = rule->p1ie;
|
||||
r->p2ie = rule->p2ie;
|
||||
r->type = rule->type;
|
||||
@ -2231,6 +2294,7 @@ copyrule(struct ipsec_rule *rule)
|
||||
r->udpencap = rule->udpencap;
|
||||
r->udpdport = rule->udpdport;
|
||||
r->nr = rule->nr;
|
||||
r->iface = rule->iface;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pfkdump.c,v 1.56 2023/03/07 17:43:59 guenther Exp $ */
|
||||
/* $OpenBSD: pfkdump.c,v 1.57 2023/08/07 04:10:08 dlg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Markus Friedl. All rights reserved.
|
||||
@ -62,6 +62,7 @@ static void print_mtu(struct sadb_ext *, struct sadb_msg *, int);
|
||||
static void print_tap(struct sadb_ext *, struct sadb_msg *, int);
|
||||
static void print_satype(struct sadb_ext *, struct sadb_msg *, int);
|
||||
static void print_counter(struct sadb_ext *, struct sadb_msg *, int);
|
||||
static void print_iface(struct sadb_ext *, struct sadb_msg *, int);
|
||||
|
||||
static struct idname *lookup(struct idname *, u_int32_t);
|
||||
static char *lookup_name(struct idname *, u_int32_t);
|
||||
@ -115,6 +116,7 @@ struct idname ext_types[] = {
|
||||
{ SADB_X_EXT_TAP, "tap", print_tap },
|
||||
{ SADB_X_EXT_SATYPE2, "satype2", print_satype },
|
||||
{ SADB_X_EXT_COUNTER, "counter", print_counter },
|
||||
{ SADB_X_EXT_IFACE, "interface", print_iface },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@ -463,6 +465,24 @@ print_counter(struct sadb_ext *ext, struct sadb_msg *msg, int opts)
|
||||
#undef plural
|
||||
}
|
||||
|
||||
static void
|
||||
print_iface(struct sadb_ext *ext, struct sadb_msg *msg, int opts)
|
||||
{
|
||||
struct sadb_x_iface *siface = (struct sadb_x_iface *)ext;
|
||||
const char *dir = "unknown";
|
||||
|
||||
switch (siface->sadb_x_iface_direction) {
|
||||
case IPSP_DIRECTION_IN:
|
||||
dir = "in";
|
||||
break;
|
||||
case IPSP_DIRECTION_OUT:
|
||||
dir = "out";
|
||||
break;
|
||||
}
|
||||
|
||||
printf("sec%u direction %s", siface->sadb_x_iface_unit, dir);
|
||||
}
|
||||
|
||||
static char *
|
||||
alg_by_ext(u_int8_t ext_type, u_int8_t id)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ipsec.c,v 1.152 2022/01/16 14:30:11 naddy Exp $ */
|
||||
/* $OpenBSD: ipsec.c,v 1.153 2023/08/07 04:01:29 dlg Exp $ */
|
||||
/* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */
|
||||
|
||||
/*
|
||||
@ -38,6 +38,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/pfvar.h>
|
||||
@ -131,6 +132,7 @@ static int ipsec_validate_transform_id(u_int8_t, u_int8_t);
|
||||
static int ipsec_sa_check_flow(struct sa *, void *);
|
||||
static int ipsec_sa_check_flow_any(struct sa *, void *);
|
||||
static int ipsec_sa_tag(struct exchange *, struct sa *, struct sa *);
|
||||
static int ipsec_sa_iface(struct exchange *, struct sa *, struct sa *);
|
||||
|
||||
static struct doi ipsec_doi = {
|
||||
{0}, IPSEC_DOI_IPSEC,
|
||||
@ -272,6 +274,12 @@ ipsec_sa_check_flow_any(struct sa *sa, void *v_arg)
|
||||
isa->dport != isa2->dport)
|
||||
return 0;
|
||||
|
||||
if ((sa->flags & SA_FLAG_IFACE) != (sa2->flags & SA_FLAG_IFACE))
|
||||
return 0;
|
||||
|
||||
if (sa->flags & SA_FLAG_IFACE)
|
||||
return sa->iface == sa2->iface;
|
||||
|
||||
/*
|
||||
* If at least one of the IPsec SAs is incomplete, we're done.
|
||||
*/
|
||||
@ -379,6 +387,30 @@ ipsec_sa_tag(struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
ipsec_sa_iface(struct exchange *exchange, struct sa *sa, struct sa *isakmp_sa)
|
||||
{
|
||||
char *section, *value;
|
||||
const char *errstr = NULL;
|
||||
|
||||
sa->tag = NULL;
|
||||
|
||||
if (exchange->name == NULL ||
|
||||
(section = exchange->name) == NULL ||
|
||||
(value = conf_get_str(section, "Interface")) == NULL)
|
||||
return (0); /* ignore if not present */
|
||||
|
||||
sa->iface = strtonum(value, 0, UINT_MAX, &errstr);
|
||||
if (errstr != NULL) {
|
||||
log_error("[%s]:Interface %s", section, errstr);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
sa->flags |= SA_FLAG_IFACE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do IPsec DOI specific finalizations task for the exchange where MSG was
|
||||
* the final message.
|
||||
@ -463,6 +495,9 @@ ipsec_finalize_exchange(struct message *msg)
|
||||
if (ipsec_sa_tag(exchange, sa, isakmp_sa) == -1)
|
||||
return;
|
||||
|
||||
if (ipsec_sa_iface(exchange, sa, isakmp_sa) == -1)
|
||||
return;
|
||||
|
||||
for (proto = TAILQ_FIRST(&sa->protos),
|
||||
last_proto = 0; proto;
|
||||
proto = TAILQ_NEXT(proto, link)) {
|
||||
@ -514,6 +549,7 @@ ipsec_finalize_exchange(struct message *msg)
|
||||
* (a.k.a. flow) set up.
|
||||
*/
|
||||
if (!(sa->flags & SA_FLAG_ONDEMAND ||
|
||||
sa->flags & SA_FLAG_IFACE ||
|
||||
conf_get_str("General", "Acquire-Only") ||
|
||||
acquire_only) &&
|
||||
pf_key_v2_enable_sa(sa, isakmp_sa))
|
||||
@ -1596,7 +1632,8 @@ ipsec_delete_spi(struct sa *sa, struct proto *proto, int incoming)
|
||||
* We ignore any errors from the disabling of the flow.
|
||||
*/
|
||||
if (sa->flags & SA_FLAG_READY && !(sa->flags & SA_FLAG_ONDEMAND ||
|
||||
sa->flags & SA_FLAG_REPLACED || acquire_only ||
|
||||
sa->flags & SA_FLAG_REPLACED || sa->flags & SA_FLAG_IFACE ||
|
||||
acquire_only ||
|
||||
conf_get_str("General", "Acquire-Only")))
|
||||
pf_key_v2_disable_sa(sa, incoming);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: pf_key_v2.c,v 1.204 2022/01/31 23:51:15 sthen Exp $ */
|
||||
/* $OpenBSD: pf_key_v2.c,v 1.205 2023/08/07 04:01:30 dlg Exp $ */
|
||||
/* $EOM: pf_key_v2.c,v 1.79 2000/12/12 00:33:19 niklas Exp $ */
|
||||
|
||||
/*
|
||||
@ -890,6 +890,7 @@ pf_key_v2_set_spi(struct sa *sa, struct proto *proto, int incoming,
|
||||
struct sadb_protocol flowtype, tprotocol;
|
||||
struct sadb_x_udpencap udpencap;
|
||||
char *addr_str, *s;
|
||||
char iface_str[32];
|
||||
|
||||
msg.sadb_msg_type = incoming ? SADB_UPDATE : SADB_ADD;
|
||||
switch (proto->proto) {
|
||||
@ -1378,16 +1379,37 @@ nodid:
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (sa->flags & SA_FLAG_IFACE) {
|
||||
struct sadb_x_iface *siface;
|
||||
|
||||
len = sizeof(*siface);
|
||||
siface = calloc(1, len);
|
||||
if (siface == NULL)
|
||||
goto cleanup;
|
||||
|
||||
siface->sadb_x_iface_len = len / PF_KEY_V2_CHUNK;
|
||||
siface->sadb_x_iface_exttype = SADB_X_EXT_IFACE;
|
||||
siface->sadb_x_iface_unit = sa->iface;
|
||||
siface->sadb_x_iface_direction = incoming ?
|
||||
IPSP_DIRECTION_IN : IPSP_DIRECTION_OUT;
|
||||
|
||||
if (pf_key_v2_msg_add(update, (struct sadb_ext *)siface,
|
||||
PF_KEY_V2_NODE_MALLOCED) == -1)
|
||||
goto cleanup;
|
||||
|
||||
snprintf(iface_str, sizeof(iface_str), "iface %u", sa->iface);
|
||||
}
|
||||
|
||||
/* XXX Here can sensitivity extensions be setup. */
|
||||
|
||||
if (sockaddr2text(dst, &addr_str, 0))
|
||||
addr_str = 0;
|
||||
|
||||
LOG_DBG((LOG_SYSDEP, 10, "pf_key_v2_set_spi: "
|
||||
"satype %d dst %s SPI 0x%x%s%s", msg.sadb_msg_satype,
|
||||
"satype %d dst %s SPI 0x%x%s%s%s", msg.sadb_msg_satype,
|
||||
addr_str ? addr_str : "unknown",
|
||||
ntohl(ssa.sadb_sa_spi), sa->tag ? " tag " : "",
|
||||
sa->tag ? sa->tag : ""));
|
||||
sa->tag ? sa->tag : "", iface_str));
|
||||
|
||||
free(addr_str);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sa.h,v 1.54 2018/01/15 09:54:48 mpi Exp $ */
|
||||
/* $OpenBSD: sa.h,v 1.55 2023/08/07 04:01:30 dlg Exp $ */
|
||||
/* $EOM: sa.h,v 1.58 2000/10/10 12:39:01 provos Exp $ */
|
||||
|
||||
/*
|
||||
@ -211,6 +211,9 @@ struct sa {
|
||||
|
||||
/* The add a pf tag to packets matching the established SA. */
|
||||
char *tag;
|
||||
|
||||
/* IPsec with Interface SAs, enabled with SA_FLAG_IFACE */
|
||||
unsigned int iface;
|
||||
};
|
||||
|
||||
/* This SA is alive. */
|
||||
@ -244,6 +247,9 @@ struct sa {
|
||||
#define SA_FLAG_NAT_T_ENABLE 0x100
|
||||
#define SA_FLAG_NAT_T_KEEPALIVE 0x200
|
||||
|
||||
/* Policy is handled by routing/filtering on the specified iface */
|
||||
#define SA_FLAG_IFACE 0x400
|
||||
|
||||
extern void proto_free(struct proto * proto);
|
||||
extern int sa_add_transform(struct sa *, struct payload *, int,
|
||||
struct proto **);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: route.8,v 1.118 2023/04/06 11:29:55 kn Exp $
|
||||
.\" $OpenBSD: route.8,v 1.119 2023/08/02 23:34:13 aisha Exp $
|
||||
.\" $NetBSD: route.8,v 1.6 1995/03/18 15:00:13 cgd Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
@ -30,7 +30,7 @@
|
||||
.\"
|
||||
.\" @(#)route.8 8.3 (Berkeley) 3/19/94
|
||||
.\"
|
||||
.Dd $Mdocdate: April 6 2023 $
|
||||
.Dd $Mdocdate: August 2 2023 $
|
||||
.Dt ROUTE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -281,7 +281,8 @@ and/or a gateway.
|
||||
.Op Fl T Ar rtable
|
||||
.Tg
|
||||
.Cm exec
|
||||
.Op Ar command ...
|
||||
.Ar command
|
||||
.Op Ar arg ...
|
||||
.Xc
|
||||
Execute a command, forcing the process and its children to use the
|
||||
routing table and appropriate routing domain as specified with the
|
||||
@ -514,6 +515,35 @@ host and network name database
|
||||
.It Pa /etc/mygate
|
||||
default gateway address
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
For commands other than
|
||||
.Cm exec ,
|
||||
the
|
||||
.Nm
|
||||
utility exits 0 on success, and >0 if an error occurs.
|
||||
.Pp
|
||||
For the
|
||||
.Cm exec
|
||||
command the
|
||||
.Nm
|
||||
utility exits with the exit status of
|
||||
.Ar command
|
||||
if it could be invoked.
|
||||
Otherwise the
|
||||
.Nm
|
||||
utility exits with one of the following values:
|
||||
.Bl -tag -width Ds
|
||||
.It 1
|
||||
An invalid command line option was passed to
|
||||
.Nm
|
||||
or setting the routing table failed.
|
||||
.It 126
|
||||
.Ar command
|
||||
was found but could not be invoked.
|
||||
.It 127
|
||||
.Ar command
|
||||
could not be found.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Show the current IPv4 routing tables,
|
||||
without attempting to print hostnames symbolically:
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.843 2023/07/08 02:43:02 jcs Exp $
|
||||
# $OpenBSD: Makefile,v 1.844 2023/08/07 03:17:42 dlg Exp $
|
||||
|
||||
MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \
|
||||
acpi.4 acpiac.4 acpials.4 acpiasus.4 acpibat.4 \
|
||||
@ -84,7 +84,7 @@ MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \
|
||||
rkrng.4 rktcphy.4 rktemp.4 rkusbphy.4 rkvop.4 \
|
||||
rl.4 rlphy.4 route.4 rsu.4 rtsx.4 rum.4 run.4 rtw.4 rtwn.4 \
|
||||
safte.4 sbus.4 schsio.4 scmi.4 scsi.4 sd.4 \
|
||||
sdmmc.4 sdhc.4 se.4 ses.4 sf.4 sili.4 \
|
||||
sdmmc.4 sdhc.4 se.4 sec.4 ses.4 sf.4 sili.4 \
|
||||
simpleamp.4 simpleaudio.4 simplefb.4 simplepanel.4 siop.4 sis.4 sk.4 \
|
||||
sm.4 smsc.4 sncodec.4 \
|
||||
softraid.4 spdmem.4 sdtemp.4 speaker.4 sppp.4 sqphy.4 \
|
||||
|
76
share/man/man4/sec.4
Normal file
76
share/man/man4/sec.4
Normal file
@ -0,0 +1,76 @@
|
||||
.\" $OpenBSD: sec.4,v 1.2 2023/08/07 16:29:36 jmc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2023 David Gwynne <dlg@openbsd.org>
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd $Mdocdate: August 7 2023 $
|
||||
.Dt SEC 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sec
|
||||
.Nd route based IPsec VPN tunnel interface pseudo-device
|
||||
.Sh SYNOPSIS
|
||||
.Cd "pseudo-device sec"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides point-to-point tunnel interfaces for IPv4 and IPv6
|
||||
protected by the
|
||||
.Xr ipsec 4
|
||||
Encapsulating Security Payload (ESP)
|
||||
protocol.
|
||||
.Pp
|
||||
Traffic is encapsulated in the ESP protocol and forwarded to the
|
||||
remote endpoint by routing over a
|
||||
.Nm
|
||||
interface rather than matching policy in the IPsec Security Policy
|
||||
Database (SPD).
|
||||
.Nm
|
||||
interfaces require the configuration of IPsec Security Associations (SAs)
|
||||
.\" with the interface extension
|
||||
between the local and remote endpoints.
|
||||
Negotiation of interface SAs is supported by
|
||||
.Xr iked 8
|
||||
and
|
||||
.Xr isakmpd 8
|
||||
(the latter via
|
||||
.Xr ipsecctl 8 ) .
|
||||
.Pp
|
||||
.Nm
|
||||
interfaces can be created at runtime using the
|
||||
.Ic ifconfig sec Ns Ar N Ic create
|
||||
command or by setting up a
|
||||
.Xr hostname.if 5
|
||||
configuration file for
|
||||
.Xr netstart 8 .
|
||||
The interface itself can be configured with
|
||||
.Xr ifconfig 8 ;
|
||||
see its manual page for more information.
|
||||
.Sh SEE ALSO
|
||||
.Xr ipsec 4 ,
|
||||
.Xr netintro 4 ,
|
||||
.Xr hostname.if 5 ,
|
||||
.Xr pf.conf 5 ,
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr iked 8 ,
|
||||
.Xr ipsecctl 8 ,
|
||||
.Xr isakmpd 8 ,
|
||||
.Xr netstart 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
driver first appeared in
|
||||
.Ox 7.4 .
|
||||
.Sh AUTHORS
|
||||
.An David Gwynne Aq Mt dlg@openbsd.org .
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: airport,v 1.91 2023/06/14 01:16:08 kn Exp $
|
||||
# $OpenBSD: airport,v 1.92 2023/08/07 08:22:52 mbuhl Exp $
|
||||
# @(#)airport 8.1 (Berkeley) 6/8/93
|
||||
#
|
||||
# Some of this information from the Airport Search Engine at
|
||||
@ -984,6 +984,7 @@ LIN:Linate, Milan, Italy
|
||||
LIR:Liberia, Costa Rica
|
||||
LIS:Lisbon, Portugal
|
||||
LIT:Little Rock Regional, Arkansas, USA
|
||||
LJG:Lijiang Sanyi International Airport, Yunnan, China
|
||||
LJU:Brnik, Ljubljana, Slovenia
|
||||
LKE:Lake Union Sea Plane Base, Seattle, Washington, USA
|
||||
LKN:Leknes, Norway
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: codepatch.c,v 1.9 2020/09/11 09:27:09 mpi Exp $ */
|
||||
/* $OpenBSD: codepatch.c,v 1.10 2023/07/31 01:33:57 guenther Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
|
||||
*
|
||||
@ -126,7 +126,7 @@ codepatch_nop(uint16_t tag)
|
||||
|
||||
/* Patch with alternative code */
|
||||
void
|
||||
codepatch_replace(uint16_t tag, void *code, size_t len)
|
||||
codepatch_replace(uint16_t tag, const void *code, size_t len)
|
||||
{
|
||||
struct codepatch *patch;
|
||||
unsigned char *rwaddr;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: cpu.c,v 1.174 2023/07/28 06:36:16 guenther Exp $ */
|
||||
/* $OpenBSD: cpu.c,v 1.175 2023/07/31 04:01:07 guenther Exp $ */
|
||||
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
|
||||
|
||||
/*-
|
||||
@ -187,11 +187,7 @@ replacemeltdown(void)
|
||||
{
|
||||
static int replacedone = 0;
|
||||
struct cpu_info *ci = &cpu_info_primary;
|
||||
int swapgs_vuln = 0, s;
|
||||
|
||||
if (replacedone)
|
||||
return;
|
||||
replacedone = 1;
|
||||
int swapgs_vuln = 0, ibrs = 0, s;
|
||||
|
||||
if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
|
||||
int family = ci->ci_family;
|
||||
@ -208,9 +204,39 @@ replacemeltdown(void)
|
||||
/* KnightsLanding */
|
||||
swapgs_vuln = 0;
|
||||
}
|
||||
if ((ci->ci_feature_sefflags_edx & SEFF0EDX_ARCH_CAP) &&
|
||||
(rdmsr(MSR_ARCH_CAPABILITIES) & ARCH_CAP_IBRS_ALL)) {
|
||||
ibrs = 2;
|
||||
} else if (ci->ci_feature_sefflags_edx & SEFF0EDX_IBRS) {
|
||||
ibrs = 1;
|
||||
}
|
||||
} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
|
||||
ci->ci_pnfeatset >= 0x80000008) {
|
||||
if (ci->ci_feature_amdspec_ebx & CPUIDEBX_IBRS_ALWAYSON) {
|
||||
ibrs = 2;
|
||||
} else if ((ci->ci_feature_amdspec_ebx & CPUIDEBX_IBRS) &&
|
||||
(ci->ci_feature_amdspec_ebx & CPUIDEBX_IBRS_PREF)) {
|
||||
ibrs = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enhanced IBRS: turn it on once on each CPU and don't touch again */
|
||||
if (ibrs == 2)
|
||||
wrmsr(MSR_SPEC_CTRL, SPEC_CTRL_IBRS);
|
||||
|
||||
if (replacedone)
|
||||
return;
|
||||
replacedone = 1;
|
||||
|
||||
s = splhigh();
|
||||
if (ibrs == 2 || (ci->ci_feature_sefflags_edx & SEFF0EDX_IBT)) {
|
||||
extern const char _jmprax, _jmpr11, _jmpr13;
|
||||
extern const short _jmprax_len, _jmpr11_len, _jmpr13_len;
|
||||
codepatch_replace(CPTAG_RETPOLINE_RAX, &_jmprax, _jmprax_len);
|
||||
codepatch_replace(CPTAG_RETPOLINE_R11, &_jmpr11, _jmpr11_len);
|
||||
codepatch_replace(CPTAG_RETPOLINE_R13, &_jmpr13, _jmpr13_len);
|
||||
}
|
||||
|
||||
if (!cpu_meltdown)
|
||||
codepatch_nop(CPTAG_MELTDOWN_NOP);
|
||||
else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: locore.S,v 1.139 2023/07/28 06:18:35 guenther Exp $ */
|
||||
/* $OpenBSD: locore.S,v 1.140 2023/07/31 04:01:07 guenther Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
|
||||
|
||||
/*
|
||||
@ -474,7 +474,16 @@ bogus_proc_pmap:
|
||||
END(cpu_switchto)
|
||||
|
||||
NENTRY(retpoline_rax)
|
||||
CODEPATCH_START
|
||||
JMP_RETPOLINE(rax)
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_RAX)
|
||||
END(retpoline_rax)
|
||||
|
||||
NENTRY(__x86_indirect_thunk_r11)
|
||||
CODEPATCH_START
|
||||
JMP_RETPOLINE(r11)
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_R11)
|
||||
END(__x86_indirect_thunk_r11)
|
||||
|
||||
ENTRY(cpu_idle_cycle_hlt)
|
||||
RETGUARD_SETUP(cpu_idle_cycle_hlt, r11)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: vector.S,v 1.93 2023/07/27 00:30:07 guenther Exp $ */
|
||||
/* $OpenBSD: vector.S,v 1.94 2023/07/31 04:01:07 guenther Exp $ */
|
||||
/* $NetBSD: vector.S,v 1.5 2004/06/28 09:13:11 fvdl Exp $ */
|
||||
|
||||
/*
|
||||
@ -1269,7 +1269,9 @@ END(ioapic_level_stubs)
|
||||
* Soft interrupt handlers
|
||||
*/
|
||||
NENTRY(retpoline_r13)
|
||||
CODEPATCH_START
|
||||
JMP_RETPOLINE(r13)
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_R13)
|
||||
END(retpoline_r13)
|
||||
|
||||
KIDTVEC(softtty)
|
||||
@ -1280,7 +1282,9 @@ KIDTVEC(softtty)
|
||||
movl $X86_SOFTINTR_SOFTTTY,%edi
|
||||
call softintr_dispatch
|
||||
decl CPUVAR(IDEPTH)
|
||||
CODEPATCH_START
|
||||
jmp retpoline_r13
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_R13)
|
||||
END(Xsofttty)
|
||||
|
||||
KIDTVEC(softnet)
|
||||
@ -1291,7 +1295,9 @@ KIDTVEC(softnet)
|
||||
movl $X86_SOFTINTR_SOFTNET,%edi
|
||||
call softintr_dispatch
|
||||
decl CPUVAR(IDEPTH)
|
||||
CODEPATCH_START
|
||||
jmp retpoline_r13
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_R13)
|
||||
END(Xsoftnet)
|
||||
|
||||
KIDTVEC(softclock)
|
||||
@ -1302,5 +1308,7 @@ KIDTVEC(softclock)
|
||||
movl $X86_SOFTINTR_SOFTCLOCK,%edi
|
||||
call softintr_dispatch
|
||||
decl CPUVAR(IDEPTH)
|
||||
CODEPATCH_START
|
||||
jmp retpoline_r13
|
||||
CODEPATCH_END(CPTAG_RETPOLINE_R13)
|
||||
END(Xsoftclock)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile.amd64,v 1.132 2023/04/21 13:24:20 bluhm Exp $
|
||||
# $OpenBSD: Makefile.amd64,v 1.133 2023/07/31 04:01:07 guenther Exp $
|
||||
|
||||
# For instructions on building kernels consult the config(8) and options(4)
|
||||
# manual pages.
|
||||
@ -72,7 +72,7 @@ COPTIMIZE= -Oz
|
||||
CMACHFLAGS+= -mno-retpoline -fcf-protection=none
|
||||
.endif
|
||||
.else
|
||||
CMACHFLAGS+= -fcf-protection=branch
|
||||
CMACHFLAGS+= -mretpoline-external-thunk -fcf-protection=branch
|
||||
.endif
|
||||
.if ${COMPILER_VERSION:Mclang}
|
||||
NO_INTEGR_AS= -no-integrated-as
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: codepatch.h,v 1.16 2023/07/28 06:18:35 guenther Exp $ */
|
||||
/* $OpenBSD: codepatch.h,v 1.18 2023/07/31 04:01:07 guenther Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
|
||||
*
|
||||
@ -29,7 +29,7 @@ __cptext void *codepatch_maprw(vaddr_t *nva, vaddr_t dest);
|
||||
__cptext void codepatch_unmaprw(vaddr_t nva);
|
||||
__cptext void codepatch_fill_nop(void *caddr, uint16_t len);
|
||||
__cptext void codepatch_nop(uint16_t tag);
|
||||
__cptext void codepatch_replace(uint16_t tag, void *code, size_t len);
|
||||
__cptext void codepatch_replace(uint16_t tag, const void *code, size_t len);
|
||||
__cptext void codepatch_call(uint16_t _tag, void *_func);
|
||||
__cptext void codepatch_jmp(uint16_t _tag, void *_func);
|
||||
void codepatch_disable(void);
|
||||
@ -66,6 +66,9 @@ void codepatch_disable(void);
|
||||
#define CPTAG_FENCE_SWAPGS_MIS_TAKEN 11
|
||||
#define CPTAG_FENCE_NO_SAFE_SMAP 12
|
||||
#define CPTAG_XRSTORS 13
|
||||
#define CPTAG_RETPOLINE_RAX 14
|
||||
#define CPTAG_RETPOLINE_R11 15
|
||||
#define CPTAG_RETPOLINE_R13 16
|
||||
|
||||
/*
|
||||
* stac/clac SMAP instructions have lfence like semantics. Let's
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: codepatch.c,v 1.5 2020/09/11 09:27:10 mpi Exp $ */
|
||||
/* $OpenBSD: codepatch.c,v 1.6 2023/07/31 17:10:31 bluhm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
|
||||
*
|
||||
@ -147,7 +147,7 @@ codepatch_nop(uint16_t tag)
|
||||
|
||||
/* Patch with alternative code */
|
||||
void
|
||||
codepatch_replace(uint16_t tag, void *code, size_t len)
|
||||
codepatch_replace(uint16_t tag, const void *code, size_t len)
|
||||
{
|
||||
struct codepatch *patch;
|
||||
unsigned char *rwaddr;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: codepatch.h,v 1.2 2017/07/01 19:42:59 sf Exp $ */
|
||||
/* $OpenBSD: codepatch.h,v 1.3 2023/07/31 17:10:31 bluhm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Stefan Fritsch <sf@sfritsch.de>
|
||||
*
|
||||
@ -26,7 +26,7 @@ void *codepatch_maprw(vaddr_t *nva, vaddr_t dest);
|
||||
void codepatch_unmaprw(vaddr_t nva);
|
||||
void codepatch_fill_nop(void *caddr, uint16_t len);
|
||||
void codepatch_nop(uint16_t tag);
|
||||
void codepatch_replace(uint16_t tag, void *code, size_t len);
|
||||
void codepatch_replace(uint16_t tag, const void *code, size_t len);
|
||||
void codepatch_call(uint16_t tag, void *func);
|
||||
|
||||
#endif /* !_LOCORE */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: files,v 1.724 2023/04/23 00:20:26 dlg Exp $
|
||||
# $OpenBSD: files,v 1.725 2023/08/07 01:59:38 dlg Exp $
|
||||
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
@ -572,6 +572,7 @@ pseudo-device vlan: ifnet, ether
|
||||
pseudo-device carp: ifnet, ether
|
||||
pseudo-device sppp: ifnet
|
||||
pseudo-device gif: ifnet
|
||||
pseudo-device sec: ifnet
|
||||
pseudo-device gre: ifnet, ether, etherbridge
|
||||
pseudo-device crypto: ifnet
|
||||
pseudo-device trunk: ifnet, ether, ifmedia
|
||||
@ -1006,6 +1007,7 @@ file uvm/uvm_vnode.c
|
||||
|
||||
# IPv6
|
||||
file net/if_gif.c gif needs-count
|
||||
file net/if_sec.c sec needs-count
|
||||
file netinet/ip_ecn.c
|
||||
file netinet6/in6_pcb.c inet6
|
||||
file netinet6/in6.c inet6
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: acpi_apm.c,v 1.2 2023/07/08 14:44:43 tobhe Exp $ */
|
||||
/* $OpenBSD: acpi_apm.c,v 1.3 2023/08/06 14:30:08 tobhe Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
|
||||
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
|
||||
@ -47,6 +47,9 @@ acpiopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
struct acpi_softc *sc = acpi_softc;
|
||||
int s;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
s = splbio();
|
||||
switch (APMDEV(dev)) {
|
||||
case APMDEV_CTL:
|
||||
@ -82,6 +85,9 @@ acpiclose(dev_t dev, int flag, int mode, struct proc *p)
|
||||
struct acpi_softc *sc = acpi_softc;
|
||||
int s;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
s = splbio();
|
||||
switch (APMDEV(dev)) {
|
||||
case APMDEV_CTL:
|
||||
@ -106,6 +112,9 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
struct apm_power_info *pi = (struct apm_power_info *)data;
|
||||
int s;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
s = splbio();
|
||||
/* fake APM */
|
||||
switch (cmd) {
|
||||
@ -168,6 +177,9 @@ acpikqfilter(dev_t dev, struct knote *kn)
|
||||
struct acpi_softc *sc = acpi_softc;
|
||||
int s;
|
||||
|
||||
if (sc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
switch (kn->kn_filter) {
|
||||
case EVFILT_READ:
|
||||
kn->kn_fop = &acpiread_filtops;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: axppmic.c,v 1.17 2023/07/06 20:02:36 uaa Exp $ */
|
||||
/* $OpenBSD: axppmic.c,v 1.20 2023/08/02 11:52:18 uaa Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
|
||||
*
|
||||
@ -126,6 +126,21 @@ const struct axppmic_regdata axp221_regdata[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct axppmic_regdata axp313a_regdata[] = {
|
||||
/* dcdc1: 1.6-3.4V (100mV step) not supported */
|
||||
{ "dcdc1", 0x10, (1 << 0), (1 << 0), (0 << 0),
|
||||
0x13, 0x7f, 500000, 10000, 71, 122000, 20000, 17 },
|
||||
{ "dcdc2", 0x10, (1 << 1), (1 << 1), (0 << 1),
|
||||
0x14, 0x7f, 500000, 10000, 71, 122000, 20000, 17 },
|
||||
{ "dcdc3", 0x10, (1 << 2), (1 << 2), (0 << 2),
|
||||
0x15, 0x7f, 500000, 10000, 71, 122000, 20000, 32 },
|
||||
{ "aldo1", 0x10, (1 << 3), (1 << 3), (0 << 3),
|
||||
0x16, 0x1f, 500000, 100000, 31 },
|
||||
{ "dldo1", 0x10, (1 << 4), (1 << 4), (0 << 4),
|
||||
0x17, 0x1f, 500000, 100000, 31 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct axppmic_regdata axp803_regdata[] = {
|
||||
{ "dcdc1", 0x10, (1 << 0), (1 << 0), (0 << 0),
|
||||
0x20, 0x1f, 1600000, 100000, 19 },
|
||||
@ -242,6 +257,53 @@ const struct axppmic_regdata axp809_regdata[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
const struct axppmic_regdata axp15060_regdata[] = {
|
||||
{ "dcdc1", 0x10, (1 << 0), (1 << 0), (0 << 0),
|
||||
0x13, 0x1f, 15000000, 100000, 20 },
|
||||
{ "dcdc2", 0x10, (1 << 1), (1 << 1), (0 << 1),
|
||||
0x14, 0x7f, 500000, 10000, 71, 1220000, 20000, 17 },
|
||||
{ "dcdc3", 0x10, (1 << 2), (1 << 2), (0 << 2),
|
||||
0x15, 0x7f, 500000, 10000, 71, 1220000, 20000, 17 },
|
||||
{ "dcdc4", 0x10, (1 << 3), (1 << 3), (0 << 3),
|
||||
0x16, 0x7f, 500000, 10000, 71, 1220000, 20000, 17 },
|
||||
{ "dcdc5", 0x10, (1 << 4), (1 << 4), (0 << 4),
|
||||
0x17, 0x7f, 800000, 10000, 33, 1140000, 20000, 36 },
|
||||
{ "dcdc6", 0x10, (1 << 5), (1 << 5), (0 << 5),
|
||||
0x18, 0x1f, 500000, 100000, 30 },
|
||||
{ "aldo1", 0x11, (1 << 0), (1 << 0), (0 << 0),
|
||||
0x19, 0x1f, 700000, 100000, 27 },
|
||||
{ "aldo2", 0x11, (1 << 1), (1 << 1), (0 << 1),
|
||||
0x20, 0x1f, 700000, 100000, 27 },
|
||||
{ "aldo3", 0x11, (1 << 2), (1 << 2), (0 << 2),
|
||||
0x21, 0x1f, 700000, 100000, 27 },
|
||||
{ "aldo4", 0x11, (1 << 3), (1 << 3), (0 << 3),
|
||||
0x22, 0x1f, 700000, 100000, 27 },
|
||||
{ "aldo5", 0x11, (1 << 4), (1 << 4), (0 << 4),
|
||||
0x23, 0x1f, 700000, 100000, 27 },
|
||||
{ "bldo1", 0x11, (1 << 5), (1 << 5), (0 << 5),
|
||||
0x24, 0x1f, 700000, 100000, 27 },
|
||||
{ "bldo2", 0x11, (1 << 6), (1 << 6), (0 << 6),
|
||||
0x25, 0x1f, 700000, 100000, 27 },
|
||||
{ "bldo3", 0x11, (1 << 7), (1 << 7), (0 << 7),
|
||||
0x26, 0x1f, 700000, 100000, 27 },
|
||||
{ "bldo4", 0x12, (1 << 0), (1 << 0), (0 << 0),
|
||||
0x27, 0x1f, 700000, 100000, 27 },
|
||||
{ "bldo5", 0x12, (1 << 1), (1 << 1), (0 << 1),
|
||||
0x28, 0x1f, 700000, 100000, 27 },
|
||||
{ "cldo1", 0x12, (1 << 2), (1 << 2), (0 << 2),
|
||||
0x29, 0x1f, 700000, 100000, 27 },
|
||||
{ "cldo2", 0x12, (1 << 3), (1 << 3), (0 << 3),
|
||||
0x2a, 0x1f, 700000, 100000, 27 },
|
||||
{ "cldo3", 0x12, (1 << 4), (1 << 4), (0 << 4),
|
||||
0x2b, 0x1f, 700000, 100000, 27 },
|
||||
{ "cldo4", 0x12, (1 << 5), (1 << 5), (0 << 5),
|
||||
0x2d, 0x3f, 700000, 100000, 36 },
|
||||
{ "cpusldo", 0x12, (1 << 6), (1 << 6), (0 << 6),
|
||||
0x2e, 0x0f, 700000, 50000, 15 },
|
||||
{ "sw", 0x12, (1 << 7), (1 << 7), (0 << 7) },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* Sensors for AXP209 and AXP221/AXP809. */
|
||||
|
||||
#define AXPPMIC_NSENSORS 12
|
||||
@ -307,10 +369,12 @@ const struct axppmic_device axppmic_devices[] = {
|
||||
{ "x-powers,axp221", "AXP221", axp221_regdata, axp221_sensdata },
|
||||
{ "x-powers,axp223", "AXP223", axp221_regdata, axp221_sensdata },
|
||||
{ "x-powers,axp305", "AXP305", axp806_regdata },
|
||||
{ "x-powers,axp313a", "AXP313A", axp313a_regdata },
|
||||
{ "x-powers,axp803", "AXP803", axp803_regdata, axp803_sensdata },
|
||||
{ "x-powers,axp805", "AXP805", axp806_regdata },
|
||||
{ "x-powers,axp806", "AXP806", axp806_regdata },
|
||||
{ "x-powers,axp809", "AXP809", axp809_regdata, axp221_sensdata }
|
||||
{ "x-powers,axp809", "AXP809", axp809_regdata, axp221_sensdata },
|
||||
{ "x-powers,axp15060", "AXP15060", axp15060_regdata },
|
||||
};
|
||||
|
||||
const struct axppmic_device *
|
||||
@ -438,6 +502,10 @@ axppmic_i2c_write(struct axppmic_softc *sc, uint8_t reg, uint8_t value)
|
||||
|
||||
/* RSB interface */
|
||||
|
||||
#include "sxirsb.h"
|
||||
|
||||
#if NSXIRSB > 0
|
||||
|
||||
int axppmic_rsb_match(struct device *, void *, void *);
|
||||
void axppmic_rsb_attach(struct device *, struct device *, void *);
|
||||
|
||||
@ -489,6 +557,8 @@ axppmic_rsb_write(struct axppmic_softc *sc, uint8_t reg, uint8_t value)
|
||||
rsb_write_1(sc->sc_cookie, sc->sc_addr, reg, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Common code */
|
||||
|
||||
void axppmic_attach_node(struct axppmic_softc *, int);
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: files.fdt,v 1.196 2023/07/22 22:43:53 patrick Exp $
|
||||
# $OpenBSD: files.fdt,v 1.197 2023/07/31 09:00:43 kettenis Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent FDT code.
|
||||
# Included by ports that need it.
|
||||
@ -48,7 +48,7 @@ file dev/fdt/sxipio.c sxipio
|
||||
define rsb {}
|
||||
device sxirsb: rsb
|
||||
attach sxirsb at fdt
|
||||
file dev/fdt/sxirsb.c sxirsb
|
||||
file dev/fdt/sxirsb.c sxirsb needs-flag
|
||||
|
||||
device sxipwm
|
||||
attach sxipwm at fdt
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: dwqe.c,v 1.10 2023/07/04 12:48:42 kettenis Exp $ */
|
||||
/* $OpenBSD: dwqe.c,v 1.11 2023/08/07 20:28:47 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008, 2019 Mark Kettenis <kettenis@openbsd.org>
|
||||
* Copyright (c) 2017, 2022 Patrick Wildt <patrick@blueri.se>
|
||||
@ -608,6 +608,9 @@ dwqe_tx_proc(struct dwqe_softc *sc)
|
||||
if (txd->sd_tdes3 & TDES3_OWN)
|
||||
break;
|
||||
|
||||
if (txd->sd_tdes3 & TDES3_ES)
|
||||
ifp->if_oerrors++;
|
||||
|
||||
txb = &sc->sc_txbuf[idx];
|
||||
if (txb->tb_m) {
|
||||
bus_dmamap_sync(sc->sc_dmat, txb->tb_map, 0,
|
||||
@ -808,7 +811,7 @@ dwqe_up(struct dwqe_softc *sc)
|
||||
if (sc->sc_force_thresh_dma_mode) {
|
||||
mode &= ~GMAC_MTL_CHAN_TX_OP_MODE_TSF;
|
||||
mode &= ~GMAC_MTL_CHAN_TX_OP_MODE_TTC_MASK;
|
||||
mode |= GMAC_MTL_CHAN_TX_OP_MODE_TTC_128;
|
||||
mode |= GMAC_MTL_CHAN_TX_OP_MODE_TTC_512;
|
||||
} else {
|
||||
mode |= GMAC_MTL_CHAN_TX_OP_MODE_TSF;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: azalia.c,v 1.283 2023/02/21 13:42:59 bcallah Exp $ */
|
||||
/* $OpenBSD: azalia.c,v 1.284 2023/07/30 08:46:03 yasuoka Exp $ */
|
||||
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
|
||||
|
||||
/*-
|
||||
@ -463,6 +463,7 @@ azalia_configure_pci(azalia_t *az)
|
||||
case PCI_PRODUCT_INTEL_600SERIES_HDA:
|
||||
case PCI_PRODUCT_INTEL_600SERIES_LP_HDA:
|
||||
case PCI_PRODUCT_INTEL_700SERIES_HDA:
|
||||
case PCI_PRODUCT_INTEL_700SERIES_LP_HDA:
|
||||
case PCI_PRODUCT_INTEL_C600_HDA:
|
||||
case PCI_PRODUCT_INTEL_C610_HDA_1:
|
||||
case PCI_PRODUCT_INTEL_C610_HDA_2:
|
||||
@ -492,6 +493,7 @@ const struct pci_matchid azalia_pci_devices[] = {
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_500SERIES_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_500SERIES_LP_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_600SERIES_LP_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_700SERIES_LP_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_APOLLOLAKE_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_GLK_HDA },
|
||||
{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_JSL_HDA },
|
||||
|
@ -1291,6 +1291,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
|
||||
void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
|
||||
int amdgpu_device_pci_reset(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_need_post(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_pcie_dynamic_switching_supported(void);
|
||||
bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
|
||||
bool amdgpu_device_aspm_support_quirk(void);
|
||||
|
||||
|
@ -1351,6 +1351,29 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
|
||||
* speed switching. Until we have confirmation from Intel that a specific host
|
||||
* supports it, it's safer that we keep it disabled for all.
|
||||
*
|
||||
* https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processors-datasheet-volume-1-of-2/005/pci-express-support/
|
||||
* https://gitlab.freedesktop.org/drm/amd/-/issues/2663
|
||||
*/
|
||||
bool amdgpu_device_pcie_dynamic_switching_supported(void)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_X86)
|
||||
#ifdef __linux__
|
||||
struct cpuinfo_x86 *c = &cpu_data(0);
|
||||
|
||||
if (c->x86_vendor == X86_VENDOR_INTEL)
|
||||
#else
|
||||
if (strcmp(cpu_vendor, "GenuineIntel") == 0)
|
||||
#endif
|
||||
return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_device_should_use_aspm - check if the device should program ASPM
|
||||
*
|
||||
|
@ -203,16 +203,18 @@ static const struct pci_matchid amdgpu_devices[] = {
|
||||
{0x1002, 0x1506 },
|
||||
|
||||
/* GC 11.0.0, DCN 3.2.0, dGPU, "Navi 31" */
|
||||
{0x1002, 0x744c }, /* Radeon RX 7900 XT/XTX */
|
||||
{0x1002, 0x7448 }, /* Radeon Pro W7900 */
|
||||
{0x1002, 0x744c }, /* Radeon RX 7900 XT/XTX/GRE */
|
||||
{0x1002, 0x745e }, /* Radeon Pro W7800 */
|
||||
|
||||
/* GC 11.0.1, DCN 3.1.4, APU, Ryzen 7040 "Phoenix" */
|
||||
{0x1002, 0x15bf },
|
||||
|
||||
/* GC 11.0.2, DCN 3.2.1, dGPU, "Navi 33" */
|
||||
{0x1002, 0x7480 }, /* Radeon RX 7600S, 7700S, 7600M XT, 7600 */
|
||||
{0x1002, 0x7480 }, /* Radeon RX 7600S, 7700S, 7600M XT,
|
||||
7600, Pro W7600 */
|
||||
{0x1002, 0x7483 }, /* Radeon RX 7600M */
|
||||
{0x1002, 0x7489 }, /* Radeon Pro W7500 */
|
||||
|
||||
/* GC 11.0.3, DCN 3.2.0, dGPU */
|
||||
/* GC 11.0.4, DCN 3.1.4, APU */
|
||||
|
@ -472,11 +472,11 @@ static int psp_sw_init(void *handle)
|
||||
return 0;
|
||||
|
||||
failed2:
|
||||
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
|
||||
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
|
||||
failed1:
|
||||
amdgpu_bo_free_kernel(&psp->fence_buf_bo,
|
||||
&psp->fence_buf_mc_addr, &psp->fence_buf);
|
||||
failed1:
|
||||
amdgpu_bo_free_kernel(&psp->fw_pri_bo,
|
||||
&psp->fw_pri_mc_addr, &psp->fw_pri_buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4950,6 +4950,30 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void fill_dc_dirty_rect(struct drm_plane *plane,
|
||||
struct rect *dirty_rect, int32_t x,
|
||||
int32_t y, int32_t width, int32_t height,
|
||||
int *i, bool ffu)
|
||||
{
|
||||
WARN_ON(*i >= DC_MAX_DIRTY_RECTS);
|
||||
|
||||
dirty_rect->x = x;
|
||||
dirty_rect->y = y;
|
||||
dirty_rect->width = width;
|
||||
dirty_rect->height = height;
|
||||
|
||||
if (ffu)
|
||||
drm_dbg(plane->dev,
|
||||
"[PLANE:%d] PSR FFU dirty rect size (%d, %d)\n",
|
||||
plane->base.id, width, height);
|
||||
else
|
||||
drm_dbg(plane->dev,
|
||||
"[PLANE:%d] PSR SU dirty rect at (%d, %d) size (%d, %d)",
|
||||
plane->base.id, x, y, width, height);
|
||||
|
||||
(*i)++;
|
||||
}
|
||||
|
||||
/**
|
||||
* fill_dc_dirty_rects() - Fill DC dirty regions for PSR selective updates
|
||||
*
|
||||
@ -4970,10 +4994,6 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
|
||||
* addition, certain use cases - such as cursor and multi-plane overlay (MPO) -
|
||||
* implicitly provide damage clips without any client support via the plane
|
||||
* bounds.
|
||||
*
|
||||
* Today, amdgpu_dm only supports the MPO and cursor usecase.
|
||||
*
|
||||
* TODO: Also enable for FB_DAMAGE_CLIPS
|
||||
*/
|
||||
static void fill_dc_dirty_rects(struct drm_plane *plane,
|
||||
struct drm_plane_state *old_plane_state,
|
||||
@ -4984,12 +5004,11 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
|
||||
struct dm_crtc_state *dm_crtc_state = to_dm_crtc_state(crtc_state);
|
||||
struct rect *dirty_rects = flip_addrs->dirty_rects;
|
||||
uint32_t num_clips;
|
||||
struct drm_mode_rect *clips;
|
||||
bool bb_changed;
|
||||
bool fb_changed;
|
||||
u32 i = 0;
|
||||
|
||||
flip_addrs->dirty_rect_count = 0;
|
||||
|
||||
/*
|
||||
* Cursor plane has it's own dirty rect update interface. See
|
||||
* dcn10_dmub_update_cursor_data and dmub_cmd_update_cursor_info_data
|
||||
@ -4997,20 +5016,20 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
|
||||
if (plane->type == DRM_PLANE_TYPE_CURSOR)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Today, we only consider MPO use-case for PSR SU. If MPO not
|
||||
* requested, and there is a plane update, do FFU.
|
||||
*/
|
||||
num_clips = drm_plane_get_damage_clips_count(new_plane_state);
|
||||
clips = drm_plane_get_damage_clips(new_plane_state);
|
||||
|
||||
if (!dm_crtc_state->mpo_requested) {
|
||||
dirty_rects[0].x = 0;
|
||||
dirty_rects[0].y = 0;
|
||||
dirty_rects[0].width = dm_crtc_state->base.mode.crtc_hdisplay;
|
||||
dirty_rects[0].height = dm_crtc_state->base.mode.crtc_vdisplay;
|
||||
flip_addrs->dirty_rect_count = 1;
|
||||
DRM_DEBUG_DRIVER("[PLANE:%d] PSR FFU dirty rect size (%d, %d)\n",
|
||||
new_plane_state->plane->base.id,
|
||||
dm_crtc_state->base.mode.crtc_hdisplay,
|
||||
dm_crtc_state->base.mode.crtc_vdisplay);
|
||||
if (!num_clips || num_clips > DC_MAX_DIRTY_RECTS)
|
||||
goto ffu;
|
||||
|
||||
for (; flip_addrs->dirty_rect_count < num_clips; clips++)
|
||||
fill_dc_dirty_rect(new_plane_state->plane,
|
||||
&dirty_rects[flip_addrs->dirty_rect_count],
|
||||
clips->x1, clips->y1,
|
||||
clips->x2 - clips->x1, clips->y2 - clips->y1,
|
||||
&flip_addrs->dirty_rect_count,
|
||||
false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5021,7 +5040,6 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
|
||||
* If plane is moved or resized, also add old bounding box to dirty
|
||||
* rects.
|
||||
*/
|
||||
num_clips = drm_plane_get_damage_clips_count(new_plane_state);
|
||||
fb_changed = old_plane_state->fb->base.id !=
|
||||
new_plane_state->fb->base.id;
|
||||
bb_changed = (old_plane_state->crtc_x != new_plane_state->crtc_x ||
|
||||
@ -5029,36 +5047,51 @@ static void fill_dc_dirty_rects(struct drm_plane *plane,
|
||||
old_plane_state->crtc_w != new_plane_state->crtc_w ||
|
||||
old_plane_state->crtc_h != new_plane_state->crtc_h);
|
||||
|
||||
DRM_DEBUG_DRIVER("[PLANE:%d] PSR bb_changed:%d fb_changed:%d num_clips:%d\n",
|
||||
new_plane_state->plane->base.id,
|
||||
bb_changed, fb_changed, num_clips);
|
||||
drm_dbg(plane->dev,
|
||||
"[PLANE:%d] PSR bb_changed:%d fb_changed:%d num_clips:%d\n",
|
||||
new_plane_state->plane->base.id,
|
||||
bb_changed, fb_changed, num_clips);
|
||||
|
||||
if (num_clips || fb_changed || bb_changed) {
|
||||
dirty_rects[i].x = new_plane_state->crtc_x;
|
||||
dirty_rects[i].y = new_plane_state->crtc_y;
|
||||
dirty_rects[i].width = new_plane_state->crtc_w;
|
||||
dirty_rects[i].height = new_plane_state->crtc_h;
|
||||
DRM_DEBUG_DRIVER("[PLANE:%d] PSR SU dirty rect at (%d, %d) size (%d, %d)\n",
|
||||
new_plane_state->plane->base.id,
|
||||
dirty_rects[i].x, dirty_rects[i].y,
|
||||
dirty_rects[i].width, dirty_rects[i].height);
|
||||
i += 1;
|
||||
if ((num_clips + (bb_changed ? 2 : 0)) > DC_MAX_DIRTY_RECTS)
|
||||
goto ffu;
|
||||
|
||||
if (bb_changed) {
|
||||
fill_dc_dirty_rect(new_plane_state->plane, &dirty_rects[i],
|
||||
new_plane_state->crtc_x,
|
||||
new_plane_state->crtc_y,
|
||||
new_plane_state->crtc_w,
|
||||
new_plane_state->crtc_h, &i, false);
|
||||
|
||||
/* Add old plane bounding-box if plane is moved or resized */
|
||||
fill_dc_dirty_rect(new_plane_state->plane, &dirty_rects[i],
|
||||
old_plane_state->crtc_x,
|
||||
old_plane_state->crtc_y,
|
||||
old_plane_state->crtc_w,
|
||||
old_plane_state->crtc_h, &i, false);
|
||||
}
|
||||
|
||||
/* Add old plane bounding-box if plane is moved or resized */
|
||||
if (bb_changed) {
|
||||
dirty_rects[i].x = old_plane_state->crtc_x;
|
||||
dirty_rects[i].y = old_plane_state->crtc_y;
|
||||
dirty_rects[i].width = old_plane_state->crtc_w;
|
||||
dirty_rects[i].height = old_plane_state->crtc_h;
|
||||
DRM_DEBUG_DRIVER("[PLANE:%d] PSR SU dirty rect at (%d, %d) size (%d, %d)\n",
|
||||
old_plane_state->plane->base.id,
|
||||
dirty_rects[i].x, dirty_rects[i].y,
|
||||
dirty_rects[i].width, dirty_rects[i].height);
|
||||
i += 1;
|
||||
if (num_clips) {
|
||||
for (; i < num_clips; clips++)
|
||||
fill_dc_dirty_rect(new_plane_state->plane,
|
||||
&dirty_rects[i], clips->x1,
|
||||
clips->y1, clips->x2 - clips->x1,
|
||||
clips->y2 - clips->y1, &i, false);
|
||||
} else if (fb_changed && !bb_changed) {
|
||||
fill_dc_dirty_rect(new_plane_state->plane, &dirty_rects[i],
|
||||
new_plane_state->crtc_x,
|
||||
new_plane_state->crtc_y,
|
||||
new_plane_state->crtc_w,
|
||||
new_plane_state->crtc_h, &i, false);
|
||||
}
|
||||
|
||||
flip_addrs->dirty_rect_count = i;
|
||||
return;
|
||||
|
||||
ffu:
|
||||
fill_dc_dirty_rect(new_plane_state->plane, &dirty_rects[0], 0, 0,
|
||||
dm_crtc_state->base.mode.crtc_hdisplay,
|
||||
dm_crtc_state->base.mode.crtc_vdisplay,
|
||||
&flip_addrs->dirty_rect_count, true);
|
||||
}
|
||||
|
||||
static void update_stream_scaling_settings(const struct drm_display_mode *mode,
|
||||
|
@ -677,7 +677,7 @@ void dm_handle_mst_sideband_msg_ready_event(
|
||||
|
||||
if (retry == 3) {
|
||||
DRM_ERROR("Failed to ack MST event.\n");
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
drm_dp_mst_hpd_irq_send_new_request(&aconnector->mst_mgr);
|
||||
|
@ -1600,6 +1600,10 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
|
||||
drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0,
|
||||
supported_rotations);
|
||||
|
||||
if (dm->adev->ip_versions[DCE_HWIP][0] > IP_VERSION(3, 0, 1) &&
|
||||
plane->type != DRM_PLANE_TYPE_CURSOR)
|
||||
drm_plane_enable_fb_damage_clips(plane);
|
||||
|
||||
drm_plane_helper_add(plane, &dm_plane_helper_funcs);
|
||||
|
||||
#ifdef CONFIG_DRM_AMD_DC_HDR
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "amdgpu_dm_psr.h"
|
||||
#include "dc_dmub_srv.h"
|
||||
#include "dc.h"
|
||||
#include "dm_helpers.h"
|
||||
#include "amdgpu_dm.h"
|
||||
@ -50,7 +51,7 @@ static bool link_supports_psrsu(struct dc_link *link)
|
||||
!link->dpcd_caps.psr_info.psr2_su_y_granularity_cap)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return dc_dmub_check_min_version(dc->ctx->dmub_srv->dmub);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -108,6 +108,11 @@ static int dcn314_get_active_display_cnt_wa(
|
||||
stream->signal == SIGNAL_TYPE_DVI_SINGLE_LINK ||
|
||||
stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK)
|
||||
tmds_present = true;
|
||||
|
||||
/* Checking stream / link detection ensuring that PHY is active*/
|
||||
if (dc_is_dp_signal(stream->signal) && !stream->dpms_off)
|
||||
display_count++;
|
||||
|
||||
}
|
||||
|
||||
for (i = 0; i < dc->link_count; i++) {
|
||||
|
@ -135,9 +135,7 @@ static const char DC_BUILD_ID[] = "production-build";
|
||||
* one or two (in the pipe-split case).
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Private functions
|
||||
******************************************************************************/
|
||||
/* Private functions */
|
||||
|
||||
static inline void elevate_update_type(enum surface_update_type *original, enum surface_update_type new)
|
||||
{
|
||||
@ -384,16 +382,18 @@ static void dc_perf_trace_destroy(struct dc_perf_trace **perf_trace)
|
||||
}
|
||||
|
||||
/**
|
||||
* dc_stream_adjust_vmin_vmax:
|
||||
* dc_stream_adjust_vmin_vmax - look up pipe context & update parts of DRR
|
||||
* @dc: dc reference
|
||||
* @stream: Initial dc stream state
|
||||
* @adjust: Updated parameters for vertical_total_min and vertical_total_max
|
||||
*
|
||||
* Looks up the pipe context of dc_stream_state and updates the
|
||||
* vertical_total_min and vertical_total_max of the DRR, Dynamic Refresh
|
||||
* Rate, which is a power-saving feature that targets reducing panel
|
||||
* refresh rate while the screen is static
|
||||
*
|
||||
* @dc: dc reference
|
||||
* @stream: Initial dc stream state
|
||||
* @adjust: Updated parameters for vertical_total_min and vertical_total_max
|
||||
* Return: %true if the pipe context is found and adjusted;
|
||||
* %false if the pipe context is not found.
|
||||
*/
|
||||
bool dc_stream_adjust_vmin_vmax(struct dc *dc,
|
||||
struct dc_stream_state *stream,
|
||||
@ -429,18 +429,17 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_stream_get_last_vrr_vtotal
|
||||
* dc_stream_get_last_used_drr_vtotal - Looks up the pipe context of
|
||||
* dc_stream_state and gets the last VTOTAL used by DRR (Dynamic Refresh Rate)
|
||||
*
|
||||
* @brief
|
||||
* Looks up the pipe context of dc_stream_state and gets the
|
||||
* last VTOTAL used by DRR (Dynamic Refresh Rate)
|
||||
* @dc: [in] dc reference
|
||||
* @stream: [in] Initial dc stream state
|
||||
* @refresh_rate: [in] new refresh_rate
|
||||
*
|
||||
* @param [in] dc: dc reference
|
||||
* @param [in] stream: Initial dc stream state
|
||||
* @param [in] adjust: Updated parameters for vertical_total_min and
|
||||
* vertical_total_max
|
||||
*****************************************************************************
|
||||
* Return: %true if the pipe context is found and there is an associated
|
||||
* timing_generator for the DC;
|
||||
* %false if the pipe context is not found or there is no
|
||||
* timing_generator for the DC.
|
||||
*/
|
||||
bool dc_stream_get_last_used_drr_vtotal(struct dc *dc,
|
||||
struct dc_stream_state *stream,
|
||||
@ -587,7 +586,10 @@ bool dc_stream_stop_dmcu_crc_win_update(struct dc *dc, struct dc_stream_state *s
|
||||
* once.
|
||||
*
|
||||
* By default, only CRC0 is configured, and the entire frame is used to
|
||||
* calculate the crc.
|
||||
* calculate the CRC.
|
||||
*
|
||||
* Return: %false if the stream is not found or CRC capture is not supported;
|
||||
* %true if the stream has been configured.
|
||||
*/
|
||||
bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,
|
||||
struct crc_params *crc_window, bool enable, bool continuous)
|
||||
@ -656,7 +658,7 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,
|
||||
* dc_stream_configure_crc needs to be called beforehand to enable CRCs.
|
||||
*
|
||||
* Return:
|
||||
* false if stream is not found, or if CRCs are not enabled.
|
||||
* %false if stream is not found, or if CRCs are not enabled.
|
||||
*/
|
||||
bool dc_stream_get_crc(struct dc *dc, struct dc_stream_state *stream,
|
||||
uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb)
|
||||
@ -1236,9 +1238,7 @@ static void wait_for_no_pipes_pending(struct dc *dc, struct dc_state *context)
|
||||
PERF_TRACE();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Public functions
|
||||
******************************************************************************/
|
||||
/* Public functions */
|
||||
|
||||
struct dc *dc_create(const struct dc_init_data *init_params)
|
||||
{
|
||||
@ -1505,17 +1505,19 @@ static void program_timing_sync(
|
||||
}
|
||||
}
|
||||
|
||||
static bool context_changed(
|
||||
struct dc *dc,
|
||||
struct dc_state *context)
|
||||
static bool streams_changed(struct dc *dc,
|
||||
struct dc_stream_state *streams[],
|
||||
uint8_t stream_count)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if (context->stream_count != dc->current_state->stream_count)
|
||||
if (stream_count != dc->current_state->stream_count)
|
||||
return true;
|
||||
|
||||
for (i = 0; i < dc->current_state->stream_count; i++) {
|
||||
if (dc->current_state->streams[i] != context->streams[i])
|
||||
if (dc->current_state->streams[i] != streams[i])
|
||||
return true;
|
||||
if (!streams[i]->link->link_state_valid)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1745,6 +1747,8 @@ void dc_z10_save_init(struct dc *dc)
|
||||
/*
|
||||
* Applies given context to HW and copy it into current context.
|
||||
* It's up to the user to release the src context afterwards.
|
||||
*
|
||||
* Return: an enum dc_status result code for the operation
|
||||
*/
|
||||
static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *context)
|
||||
{
|
||||
@ -1911,12 +1915,114 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool commit_minimal_transition_state(struct dc *dc,
|
||||
struct dc_state *transition_base_context);
|
||||
|
||||
/**
|
||||
* dc_commit_streams - Commit current stream state
|
||||
*
|
||||
* @dc: DC object with the commit state to be configured in the hardware
|
||||
* @streams: Array with a list of stream state
|
||||
* @stream_count: Total of streams
|
||||
*
|
||||
* Function responsible for commit streams change to the hardware.
|
||||
*
|
||||
* Return:
|
||||
* Return DC_OK if everything work as expected, otherwise, return a dc_status
|
||||
* code.
|
||||
*/
|
||||
enum dc_status dc_commit_streams(struct dc *dc,
|
||||
struct dc_stream_state *streams[],
|
||||
uint8_t stream_count)
|
||||
{
|
||||
int i, j;
|
||||
struct dc_state *context;
|
||||
enum dc_status res = DC_OK;
|
||||
struct dc_validation_set set[MAX_STREAMS] = {0};
|
||||
struct pipe_ctx *pipe;
|
||||
bool handle_exit_odm2to1 = false;
|
||||
|
||||
if (!streams_changed(dc, streams, stream_count))
|
||||
return res;
|
||||
|
||||
DC_LOG_DC("%s: %d streams\n", __func__, stream_count);
|
||||
|
||||
for (i = 0; i < stream_count; i++) {
|
||||
struct dc_stream_state *stream = streams[i];
|
||||
struct dc_stream_status *status = dc_stream_get_status(stream);
|
||||
|
||||
dc_stream_log(dc, stream);
|
||||
|
||||
set[i].stream = stream;
|
||||
|
||||
if (status) {
|
||||
set[i].plane_count = status->plane_count;
|
||||
for (j = 0; j < status->plane_count; j++)
|
||||
set[i].plane_states[j] = status->plane_states[j];
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for case where we are going from odm 2:1 to max
|
||||
* pipe scenario. For these cases, we will call
|
||||
* commit_minimal_transition_state() to exit out of odm 2:1
|
||||
* first before processing new streams
|
||||
*/
|
||||
if (stream_count == dc->res_pool->pipe_count) {
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
|
||||
if (pipe->next_odm_pipe)
|
||||
handle_exit_odm2to1 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (handle_exit_odm2to1)
|
||||
res = commit_minimal_transition_state(dc, dc->current_state);
|
||||
|
||||
context = dc_create_state(dc);
|
||||
if (!context)
|
||||
goto context_alloc_fail;
|
||||
|
||||
dc_resource_state_copy_construct_current(dc, context);
|
||||
|
||||
/*
|
||||
* Previous validation was perfomred with fast_validation = true and
|
||||
* the full DML state required for hardware programming was skipped.
|
||||
*
|
||||
* Re-validate here to calculate these parameters / watermarks.
|
||||
*/
|
||||
res = dc_validate_global_state(dc, context, false);
|
||||
if (res != DC_OK) {
|
||||
DC_LOG_ERROR("DC commit global validation failure: %s (%d)",
|
||||
dc_status_to_str(res), res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = dc_commit_state_no_check(dc, context);
|
||||
|
||||
context_alloc_fail:
|
||||
|
||||
DC_LOG_DC("%s Finished.\n", __func__);
|
||||
|
||||
return (res == DC_OK);
|
||||
}
|
||||
|
||||
/* TODO: When the transition to the new commit sequence is done, remove this
|
||||
* function in favor of dc_commit_streams. */
|
||||
bool dc_commit_state(struct dc *dc, struct dc_state *context)
|
||||
{
|
||||
enum dc_status result = DC_ERROR_UNEXPECTED;
|
||||
int i;
|
||||
|
||||
if (!context_changed(dc, context))
|
||||
/* TODO: Since change commit sequence can have a huge impact,
|
||||
* we decided to only enable it for DCN3x. However, as soon as
|
||||
* we get more confident about this change we'll need to enable
|
||||
* the new sequence for all ASICs. */
|
||||
if (dc->ctx->dce_version >= DCN_VERSION_3_2) {
|
||||
result = dc_commit_streams(dc, context->streams, context->stream_count);
|
||||
return result == DC_OK;
|
||||
}
|
||||
|
||||
if (!streams_changed(dc, context->streams, context->stream_count))
|
||||
return DC_OK;
|
||||
|
||||
DC_LOG_DC("%s: %d streams\n",
|
||||
@ -2482,8 +2588,11 @@ static enum surface_update_type check_update_surfaces_for_stream(
|
||||
|
||||
if (stream_update->mst_bw_update)
|
||||
su_flags->bits.mst_bw = 1;
|
||||
if (stream_update->crtc_timing_adjust && dc_extended_blank_supported(dc))
|
||||
su_flags->bits.crtc_timing_adjust = 1;
|
||||
|
||||
if (stream_update->stream && stream_update->stream->freesync_on_desktop &&
|
||||
(stream_update->vrr_infopacket || stream_update->allow_freesync ||
|
||||
stream_update->vrr_active_variable))
|
||||
su_flags->bits.fams_changed = 1;
|
||||
|
||||
if (su_flags->raw != 0)
|
||||
overall_type = UPDATE_TYPE_FULL;
|
||||
@ -3648,17 +3757,17 @@ static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc,
|
||||
}
|
||||
}
|
||||
|
||||
/* For SubVP when adding MPO video we need to add a minimal transition.
|
||||
/* For SubVP when adding or removing planes we need to add a minimal transition
|
||||
* (even when disabling all planes). Whenever disabling a phantom pipe, we
|
||||
* must use the minimal transition path to disable the pipe correctly.
|
||||
*/
|
||||
if (cur_stream_status && stream->mall_stream_config.type == SUBVP_MAIN) {
|
||||
/* determine if minimal transition is required due to SubVP*/
|
||||
if (surface_count > 0) {
|
||||
if (cur_stream_status->plane_count > surface_count) {
|
||||
force_minimal_pipe_splitting = true;
|
||||
} else if (cur_stream_status->plane_count < surface_count) {
|
||||
force_minimal_pipe_splitting = true;
|
||||
*is_plane_addition = true;
|
||||
}
|
||||
if (cur_stream_status->plane_count > surface_count) {
|
||||
force_minimal_pipe_splitting = true;
|
||||
} else if (cur_stream_status->plane_count < surface_count) {
|
||||
force_minimal_pipe_splitting = true;
|
||||
*is_plane_addition = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3675,6 +3784,8 @@ static bool commit_minimal_transition_state(struct dc *dc,
|
||||
enum dc_status ret = DC_ERROR_UNEXPECTED;
|
||||
unsigned int i, j;
|
||||
unsigned int pipe_in_use = 0;
|
||||
bool subvp_in_use = false;
|
||||
bool odm_in_use = false;
|
||||
|
||||
if (!transition_context)
|
||||
return false;
|
||||
@ -3687,6 +3798,30 @@ static bool commit_minimal_transition_state(struct dc *dc,
|
||||
pipe_in_use++;
|
||||
}
|
||||
|
||||
/* If SubVP is enabled and we are adding or removing planes from any main subvp
|
||||
* pipe, we must use the minimal transition.
|
||||
*/
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
|
||||
|
||||
if (pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
|
||||
subvp_in_use = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If ODM is enabled and we are adding or removing planes from any ODM
|
||||
* pipe, we must use the minimal transition.
|
||||
*/
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
|
||||
|
||||
if (pipe->stream && pipe->next_odm_pipe) {
|
||||
odm_in_use = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* When the OS add a new surface if we have been used all of pipes with odm combine
|
||||
* and mpc split feature, it need use commit_minimal_transition_state to transition safely.
|
||||
* After OS exit MPO, it will back to use odm and mpc split with all of pipes, we need
|
||||
@ -3695,7 +3830,7 @@ static bool commit_minimal_transition_state(struct dc *dc,
|
||||
* Reduce the scenarios to use dc_commit_state_no_check in the stage of flip. Especially
|
||||
* enter/exit MPO when DCN still have enough resources.
|
||||
*/
|
||||
if (pipe_in_use != dc->res_pool->pipe_count) {
|
||||
if (pipe_in_use != dc->res_pool->pipe_count && !subvp_in_use && !odm_in_use) {
|
||||
dc_release_state(transition_context);
|
||||
return true;
|
||||
}
|
||||
@ -4430,21 +4565,17 @@ void dc_mclk_switch_using_fw_based_vblank_stretch_shut_down(struct dc *dc)
|
||||
dc->current_state->bw_ctx.bw.dcn.clk.fw_based_mclk_switching_shut_down = true;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function: dc_is_dmub_outbox_supported -
|
||||
/**
|
||||
* dc_is_dmub_outbox_supported - Check if DMUB firmware support outbox notification
|
||||
*
|
||||
* @brief
|
||||
* Checks whether DMUB FW supports outbox notifications, if supported
|
||||
* DM should register outbox interrupt prior to actually enabling interrupts
|
||||
* via dc_enable_dmub_outbox
|
||||
* @dc: [in] dc structure
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* Checks whether DMUB FW supports outbox notifications, if supported DM
|
||||
* should register outbox interrupt prior to actually enabling interrupts
|
||||
* via dc_enable_dmub_outbox
|
||||
*
|
||||
* @return
|
||||
* True if DMUB FW supports outbox notifications, False otherwise
|
||||
*****************************************************************************
|
||||
* Return:
|
||||
* True if DMUB FW supports outbox notifications, False otherwise
|
||||
*/
|
||||
bool dc_is_dmub_outbox_supported(struct dc *dc)
|
||||
{
|
||||
@ -4462,21 +4593,17 @@ bool dc_is_dmub_outbox_supported(struct dc *dc)
|
||||
return dc->debug.enable_dmub_aux_for_legacy_ddc;
|
||||
}
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
* Function: dc_enable_dmub_notifications
|
||||
/**
|
||||
* dc_enable_dmub_notifications - Check if dmub fw supports outbox
|
||||
*
|
||||
* @brief
|
||||
* Calls dc_is_dmub_outbox_supported to check if dmub fw supports outbox
|
||||
* notifications. All DMs shall switch to dc_is_dmub_outbox_supported.
|
||||
* This API shall be removed after switching.
|
||||
* @dc: [in] dc structure
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* Calls dc_is_dmub_outbox_supported to check if dmub fw supports outbox
|
||||
* notifications. All DMs shall switch to dc_is_dmub_outbox_supported. This
|
||||
* API shall be removed after switching.
|
||||
*
|
||||
* @return
|
||||
* True if DMUB FW supports outbox notifications, False otherwise
|
||||
*****************************************************************************
|
||||
* Return:
|
||||
* True if DMUB FW supports outbox notifications, False otherwise
|
||||
*/
|
||||
bool dc_enable_dmub_notifications(struct dc *dc)
|
||||
{
|
||||
@ -4484,18 +4611,11 @@ bool dc_enable_dmub_notifications(struct dc *dc)
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_enable_dmub_outbox
|
||||
* dc_enable_dmub_outbox - Enables DMUB unsolicited notification
|
||||
*
|
||||
* @brief
|
||||
* Enables DMUB unsolicited notifications to x86 via outbox
|
||||
* @dc: [in] dc structure
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
*
|
||||
* @return
|
||||
* None
|
||||
*****************************************************************************
|
||||
* Enables DMUB unsolicited notifications to x86 via outbox.
|
||||
*/
|
||||
void dc_enable_dmub_outbox(struct dc *dc)
|
||||
{
|
||||
@ -4596,21 +4716,17 @@ uint8_t get_link_index_from_dpia_port_index(const struct dc *dc,
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_process_dmub_set_config_async
|
||||
* dc_process_dmub_set_config_async - Submits set_config command
|
||||
*
|
||||
* @brief
|
||||
* Submits set_config command to dmub via inbox message
|
||||
* @dc: [in] dc structure
|
||||
* @link_index: [in] link_index: link index
|
||||
* @payload: [in] aux payload
|
||||
* @notify: [out] set_config immediate reply
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] link_index: link index
|
||||
* [in] payload: aux payload
|
||||
* [out] notify: set_config immediate reply
|
||||
* Submits set_config command to dmub via inbox message.
|
||||
*
|
||||
* @return
|
||||
* True if successful, False if failure
|
||||
*****************************************************************************
|
||||
* Return:
|
||||
* True if successful, False if failure
|
||||
*/
|
||||
bool dc_process_dmub_set_config_async(struct dc *dc,
|
||||
uint32_t link_index,
|
||||
@ -4646,21 +4762,17 @@ bool dc_process_dmub_set_config_async(struct dc *dc,
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_process_dmub_set_mst_slots
|
||||
* dc_process_dmub_set_mst_slots - Submits MST solt allocation
|
||||
*
|
||||
* @brief
|
||||
* Submits mst slot allocation command to dmub via inbox message
|
||||
* @dc: [in] dc structure
|
||||
* @link_index: [in] link index
|
||||
* @mst_alloc_slots: [in] mst slots to be allotted
|
||||
* @mst_slots_in_use: [out] mst slots in use returned in failure case
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] link_index: link index
|
||||
* [in] mst_alloc_slots: mst slots to be allotted
|
||||
* [out] mst_slots_in_use: mst slots in use returned in failure case
|
||||
* Submits mst slot allocation command to dmub via inbox message
|
||||
*
|
||||
* @return
|
||||
* DC_OK if successful, DC_ERROR if failure
|
||||
*****************************************************************************
|
||||
* Return:
|
||||
* DC_OK if successful, DC_ERROR if failure
|
||||
*/
|
||||
enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,
|
||||
uint32_t link_index,
|
||||
@ -4700,19 +4812,12 @@ enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,
|
||||
}
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* Function: dc_process_dmub_dpia_hpd_int_enable
|
||||
* dc_process_dmub_dpia_hpd_int_enable - Submits DPIA DPD interruption
|
||||
*
|
||||
* @brief
|
||||
* Submits dpia hpd int enable command to dmub via inbox message
|
||||
* @dc: [in] dc structure
|
||||
* @hpd_int_enable: [in] 1 for hpd int enable, 0 to disable
|
||||
*
|
||||
* @param
|
||||
* [in] dc: dc structure
|
||||
* [in] hpd_int_enable: 1 for hpd int enable, 0 to disable
|
||||
*
|
||||
* @return
|
||||
* None
|
||||
*****************************************************************************
|
||||
* Submits dpia hpd int enable command to dmub via inbox message
|
||||
*/
|
||||
void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc,
|
||||
uint32_t hpd_int_enable)
|
||||
@ -4741,16 +4846,13 @@ void dc_disable_accelerated_mode(struct dc *dc)
|
||||
|
||||
|
||||
/**
|
||||
*****************************************************************************
|
||||
* dc_notify_vsync_int_state() - notifies vsync enable/disable state
|
||||
* dc_notify_vsync_int_state - notifies vsync enable/disable state
|
||||
* @dc: dc structure
|
||||
* @stream: stream where vsync int state changed
|
||||
* @enable: whether vsync is enabled or disabled
|
||||
* @stream: stream where vsync int state changed
|
||||
* @enable: whether vsync is enabled or disabled
|
||||
*
|
||||
* Called when vsync is enabled/disabled
|
||||
* Will notify DMUB to start/stop ABM interrupts after steady state is reached
|
||||
*
|
||||
*****************************************************************************
|
||||
* Called when vsync is enabled/disabled Will notify DMUB to start/stop ABM
|
||||
* interrupts after steady state is reached.
|
||||
*/
|
||||
void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable)
|
||||
{
|
||||
@ -4792,17 +4894,3 @@ void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bo
|
||||
if (pipe->stream_res.abm && pipe->stream_res.abm->funcs->set_abm_pause)
|
||||
pipe->stream_res.abm->funcs->set_abm_pause(pipe->stream_res.abm, !enable, i, pipe->stream_res.tg->inst);
|
||||
}
|
||||
/*
|
||||
* dc_extended_blank_supported: Decide whether extended blank is supported
|
||||
*
|
||||
* Extended blank is a freesync optimization feature to be enabled in the future.
|
||||
* During the extra vblank period gained from freesync, we have the ability to enter z9/z10.
|
||||
*
|
||||
* @param [in] dc: Current DC state
|
||||
* @return: Indicate whether extended blank is supported (true or false)
|
||||
*/
|
||||
bool dc_extended_blank_supported(struct dc *dc)
|
||||
{
|
||||
return dc->debug.extended_blank_optimization && !dc->debug.disable_z10
|
||||
&& dc->caps.zstate_support && dc->caps.is_apu;
|
||||
}
|
||||
|
@ -1444,6 +1444,26 @@ static int acquire_first_split_pipe(
|
||||
split_pipe->plane_res.mpcc_inst = pool->dpps[i]->inst;
|
||||
split_pipe->pipe_idx = i;
|
||||
|
||||
split_pipe->stream = stream;
|
||||
return i;
|
||||
} else if (split_pipe->prev_odm_pipe &&
|
||||
split_pipe->prev_odm_pipe->plane_state == split_pipe->plane_state) {
|
||||
split_pipe->prev_odm_pipe->next_odm_pipe = split_pipe->next_odm_pipe;
|
||||
if (split_pipe->next_odm_pipe)
|
||||
split_pipe->next_odm_pipe->prev_odm_pipe = split_pipe->prev_odm_pipe;
|
||||
|
||||
if (split_pipe->prev_odm_pipe->plane_state)
|
||||
resource_build_scaling_params(split_pipe->prev_odm_pipe);
|
||||
|
||||
memset(split_pipe, 0, sizeof(*split_pipe));
|
||||
split_pipe->stream_res.tg = pool->timing_generators[i];
|
||||
split_pipe->plane_res.hubp = pool->hubps[i];
|
||||
split_pipe->plane_res.ipp = pool->ipps[i];
|
||||
split_pipe->plane_res.dpp = pool->dpps[i];
|
||||
split_pipe->stream_res.opp = pool->opps[i];
|
||||
split_pipe->plane_res.mpcc_inst = pool->dpps[i]->inst;
|
||||
split_pipe->pipe_idx = i;
|
||||
|
||||
split_pipe->stream = stream;
|
||||
return i;
|
||||
}
|
||||
|
@ -56,9 +56,7 @@ struct dmub_notification;
|
||||
#define MIN_VIEWPORT_SIZE 12
|
||||
#define MAX_NUM_EDP 2
|
||||
|
||||
/*******************************************************************************
|
||||
* Display Core Interfaces
|
||||
******************************************************************************/
|
||||
/* Display Core Interfaces */
|
||||
struct dc_versions {
|
||||
const char *dc_ver;
|
||||
struct dmcu_version dmcu_version;
|
||||
@ -993,9 +991,7 @@ void dc_init_callbacks(struct dc *dc,
|
||||
void dc_deinit_callbacks(struct dc *dc);
|
||||
void dc_destroy(struct dc **dc);
|
||||
|
||||
/*******************************************************************************
|
||||
* Surface Interfaces
|
||||
******************************************************************************/
|
||||
/* Surface Interfaces */
|
||||
|
||||
enum {
|
||||
TRANSFER_FUNC_POINTS = 1025
|
||||
@ -1274,12 +1270,23 @@ void dc_post_update_surfaces_to_stream(
|
||||
|
||||
#include "dc_stream.h"
|
||||
|
||||
/*
|
||||
* Structure to store surface/stream associations for validation
|
||||
/**
|
||||
* struct dc_validation_set - Struct to store surface/stream associations for validation
|
||||
*/
|
||||
struct dc_validation_set {
|
||||
/**
|
||||
* @stream: Stream state properties
|
||||
*/
|
||||
struct dc_stream_state *stream;
|
||||
|
||||
/**
|
||||
* @plane_state: Surface state
|
||||
*/
|
||||
struct dc_plane_state *plane_states[MAX_SURFACES];
|
||||
|
||||
/**
|
||||
* @plane_count: Total of active planes
|
||||
*/
|
||||
uint8_t plane_count;
|
||||
};
|
||||
|
||||
@ -1326,15 +1333,12 @@ void dc_resource_state_destruct(struct dc_state *context);
|
||||
|
||||
bool dc_resource_is_dsc_encoding_supported(const struct dc *dc);
|
||||
|
||||
/*
|
||||
* TODO update to make it about validation sets
|
||||
* Set up streams and links associated to drive sinks
|
||||
* The streams parameter is an absolute set of all active streams.
|
||||
*
|
||||
* After this call:
|
||||
* Phy, Encoder, Timing Generator are programmed and enabled.
|
||||
* New streams are enabled with blank stream; no memory read.
|
||||
*/
|
||||
enum dc_status dc_commit_streams(struct dc *dc,
|
||||
struct dc_stream_state *streams[],
|
||||
uint8_t stream_count);
|
||||
|
||||
/* TODO: When the transition to the new commit sequence is done, remove this
|
||||
* function in favor of dc_commit_streams. */
|
||||
bool dc_commit_state(struct dc *dc, struct dc_state *context);
|
||||
|
||||
struct dc_state *dc_create_state(struct dc *dc);
|
||||
@ -1342,9 +1346,7 @@ struct dc_state *dc_copy_state(struct dc_state *src_ctx);
|
||||
void dc_retain_state(struct dc_state *context);
|
||||
void dc_release_state(struct dc_state *context);
|
||||
|
||||
/*******************************************************************************
|
||||
* Link Interfaces
|
||||
******************************************************************************/
|
||||
/* Link Interfaces */
|
||||
|
||||
struct dpcd_caps {
|
||||
union dpcd_rev dpcd_rev;
|
||||
@ -1446,9 +1448,7 @@ struct hdcp_caps {
|
||||
|
||||
uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane);
|
||||
|
||||
/*******************************************************************************
|
||||
* Sink Interfaces - A sink corresponds to a display output device
|
||||
******************************************************************************/
|
||||
/* Sink Interfaces - A sink corresponds to a display output device */
|
||||
|
||||
struct dc_container_id {
|
||||
// 128bit GUID in binary form
|
||||
@ -1520,8 +1520,6 @@ struct dc_sink_init_data {
|
||||
bool converter_disable_audio;
|
||||
};
|
||||
|
||||
bool dc_extended_blank_supported(struct dc *dc);
|
||||
|
||||
struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
|
||||
|
||||
/* Newer interfaces */
|
||||
@ -1531,9 +1529,7 @@ struct dc_cursor {
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Interrupt interfaces
|
||||
******************************************************************************/
|
||||
/* Interrupt interfaces */
|
||||
enum dc_irq_source dc_interrupt_to_irq_source(
|
||||
struct dc *dc,
|
||||
uint32_t src_id,
|
||||
@ -1545,9 +1541,7 @@ enum dc_irq_source dc_get_hpd_irq_source_at_index(
|
||||
|
||||
void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bool enable);
|
||||
|
||||
/*******************************************************************************
|
||||
* Power Interfaces
|
||||
******************************************************************************/
|
||||
/* Power Interfaces */
|
||||
|
||||
void dc_set_power_state(
|
||||
struct dc *dc,
|
||||
@ -1620,14 +1614,10 @@ enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,
|
||||
void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc,
|
||||
uint32_t hpd_int_enable);
|
||||
|
||||
/*******************************************************************************
|
||||
* DSC Interfaces
|
||||
******************************************************************************/
|
||||
/* DSC Interfaces */
|
||||
#include "dc_dsc.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Disable acc mode Interfaces
|
||||
******************************************************************************/
|
||||
/* Disable acc mode Interfaces */
|
||||
void dc_disable_accelerated_mode(struct dc *dc);
|
||||
|
||||
#endif /* DC_INTERFACE_H_ */
|
||||
|
@ -1026,3 +1026,10 @@ void dc_send_update_cursor_info_to_dmu(
|
||||
dc_send_cmd_to_dmu(pCtx->stream->ctx->dmub_srv, &cmd);
|
||||
}
|
||||
}
|
||||
|
||||
bool dc_dmub_check_min_version(struct dmub_srv *srv)
|
||||
{
|
||||
if (!srv->hw_funcs.is_psrsu_supported)
|
||||
return true;
|
||||
return srv->hw_funcs.is_psrsu_supported(srv);
|
||||
}
|
||||
|
@ -89,4 +89,5 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc, struct dc_state *context, b
|
||||
void dc_dmub_srv_log_diagnostic_data(struct dc_dmub_srv *dc_dmub_srv);
|
||||
|
||||
void dc_send_update_cursor_info_to_dmu(struct pipe_ctx *pCtx, uint8_t pipe_idx);
|
||||
bool dc_dmub_check_min_version(struct dmub_srv *srv);
|
||||
#endif /* _DMUB_DC_SRV_H_ */
|
||||
|
@ -41,6 +41,10 @@ struct timing_sync_info {
|
||||
struct dc_stream_status {
|
||||
int primary_otg_inst;
|
||||
int stream_enc_inst;
|
||||
|
||||
/**
|
||||
* @plane_count: Total of planes attached to a single stream
|
||||
*/
|
||||
int plane_count;
|
||||
int audio_inst;
|
||||
struct timing_sync_info timing_sync_info;
|
||||
@ -127,6 +131,7 @@ union stream_update_flags {
|
||||
uint32_t dsc_changed : 1;
|
||||
uint32_t mst_bw : 1;
|
||||
uint32_t crtc_timing_adjust : 1;
|
||||
uint32_t fams_changed : 1;
|
||||
} bits;
|
||||
|
||||
uint32_t raw;
|
||||
|
@ -2036,7 +2036,7 @@ void dcn20_optimize_bandwidth(
|
||||
dc->clk_mgr,
|
||||
context,
|
||||
true);
|
||||
if (dc_extended_blank_supported(dc) && context->bw_ctx.bw.dcn.clk.zstate_support == DCN_ZSTATE_SUPPORT_ALLOW) {
|
||||
if (context->bw_ctx.bw.dcn.clk.zstate_support == DCN_ZSTATE_SUPPORT_ALLOW) {
|
||||
for (i = 0; i < dc->res_pool->pipe_count; ++i) {
|
||||
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
|
||||
|
||||
@ -2044,7 +2044,7 @@ void dcn20_optimize_bandwidth(
|
||||
&& pipe_ctx->stream->adjust.v_total_min == pipe_ctx->stream->adjust.v_total_max
|
||||
&& pipe_ctx->stream->adjust.v_total_max > pipe_ctx->stream->timing.v_total)
|
||||
pipe_ctx->plane_res.hubp->funcs->program_extended_blank(pipe_ctx->plane_res.hubp,
|
||||
pipe_ctx->dlg_regs.optimized_min_dst_y_next_start);
|
||||
pipe_ctx->dlg_regs.min_dst_y_next_start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,12 @@ void optc3_wait_drr_doublebuffer_pending_clear(struct timing_generator *optc)
|
||||
|
||||
void optc3_set_vtotal_min_max(struct timing_generator *optc, int vtotal_min, int vtotal_max)
|
||||
{
|
||||
optc1_set_vtotal_min_max(optc, vtotal_min, vtotal_max);
|
||||
struct dc *dc = optc->ctx->dc;
|
||||
|
||||
if (dc->caps.dmub_caps.mclk_sw && !dc->debug.disable_fams)
|
||||
dc_dmub_srv_drr_update_cmd(dc, optc->inst, vtotal_min, vtotal_max);
|
||||
else
|
||||
optc1_set_vtotal_min_max(optc, vtotal_min, vtotal_max);
|
||||
}
|
||||
|
||||
void optc3_tg_init(struct timing_generator *optc)
|
||||
|
@ -103,6 +103,7 @@ static void dcn31_program_det_size(struct hubbub *hubbub, int hubp_inst, unsigne
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DC_LOG_DEBUG("Set DET%d to %d segments\n", hubp_inst, det_size_segments);
|
||||
/* Should never be hit, if it is we have an erroneous hw config*/
|
||||
ASSERT(hubbub2->det0_size + hubbub2->det1_size + hubbub2->det2_size
|
||||
+ hubbub2->det3_size + hubbub2->compbuf_size_segments <= hubbub2->crb_size_segs);
|
||||
|
@ -136,6 +136,9 @@
|
||||
|
||||
#define DCN3_15_MAX_DET_SIZE 384
|
||||
#define DCN3_15_CRB_SEGMENT_SIZE_KB 64
|
||||
#define DCN3_15_MAX_DET_SEGS (DCN3_15_MAX_DET_SIZE / DCN3_15_CRB_SEGMENT_SIZE_KB)
|
||||
/* Minimum 2 extra segments need to be in compbuf and claimable to guarantee seamless mpo transitions */
|
||||
#define MIN_RESERVED_DET_SEGS 2
|
||||
|
||||
enum dcn31_clk_src_array_id {
|
||||
DCN31_CLK_SRC_PLL0,
|
||||
@ -1636,21 +1639,61 @@ static bool is_dual_plane(enum surface_pixel_format format)
|
||||
return format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN || format == SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA;
|
||||
}
|
||||
|
||||
static int source_format_to_bpp (enum source_format_class SourcePixelFormat)
|
||||
{
|
||||
if (SourcePixelFormat == dm_444_64)
|
||||
return 8;
|
||||
else if (SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_16)
|
||||
return 2;
|
||||
else if (SourcePixelFormat == dm_444_8)
|
||||
return 1;
|
||||
else if (SourcePixelFormat == dm_rgbe_alpha)
|
||||
return 5;
|
||||
else if (SourcePixelFormat == dm_420_8)
|
||||
return 3;
|
||||
else if (SourcePixelFormat == dm_420_12)
|
||||
return 6;
|
||||
else
|
||||
return 4;
|
||||
}
|
||||
|
||||
static bool allow_pixel_rate_crb(struct dc *dc, struct dc_state *context)
|
||||
{
|
||||
int i;
|
||||
struct resource_context *res_ctx = &context->res_ctx;
|
||||
|
||||
/*Don't apply for single stream*/
|
||||
if (context->stream_count < 2)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (!res_ctx->pipe_ctx[i].stream)
|
||||
continue;
|
||||
|
||||
/*Don't apply if MPO to avoid transition issues*/
|
||||
if (res_ctx->pipe_ctx[i].top_pipe && res_ctx->pipe_ctx[i].top_pipe->plane_state != res_ctx->pipe_ctx[i].plane_state)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int dcn315_populate_dml_pipes_from_context(
|
||||
struct dc *dc, struct dc_state *context,
|
||||
display_e2e_pipe_params_st *pipes,
|
||||
bool fast_validate)
|
||||
{
|
||||
int i, pipe_cnt;
|
||||
int i, pipe_cnt, crb_idx, crb_pipes;
|
||||
struct resource_context *res_ctx = &context->res_ctx;
|
||||
struct pipe_ctx *pipe;
|
||||
const int max_usable_det = context->bw_ctx.dml.ip.config_return_buffer_size_in_kbytes - DCN3_15_MIN_COMPBUF_SIZE_KB;
|
||||
int remaining_det_segs = max_usable_det / DCN3_15_CRB_SEGMENT_SIZE_KB;
|
||||
bool pixel_rate_crb = allow_pixel_rate_crb(dc, context);
|
||||
|
||||
DC_FP_START();
|
||||
dcn20_populate_dml_pipes_from_context(dc, context, pipes, fast_validate);
|
||||
DC_FP_END();
|
||||
|
||||
for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
for (i = 0, pipe_cnt = 0, crb_pipes = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
struct dc_crtc_timing *timing;
|
||||
|
||||
if (!res_ctx->pipe_ctx[i].stream)
|
||||
@ -1672,6 +1715,23 @@ static int dcn315_populate_dml_pipes_from_context(
|
||||
pipes[pipe_cnt].dout.dsc_input_bpc = 0;
|
||||
DC_FP_START();
|
||||
dcn31_zero_pipe_dcc_fraction(pipes, pipe_cnt);
|
||||
if (pixel_rate_crb && !pipe->top_pipe && !pipe->prev_odm_pipe) {
|
||||
int bpp = source_format_to_bpp(pipes[pipe_cnt].pipe.src.source_format);
|
||||
/* Ceil to crb segment size */
|
||||
int approx_det_segs_required_for_pstate = dcn_get_approx_det_segs_required_for_pstate(
|
||||
&context->bw_ctx.dml.soc, timing->pix_clk_100hz, bpp, DCN3_15_CRB_SEGMENT_SIZE_KB);
|
||||
if (approx_det_segs_required_for_pstate <= 2 * DCN3_15_MAX_DET_SEGS) {
|
||||
bool split_required = approx_det_segs_required_for_pstate > DCN3_15_MAX_DET_SEGS;
|
||||
split_required = split_required || timing->pix_clk_100hz >= dcn_get_max_non_odm_pix_rate_100hz(&dc->dml.soc);
|
||||
split_required = split_required || (pipe->plane_state && pipe->plane_state->src_rect.width > 5120);
|
||||
if (split_required)
|
||||
approx_det_segs_required_for_pstate += approx_det_segs_required_for_pstate % 2;
|
||||
pipes[pipe_cnt].pipe.src.det_size_override = approx_det_segs_required_for_pstate;
|
||||
remaining_det_segs -= approx_det_segs_required_for_pstate;
|
||||
} else
|
||||
remaining_det_segs = -1;
|
||||
crb_pipes++;
|
||||
}
|
||||
DC_FP_END();
|
||||
|
||||
if (pipes[pipe_cnt].dout.dsc_enable) {
|
||||
@ -1690,16 +1750,54 @@ static int dcn315_populate_dml_pipes_from_context(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pipe_cnt++;
|
||||
}
|
||||
|
||||
/* Spread remaining unreserved crb evenly among all pipes*/
|
||||
if (pixel_rate_crb) {
|
||||
for (i = 0, pipe_cnt = 0, crb_idx = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
pipe = &res_ctx->pipe_ctx[i];
|
||||
if (!pipe->stream)
|
||||
continue;
|
||||
|
||||
/* Do not use asymetric crb if not enough for pstate support */
|
||||
if (remaining_det_segs < 0) {
|
||||
pipes[pipe_cnt].pipe.src.det_size_override = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pipe->top_pipe && !pipe->prev_odm_pipe) {
|
||||
bool split_required = pipe->stream->timing.pix_clk_100hz >= dcn_get_max_non_odm_pix_rate_100hz(&dc->dml.soc)
|
||||
|| (pipe->plane_state && pipe->plane_state->src_rect.width > 5120);
|
||||
|
||||
if (remaining_det_segs > MIN_RESERVED_DET_SEGS)
|
||||
pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs - MIN_RESERVED_DET_SEGS) / crb_pipes +
|
||||
(crb_idx < (remaining_det_segs - MIN_RESERVED_DET_SEGS) % crb_pipes ? 1 : 0);
|
||||
if (pipes[pipe_cnt].pipe.src.det_size_override > 2 * DCN3_15_MAX_DET_SEGS) {
|
||||
/* Clamp to 2 pipe split max det segments */
|
||||
remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override - 2 * (DCN3_15_MAX_DET_SEGS);
|
||||
pipes[pipe_cnt].pipe.src.det_size_override = 2 * DCN3_15_MAX_DET_SEGS;
|
||||
}
|
||||
if (pipes[pipe_cnt].pipe.src.det_size_override > DCN3_15_MAX_DET_SEGS || split_required) {
|
||||
/* If we are splitting we must have an even number of segments */
|
||||
remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override % 2;
|
||||
pipes[pipe_cnt].pipe.src.det_size_override -= pipes[pipe_cnt].pipe.src.det_size_override % 2;
|
||||
}
|
||||
/* Convert segments into size for DML use */
|
||||
pipes[pipe_cnt].pipe.src.det_size_override *= DCN3_15_CRB_SEGMENT_SIZE_KB;
|
||||
|
||||
crb_idx++;
|
||||
}
|
||||
pipe_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (pipe_cnt)
|
||||
context->bw_ctx.dml.ip.det_buffer_size_kbytes =
|
||||
(max_usable_det / DCN3_15_CRB_SEGMENT_SIZE_KB / pipe_cnt) * DCN3_15_CRB_SEGMENT_SIZE_KB;
|
||||
if (context->bw_ctx.dml.ip.det_buffer_size_kbytes > DCN3_15_MAX_DET_SIZE)
|
||||
context->bw_ctx.dml.ip.det_buffer_size_kbytes = DCN3_15_MAX_DET_SIZE;
|
||||
ASSERT(context->bw_ctx.dml.ip.det_buffer_size_kbytes >= DCN3_15_DEFAULT_DET_SIZE);
|
||||
|
||||
dc->config.enable_4to1MPC = false;
|
||||
if (pipe_cnt == 1 && pipe->plane_state && !dc->debug.disable_z9_mpc) {
|
||||
if (is_dual_plane(pipe->plane_state->format)
|
||||
@ -1707,7 +1805,9 @@ static int dcn315_populate_dml_pipes_from_context(
|
||||
dc->config.enable_4to1MPC = true;
|
||||
context->bw_ctx.dml.ip.det_buffer_size_kbytes =
|
||||
(max_usable_det / DCN3_15_CRB_SEGMENT_SIZE_KB / 4) * DCN3_15_CRB_SEGMENT_SIZE_KB;
|
||||
} else if (!is_dual_plane(pipe->plane_state->format) && pipe->plane_state->src_rect.width <= 5120) {
|
||||
} else if (!is_dual_plane(pipe->plane_state->format)
|
||||
&& pipe->plane_state->src_rect.width <= 5120
|
||||
&& pipe->stream->timing.pix_clk_100hz < dcn_get_max_non_odm_pix_rate_100hz(&dc->dml.soc)) {
|
||||
/* Limit to 5k max to avoid forced pipe split when there is not enough detile for swath */
|
||||
context->bw_ctx.dml.ip.det_buffer_size_kbytes = 192;
|
||||
pipes[0].pipe.src.unbounded_req_mode = true;
|
||||
|
@ -948,10 +948,10 @@ static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struc
|
||||
{
|
||||
int plane_count;
|
||||
int i;
|
||||
unsigned int optimized_min_dst_y_next_start_us;
|
||||
unsigned int min_dst_y_next_start_us;
|
||||
|
||||
plane_count = 0;
|
||||
optimized_min_dst_y_next_start_us = 0;
|
||||
min_dst_y_next_start_us = 0;
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (context->res_ctx.pipe_ctx[i].plane_state)
|
||||
plane_count++;
|
||||
@ -973,19 +973,18 @@ static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struc
|
||||
else if (context->stream_count == 1 && context->streams[0]->signal == SIGNAL_TYPE_EDP) {
|
||||
struct dc_link *link = context->streams[0]->sink->link;
|
||||
struct dc_stream_status *stream_status = &context->stream_status[0];
|
||||
struct dc_stream_state *current_stream = context->streams[0];
|
||||
int minmum_z8_residency = dc->debug.minimum_z8_residency_time > 0 ? dc->debug.minimum_z8_residency_time : 1000;
|
||||
bool allow_z8 = context->bw_ctx.dml.vba.StutterPeriod > (double)minmum_z8_residency;
|
||||
bool is_pwrseq0 = link->link_index == 0;
|
||||
bool isFreesyncVideo;
|
||||
|
||||
if (dc_extended_blank_supported(dc)) {
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (context->res_ctx.pipe_ctx[i].stream == context->streams[0]
|
||||
&& context->res_ctx.pipe_ctx[i].stream->adjust.v_total_min == context->res_ctx.pipe_ctx[i].stream->adjust.v_total_max
|
||||
&& context->res_ctx.pipe_ctx[i].stream->adjust.v_total_min > context->res_ctx.pipe_ctx[i].stream->timing.v_total) {
|
||||
optimized_min_dst_y_next_start_us =
|
||||
context->res_ctx.pipe_ctx[i].dlg_regs.optimized_min_dst_y_next_start_us;
|
||||
break;
|
||||
}
|
||||
isFreesyncVideo = current_stream->adjust.v_total_min == current_stream->adjust.v_total_max;
|
||||
isFreesyncVideo = isFreesyncVideo && current_stream->timing.v_total < current_stream->adjust.v_total_min;
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (context->res_ctx.pipe_ctx[i].stream == current_stream && isFreesyncVideo) {
|
||||
min_dst_y_next_start_us = context->res_ctx.pipe_ctx[i].dlg_regs.min_dst_y_next_start_us;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -993,7 +992,7 @@ static enum dcn_zstate_support_state decide_zstate_support(struct dc *dc, struc
|
||||
if (stream_status->plane_count > 1)
|
||||
return DCN_ZSTATE_SUPPORT_DISALLOW;
|
||||
|
||||
if (is_pwrseq0 && (context->bw_ctx.dml.vba.StutterPeriod > 5000.0 || optimized_min_dst_y_next_start_us > 5000))
|
||||
if (is_pwrseq0 && (context->bw_ctx.dml.vba.StutterPeriod > 5000.0 || min_dst_y_next_start_us > 5000))
|
||||
return DCN_ZSTATE_SUPPORT_ALLOW;
|
||||
else if (is_pwrseq0 && link->psr_settings.psr_version == DC_PSR_VERSION_1 && !link->panel_config.psr.disable_psr)
|
||||
return allow_z8 ? DCN_ZSTATE_SUPPORT_ALLOW_Z8_Z10_ONLY : DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;
|
||||
|
@ -483,7 +483,7 @@ void dcn31_calculate_wm_and_dlg_fp(
|
||||
int pipe_cnt,
|
||||
int vlevel)
|
||||
{
|
||||
int i, pipe_idx, active_dpp_count = 0;
|
||||
int i, pipe_idx, total_det = 0, active_hubp_count = 0;
|
||||
double dcfclk = context->bw_ctx.dml.vba.DCFCLKState[vlevel][context->bw_ctx.dml.vba.maxMpcComb];
|
||||
|
||||
dc_assert_fp_enabled();
|
||||
@ -529,7 +529,7 @@ void dcn31_calculate_wm_and_dlg_fp(
|
||||
continue;
|
||||
|
||||
if (context->res_ctx.pipe_ctx[i].plane_state)
|
||||
active_dpp_count++;
|
||||
active_hubp_count++;
|
||||
|
||||
pipes[pipe_idx].clks_cfg.dispclk_mhz = get_dispclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt);
|
||||
pipes[pipe_idx].clks_cfg.dppclk_mhz = get_dppclk_calculated(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
|
||||
@ -547,9 +547,34 @@ void dcn31_calculate_wm_and_dlg_fp(
|
||||
}
|
||||
|
||||
dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel);
|
||||
/* For 31x apu pstate change is only supported if possible in vactive or if there are no active dpps */
|
||||
/* For 31x apu pstate change is only supported if possible in vactive*/
|
||||
context->bw_ctx.bw.dcn.clk.p_state_change_support =
|
||||
context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb] == dm_dram_clock_change_vactive || !active_dpp_count;
|
||||
context->bw_ctx.dml.vba.DRAMClockChangeSupport[vlevel][context->bw_ctx.dml.vba.maxMpcComb] == dm_dram_clock_change_vactive;
|
||||
/* If DCN isn't making memory requests we can allow pstate change and lower clocks */
|
||||
if (!active_hubp_count) {
|
||||
context->bw_ctx.bw.dcn.clk.socclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dcfclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dramclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.fclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.p_state_change_support = true;
|
||||
for (i = 0; i < dc->res_pool->pipe_count; i++)
|
||||
if (context->res_ctx.pipe_ctx[i].stream)
|
||||
context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = 0;
|
||||
}
|
||||
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (!context->res_ctx.pipe_ctx[i].stream)
|
||||
continue;
|
||||
|
||||
context->res_ctx.pipe_ctx[i].det_buffer_size_kb =
|
||||
get_det_buffer_size_kbytes(&context->bw_ctx.dml, pipes, pipe_cnt, pipe_idx);
|
||||
if (context->res_ctx.pipe_ctx[i].det_buffer_size_kb > 384)
|
||||
context->res_ctx.pipe_ctx[i].det_buffer_size_kb /= 2;
|
||||
total_det += context->res_ctx.pipe_ctx[i].det_buffer_size_kb;
|
||||
pipe_idx++;
|
||||
}
|
||||
context->bw_ctx.bw.dcn.compbuf_size_kb = context->bw_ctx.dml.ip.config_return_buffer_size_in_kbytes - total_det;
|
||||
}
|
||||
|
||||
void dcn31_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)
|
||||
@ -797,3 +822,19 @@ void dcn316_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param
|
||||
else
|
||||
dml_init_instance(&dc->dml, &dcn3_16_soc, &dcn3_16_ip, DML_PROJECT_DCN31_FPGA);
|
||||
}
|
||||
|
||||
int dcn_get_max_non_odm_pix_rate_100hz(struct _vcs_dpi_soc_bounding_box_st *soc)
|
||||
{
|
||||
return soc->clock_limits[0].dispclk_mhz * 10000.0 / (1.0 + soc->dcn_downspread_percent / 100.0);
|
||||
}
|
||||
|
||||
int dcn_get_approx_det_segs_required_for_pstate(
|
||||
struct _vcs_dpi_soc_bounding_box_st *soc,
|
||||
int pix_clk_100hz, int bpp, int seg_size_kb)
|
||||
{
|
||||
/* Roughly calculate required crb to hide latency. In practice there is slightly
|
||||
* more buffer available for latency hiding
|
||||
*/
|
||||
return (int)(soc->dram_clock_change_latency_us * pix_clk_100hz * bpp
|
||||
/ 10240000 + seg_size_kb - 1) / seg_size_kb;
|
||||
}
|
||||
|
@ -46,5 +46,9 @@ void dcn31_calculate_wm_and_dlg_fp(
|
||||
void dcn31_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params);
|
||||
void dcn315_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params);
|
||||
void dcn316_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params);
|
||||
int dcn_get_max_non_odm_pix_rate_100hz(struct _vcs_dpi_soc_bounding_box_st *soc);
|
||||
int dcn_get_approx_det_segs_required_for_pstate(
|
||||
struct _vcs_dpi_soc_bounding_box_st *soc,
|
||||
int pix_clk_100hz, int bpp, int seg_size_kb);
|
||||
|
||||
#endif /* __DCN31_FPU_H__*/
|
||||
|
@ -533,7 +533,8 @@ static void CalculateStutterEfficiency(
|
||||
static void CalculateSwathAndDETConfiguration(
|
||||
bool ForceSingleDPP,
|
||||
int NumberOfActivePlanes,
|
||||
unsigned int DETBufferSizeInKByte,
|
||||
bool DETSharedByAllDPP,
|
||||
unsigned int DETBufferSizeInKByte[],
|
||||
double MaximumSwathWidthLuma[],
|
||||
double MaximumSwathWidthChroma[],
|
||||
enum scan_direction_class SourceScan[],
|
||||
@ -3116,7 +3117,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
|
||||
v->SurfaceWidthC[k],
|
||||
v->SurfaceHeightY[k],
|
||||
v->SurfaceHeightC[k],
|
||||
v->DETBufferSizeInKByte[0] * 1024,
|
||||
v->DETBufferSizeInKByte[k] * 1024,
|
||||
v->BlockHeight256BytesY[k],
|
||||
v->BlockHeight256BytesC[k],
|
||||
v->SurfaceTiling[k],
|
||||
@ -3311,7 +3312,8 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
|
||||
CalculateSwathAndDETConfiguration(
|
||||
false,
|
||||
v->NumberOfActivePlanes,
|
||||
v->DETBufferSizeInKByte[0],
|
||||
mode_lib->project == DML_PROJECT_DCN315 && v->DETSizeOverride[0],
|
||||
v->DETBufferSizeInKByte,
|
||||
dummy1,
|
||||
dummy2,
|
||||
v->SourceScan,
|
||||
@ -3777,14 +3779,16 @@ static noinline void CalculatePrefetchSchedulePerPlane(
|
||||
&v->VReadyOffsetPix[k]);
|
||||
}
|
||||
|
||||
static void PatchDETBufferSizeInKByte(unsigned int NumberOfActivePlanes, int NoOfDPPThisState[], unsigned int config_return_buffer_size_in_kbytes, unsigned int *DETBufferSizeInKByte)
|
||||
static void PatchDETBufferSizeInKByte(unsigned int NumberOfActivePlanes, int NoOfDPPThisState[], unsigned int config_return_buffer_size_in_kbytes, unsigned int DETBufferSizeInKByte[])
|
||||
{
|
||||
int i, total_pipes = 0;
|
||||
for (i = 0; i < NumberOfActivePlanes; i++)
|
||||
total_pipes += NoOfDPPThisState[i];
|
||||
*DETBufferSizeInKByte = ((config_return_buffer_size_in_kbytes - DCN3_15_MIN_COMPBUF_SIZE_KB) / 64 / total_pipes) * 64;
|
||||
if (*DETBufferSizeInKByte > DCN3_15_MAX_DET_SIZE)
|
||||
*DETBufferSizeInKByte = DCN3_15_MAX_DET_SIZE;
|
||||
DETBufferSizeInKByte[0] = ((config_return_buffer_size_in_kbytes - DCN3_15_MIN_COMPBUF_SIZE_KB) / 64 / total_pipes) * 64;
|
||||
if (DETBufferSizeInKByte[0] > DCN3_15_MAX_DET_SIZE)
|
||||
DETBufferSizeInKByte[0] = DCN3_15_MAX_DET_SIZE;
|
||||
for (i = 1; i < NumberOfActivePlanes; i++)
|
||||
DETBufferSizeInKByte[i] = DETBufferSizeInKByte[0];
|
||||
}
|
||||
|
||||
|
||||
@ -4024,7 +4028,8 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
||||
CalculateSwathAndDETConfiguration(
|
||||
true,
|
||||
v->NumberOfActivePlanes,
|
||||
v->DETBufferSizeInKByte[0],
|
||||
mode_lib->project == DML_PROJECT_DCN315 && v->DETSizeOverride[0],
|
||||
v->DETBufferSizeInKByte,
|
||||
v->MaximumSwathWidthLuma,
|
||||
v->MaximumSwathWidthChroma,
|
||||
v->SourceScan,
|
||||
@ -4164,6 +4169,10 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
||||
|| (v->PlaneRequiredDISPCLK > v->MaxDispclkRoundedDownToDFSGranularity)) {
|
||||
v->DISPCLK_DPPCLK_Support[i][j] = false;
|
||||
}
|
||||
if (mode_lib->project == DML_PROJECT_DCN315 && v->DETSizeOverride[k] > DCN3_15_MAX_DET_SIZE && v->NoOfDPP[i][j][k] < 2) {
|
||||
v->MPCCombine[i][j][k] = true;
|
||||
v->NoOfDPP[i][j][k] = 2;
|
||||
}
|
||||
}
|
||||
v->TotalNumberOfActiveDPP[i][j] = 0;
|
||||
v->TotalNumberOfSingleDPPPlanes[i][j] = 0;
|
||||
@ -4640,12 +4649,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
|
||||
v->ODMCombineEnableThisState[k] = v->ODMCombineEnablePerState[i][k];
|
||||
}
|
||||
|
||||
if (v->NumberOfActivePlanes > 1 && mode_lib->project == DML_PROJECT_DCN315)
|
||||
PatchDETBufferSizeInKByte(v->NumberOfActivePlanes, v->NoOfDPPThisState, v->ip.config_return_buffer_size_in_kbytes, &v->DETBufferSizeInKByte[0]);
|
||||
if (v->NumberOfActivePlanes > 1 && mode_lib->project == DML_PROJECT_DCN315 && !v->DETSizeOverride[0])
|
||||
PatchDETBufferSizeInKByte(v->NumberOfActivePlanes, v->NoOfDPPThisState, v->ip.config_return_buffer_size_in_kbytes, v->DETBufferSizeInKByte);
|
||||
CalculateSwathAndDETConfiguration(
|
||||
false,
|
||||
v->NumberOfActivePlanes,
|
||||
v->DETBufferSizeInKByte[0],
|
||||
mode_lib->project == DML_PROJECT_DCN315 && v->DETSizeOverride[0],
|
||||
v->DETBufferSizeInKByte,
|
||||
v->MaximumSwathWidthLuma,
|
||||
v->MaximumSwathWidthChroma,
|
||||
v->SourceScan,
|
||||
@ -6557,7 +6567,8 @@ static void CalculateStutterEfficiency(
|
||||
static void CalculateSwathAndDETConfiguration(
|
||||
bool ForceSingleDPP,
|
||||
int NumberOfActivePlanes,
|
||||
unsigned int DETBufferSizeInKByte,
|
||||
bool DETSharedByAllDPP,
|
||||
unsigned int DETBufferSizeInKByteA[],
|
||||
double MaximumSwathWidthLuma[],
|
||||
double MaximumSwathWidthChroma[],
|
||||
enum scan_direction_class SourceScan[],
|
||||
@ -6641,6 +6652,10 @@ static void CalculateSwathAndDETConfiguration(
|
||||
|
||||
*ViewportSizeSupport = true;
|
||||
for (k = 0; k < NumberOfActivePlanes; ++k) {
|
||||
unsigned int DETBufferSizeInKByte = DETBufferSizeInKByteA[k];
|
||||
|
||||
if (DETSharedByAllDPP && DPPPerPlane[k])
|
||||
DETBufferSizeInKByte /= DPPPerPlane[k];
|
||||
if ((SourcePixelFormat[k] == dm_444_64 || SourcePixelFormat[k] == dm_444_32 || SourcePixelFormat[k] == dm_444_16 || SourcePixelFormat[k] == dm_mono_16
|
||||
|| SourcePixelFormat[k] == dm_mono_8 || SourcePixelFormat[k] == dm_rgbe)) {
|
||||
if (SurfaceTiling[k] == dm_sw_linear
|
||||
|
@ -988,8 +988,7 @@ static void dml_rq_dlg_get_dlg_params(
|
||||
|
||||
dlg_vblank_start = interlaced ? (vblank_start / 2) : vblank_start;
|
||||
disp_dlg_regs->min_dst_y_next_start = (unsigned int) (((double) dlg_vblank_start) * dml_pow(2, 2));
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start_us = 0;
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start = disp_dlg_regs->min_dst_y_next_start;
|
||||
disp_dlg_regs->min_dst_y_next_start_us = 0;
|
||||
ASSERT(disp_dlg_regs->min_dst_y_next_start < (unsigned int)dml_pow(2, 18));
|
||||
|
||||
dml_print("DML_DLG: %s: min_ttu_vblank (us) = %3.2f\n", __func__, min_ttu_vblank);
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "dml/display_mode_vba.h"
|
||||
|
||||
struct _vcs_dpi_ip_params_st dcn3_14_ip = {
|
||||
.VBlankNomDefaultUS = 668,
|
||||
.VBlankNomDefaultUS = 800,
|
||||
.gpuvm_enable = 1,
|
||||
.gpuvm_max_page_table_levels = 1,
|
||||
.hostvm_enable = 1,
|
||||
@ -288,6 +288,7 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
|
||||
struct resource_context *res_ctx = &context->res_ctx;
|
||||
struct pipe_ctx *pipe;
|
||||
bool upscaled = false;
|
||||
const unsigned int max_allowed_vblank_nom = 1023;
|
||||
|
||||
dc_assert_fp_enabled();
|
||||
|
||||
@ -301,9 +302,15 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
|
||||
pipe = &res_ctx->pipe_ctx[i];
|
||||
timing = &pipe->stream->timing;
|
||||
|
||||
if (dc_extended_blank_supported(dc) && pipe->stream->adjust.v_total_max == pipe->stream->adjust.v_total_min
|
||||
&& pipe->stream->adjust.v_total_min > timing->v_total)
|
||||
if (pipe->stream->adjust.v_total_min != 0)
|
||||
pipes[pipe_cnt].pipe.dest.vtotal = pipe->stream->adjust.v_total_min;
|
||||
else
|
||||
pipes[pipe_cnt].pipe.dest.vtotal = timing->v_total;
|
||||
|
||||
pipes[pipe_cnt].pipe.dest.vblank_nom = timing->v_total - pipes[pipe_cnt].pipe.dest.vactive;
|
||||
pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, dcn3_14_ip.VBlankNomDefaultUS);
|
||||
pipes[pipe_cnt].pipe.dest.vblank_nom = max(pipes[pipe_cnt].pipe.dest.vblank_nom, timing->v_sync_width);
|
||||
pipes[pipe_cnt].pipe.dest.vblank_nom = min(pipes[pipe_cnt].pipe.dest.vblank_nom, max_allowed_vblank_nom);
|
||||
|
||||
if (pipe->plane_state &&
|
||||
(pipe->plane_state->src_rect.height < pipe->plane_state->dst_rect.height ||
|
||||
@ -327,8 +334,6 @@ int dcn314_populate_dml_pipes_from_context_fpu(struct dc *dc, struct dc_state *c
|
||||
pipes[pipe_cnt].pipe.src.dcc_fraction_of_zs_req_luma = 0;
|
||||
pipes[pipe_cnt].pipe.src.dcc_fraction_of_zs_req_chroma = 0;
|
||||
pipes[pipe_cnt].pipe.dest.vfront_porch = timing->v_front_porch;
|
||||
pipes[pipe_cnt].pipe.dest.vblank_nom =
|
||||
dcn3_14_ip.VBlankNomDefaultUS / (timing->h_total / (timing->pix_clk_100hz / 10000.0));
|
||||
pipes[pipe_cnt].pipe.src.dcc_rate = 3;
|
||||
pipes[pipe_cnt].dout.dsc_input_bpc = 0;
|
||||
|
||||
|
@ -1053,7 +1053,6 @@ static void dml_rq_dlg_get_dlg_params(
|
||||
|
||||
float vba__refcyc_per_req_delivery_pre_l = get_refcyc_per_req_delivery_pre_l_in_us(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz; // From VBA
|
||||
float vba__refcyc_per_req_delivery_l = get_refcyc_per_req_delivery_l_in_us(mode_lib, e2e_pipe_param, num_pipes, pipe_idx) * refclk_freq_in_mhz; // From VBA
|
||||
int blank_lines = 0;
|
||||
|
||||
memset(disp_dlg_regs, 0, sizeof(*disp_dlg_regs));
|
||||
memset(disp_ttu_regs, 0, sizeof(*disp_ttu_regs));
|
||||
@ -1077,17 +1076,10 @@ static void dml_rq_dlg_get_dlg_params(
|
||||
min_ttu_vblank = get_min_ttu_vblank_in_us(mode_lib, e2e_pipe_param, num_pipes, pipe_idx); // From VBA
|
||||
|
||||
dlg_vblank_start = interlaced ? (vblank_start / 2) : vblank_start;
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start = disp_dlg_regs->min_dst_y_next_start;
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start_us = 0;
|
||||
disp_dlg_regs->min_dst_y_next_start = (unsigned int) (((double) dlg_vblank_start) * dml_pow(2, 2));
|
||||
blank_lines = (dst->vblank_end + dst->vtotal_min - dst->vblank_start - dst->vstartup_start - 1);
|
||||
if (blank_lines < 0)
|
||||
blank_lines = 0;
|
||||
if (blank_lines != 0) {
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start = vba__min_dst_y_next_start;
|
||||
disp_dlg_regs->optimized_min_dst_y_next_start_us = (disp_dlg_regs->optimized_min_dst_y_next_start * dst->hactive) / (unsigned int) dst->pixel_rate_mhz;
|
||||
disp_dlg_regs->min_dst_y_next_start = disp_dlg_regs->optimized_min_dst_y_next_start;
|
||||
}
|
||||
disp_dlg_regs->min_dst_y_next_start_us =
|
||||
(vba__min_dst_y_next_start * dst->hactive) / (unsigned int) dst->pixel_rate_mhz;
|
||||
disp_dlg_regs->min_dst_y_next_start = vba__min_dst_y_next_start * dml_pow(2, 2);
|
||||
|
||||
ASSERT(disp_dlg_regs->min_dst_y_next_start < (unsigned int)dml_pow(2, 18));
|
||||
|
||||
dml_print("DML_DLG: %s: min_ttu_vblank (us) = %3.2f\n", __func__, min_ttu_vblank);
|
||||
|
@ -1237,7 +1237,7 @@ static void dcn32_calculate_dlg_params(struct dc *dc, struct dc_state *context,
|
||||
display_e2e_pipe_params_st *pipes,
|
||||
int pipe_cnt, int vlevel)
|
||||
{
|
||||
int i, pipe_idx;
|
||||
int i, pipe_idx, active_hubp_count = 0;
|
||||
bool usr_retraining_support = false;
|
||||
bool unbounded_req_enabled = false;
|
||||
|
||||
@ -1282,6 +1282,8 @@ static void dcn32_calculate_dlg_params(struct dc *dc, struct dc_state *context,
|
||||
for (i = 0, pipe_idx = 0; i < dc->res_pool->pipe_count; i++) {
|
||||
if (!context->res_ctx.pipe_ctx[i].stream)
|
||||
continue;
|
||||
if (context->res_ctx.pipe_ctx[i].plane_state)
|
||||
active_hubp_count++;
|
||||
pipes[pipe_idx].pipe.dest.vstartup_start = get_vstartup(&context->bw_ctx.dml, pipes, pipe_cnt,
|
||||
pipe_idx);
|
||||
pipes[pipe_idx].pipe.dest.vupdate_offset = get_vupdate_offset(&context->bw_ctx.dml, pipes, pipe_cnt,
|
||||
@ -1303,10 +1305,23 @@ static void dcn32_calculate_dlg_params(struct dc *dc, struct dc_state *context,
|
||||
|
||||
if (context->bw_ctx.bw.dcn.clk.dppclk_khz < pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000)
|
||||
context->bw_ctx.bw.dcn.clk.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;
|
||||
context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;
|
||||
if (context->res_ctx.pipe_ctx[i].plane_state)
|
||||
context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = pipes[pipe_idx].clks_cfg.dppclk_mhz * 1000;
|
||||
else
|
||||
context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz = 0;
|
||||
context->res_ctx.pipe_ctx[i].pipe_dlg_param = pipes[pipe_idx].pipe.dest;
|
||||
pipe_idx++;
|
||||
}
|
||||
/* If DCN isn't making memory requests we can allow pstate change and lower clocks */
|
||||
if (!active_hubp_count) {
|
||||
context->bw_ctx.bw.dcn.clk.socclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dcfclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.dramclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.fclk_khz = 0;
|
||||
context->bw_ctx.bw.dcn.clk.p_state_change_support = true;
|
||||
}
|
||||
/*save a original dppclock copy*/
|
||||
context->bw_ctx.bw.dcn.clk.bw_dppclk_khz = context->bw_ctx.bw.dcn.clk.dppclk_khz;
|
||||
context->bw_ctx.bw.dcn.clk.bw_dispclk_khz = context->bw_ctx.bw.dcn.clk.dispclk_khz;
|
||||
|
@ -618,8 +618,7 @@ struct _vcs_dpi_display_dlg_regs_st {
|
||||
unsigned int refcyc_h_blank_end;
|
||||
unsigned int dlg_vblank_end;
|
||||
unsigned int min_dst_y_next_start;
|
||||
unsigned int optimized_min_dst_y_next_start;
|
||||
unsigned int optimized_min_dst_y_next_start_us;
|
||||
unsigned int min_dst_y_next_start_us;
|
||||
unsigned int refcyc_per_htotal;
|
||||
unsigned int refcyc_x_after_scaler;
|
||||
unsigned int dst_y_after_scaler;
|
||||
|
@ -569,6 +569,10 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib)
|
||||
mode_lib->vba.OutputLinkDPRate[mode_lib->vba.NumberOfActivePlanes] = dout->dp_rate;
|
||||
mode_lib->vba.ODMUse[mode_lib->vba.NumberOfActivePlanes] = dst->odm_combine_policy;
|
||||
mode_lib->vba.DETSizeOverride[mode_lib->vba.NumberOfActivePlanes] = src->det_size_override;
|
||||
if (src->det_size_override)
|
||||
mode_lib->vba.DETBufferSizeInKByte[mode_lib->vba.NumberOfActivePlanes] = src->det_size_override;
|
||||
else
|
||||
mode_lib->vba.DETBufferSizeInKByte[mode_lib->vba.NumberOfActivePlanes] = ip->det_buffer_size_kbytes;
|
||||
//TODO: Need to assign correct values to dp_multistream vars
|
||||
mode_lib->vba.OutputMultistreamEn[mode_lib->vba.NumberOfActiveSurfaces] = dout->dp_multistream_en;
|
||||
mode_lib->vba.OutputMultistreamId[mode_lib->vba.NumberOfActiveSurfaces] = dout->dp_multistream_id;
|
||||
@ -783,6 +787,8 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib)
|
||||
mode_lib->vba.pipe_plane[k] =
|
||||
mode_lib->vba.NumberOfActivePlanes;
|
||||
mode_lib->vba.DPPPerPlane[mode_lib->vba.NumberOfActivePlanes]++;
|
||||
if (src_k->det_size_override)
|
||||
mode_lib->vba.DETBufferSizeInKByte[mode_lib->vba.NumberOfActivePlanes] = src_k->det_size_override;
|
||||
if (mode_lib->vba.SourceScan[mode_lib->vba.NumberOfActivePlanes]
|
||||
== dm_horz) {
|
||||
mode_lib->vba.ViewportWidth[mode_lib->vba.NumberOfActivePlanes] +=
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user