sync code with last improvements from OpenBSD
This commit is contained in:
parent
d8235ebda5
commit
0726fd4247
@ -1 +1 @@
|
||||
# SecBSD 1.4-58d3272: Tue Sep 19 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
# SecBSD 1.4-d8235ebda5: Tue Sep 19 00:00:00 UTC 2023 (Tezcatlipoca)
|
||||
|
@ -201,7 +201,7 @@ $inout6="%xmm8"; $inout7="%xmm9";
|
||||
|
||||
$in2="%xmm6"; $in1="%xmm7"; # used in CBC decrypt, CTR, ...
|
||||
$in0="%xmm8"; $iv="%xmm9";
|
||||
|
||||
|
||||
# Inline version of internal aesni_[en|de]crypt1.
|
||||
#
|
||||
# Why folded loop? Because aes[enc|dec] is slow enough to accommodate
|
||||
@ -267,7 +267,7 @@ $code.=<<___;
|
||||
.size ${PREFIX}_decrypt, .-${PREFIX}_decrypt
|
||||
___
|
||||
}
|
||||
|
||||
|
||||
# _aesni_[en|de]cryptN are private interfaces, N denotes interleave
|
||||
# factor. Why 3x subroutine were originally used in loops? Even though
|
||||
# aes[enc|dec] latency was originally 6, it could be scheduled only
|
||||
@ -520,7 +520,7 @@ ___
|
||||
&aesni_generate6("dec");
|
||||
&aesni_generate8("enc") if ($PREFIX eq "aesni");
|
||||
&aesni_generate8("dec");
|
||||
|
||||
|
||||
if ($PREFIX eq "aesni") {
|
||||
########################################################################
|
||||
# void aesni_ecb_encrypt (const void *in, void *out,
|
||||
@ -674,7 +674,8 @@ $code.=<<___;
|
||||
movups $inout4,0x40($out)
|
||||
movups $inout5,0x50($out)
|
||||
jmp .Lecb_ret
|
||||
#--------------------------- ECB DECRYPT ------------------------------#
|
||||
|
||||
#--------------------------- ECB DECRYPT ------------------------------#
|
||||
.align 16
|
||||
.Lecb_decrypt:
|
||||
cmp \$0x80,$len
|
||||
@ -815,7 +816,7 @@ $code.=<<___;
|
||||
ret
|
||||
.size aesni_ecb_encrypt,.-aesni_ecb_encrypt
|
||||
___
|
||||
|
||||
|
||||
{
|
||||
######################################################################
|
||||
# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out,
|
||||
@ -1005,7 +1006,8 @@ $code.=<<___;
|
||||
ret
|
||||
.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
|
||||
___
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# void aesni_ctr32_encrypt_blocks (const void *in, void *out,
|
||||
# size_t blocks, const AES_KEY *key,
|
||||
@ -1025,6 +1027,7 @@ $code.=<<___;
|
||||
.type aesni_ctr32_encrypt_blocks,\@function,5
|
||||
.align 16
|
||||
aesni_ctr32_encrypt_blocks:
|
||||
endbr64
|
||||
lea (%rsp),%rax
|
||||
push %rbp
|
||||
sub \$$frame_size,%rsp
|
||||
@ -1299,7 +1302,7 @@ $code.=<<___;
|
||||
.size aesni_ctr32_encrypt_blocks,.-aesni_ctr32_encrypt_blocks
|
||||
___
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len,
|
||||
# const AES_KEY *key1, const AES_KEY *key2
|
||||
@ -2135,7 +2138,7 @@ $code.=<<___;
|
||||
.size aesni_xts_decrypt,.-aesni_xts_decrypt
|
||||
___
|
||||
} }}
|
||||
|
||||
|
||||
########################################################################
|
||||
# void $PREFIX_cbc_encrypt (const void *inp, void *out,
|
||||
# size_t length, const AES_KEY *key,
|
||||
@ -2194,7 +2197,8 @@ $code.=<<___;
|
||||
mov $key_,$key # restore $key
|
||||
xor $len,$len # len=16
|
||||
jmp .Lcbc_enc_loop # one more spin
|
||||
#--------------------------- CBC DECRYPT ------------------------------#
|
||||
|
||||
#--------------------------- CBC DECRYPT ------------------------------#
|
||||
.align 16
|
||||
.Lcbc_decrypt:
|
||||
lea (%rsp),%rax
|
||||
@ -2475,7 +2479,8 @@ $code.=<<___;
|
||||
ret
|
||||
.size ${PREFIX}_cbc_encrypt,.-${PREFIX}_cbc_encrypt
|
||||
___
|
||||
}
|
||||
}
|
||||
|
||||
# int $PREFIX_set_[en|de]crypt_key (const unsigned char *userKey,
|
||||
# int bits, AES_KEY *key)
|
||||
{ my ($inp,$bits,$key) = @_4args;
|
||||
@ -2522,7 +2527,7 @@ ${PREFIX}_set_decrypt_key:
|
||||
.LSEH_end_set_decrypt_key:
|
||||
.size ${PREFIX}_set_decrypt_key,.-${PREFIX}_set_decrypt_key
|
||||
___
|
||||
|
||||
|
||||
# This is based on submission by
|
||||
#
|
||||
# Huang Ying <ying.huang@intel.com>
|
||||
@ -2655,7 +2660,7 @@ __aesni_set_encrypt_key:
|
||||
add \$8,%rsp
|
||||
ret
|
||||
.LSEH_end_set_encrypt_key:
|
||||
|
||||
|
||||
.align 16
|
||||
.Lkey_expansion_128:
|
||||
$movkey %xmm0,(%rax)
|
||||
@ -2728,7 +2733,7 @@ __aesni_set_encrypt_key:
|
||||
.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
|
||||
___
|
||||
}
|
||||
|
||||
|
||||
$code.=<<___;
|
||||
.section .rodata
|
||||
.align 64
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ssl_lib.c,v 1.312 2023/07/19 13:34:33 tb Exp $ */
|
||||
/* $OpenBSD: ssl_lib.c,v 1.314 2023/09/19 01:22:31 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -292,7 +292,7 @@ SSL_new(SSL_CTX *ctx)
|
||||
|
||||
CRYPTO_add(&ctx->references, 1, CRYPTO_LOCK_SSL_CTX);
|
||||
s->ctx = ctx;
|
||||
s->tlsext_debug_cb = 0;
|
||||
s->tlsext_debug_cb = NULL;
|
||||
s->tlsext_debug_arg = NULL;
|
||||
s->tlsext_ticket_expected = 0;
|
||||
s->tlsext_status_type = -1;
|
||||
@ -2093,10 +2093,10 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
||||
/* We take the system default */
|
||||
ret->session_timeout = ssl_get_default_timeout();
|
||||
|
||||
ret->new_session_cb = 0;
|
||||
ret->remove_session_cb = 0;
|
||||
ret->get_session_cb = 0;
|
||||
ret->generate_session_id = 0;
|
||||
ret->new_session_cb = NULL;
|
||||
ret->remove_session_cb = NULL;
|
||||
ret->get_session_cb = NULL;
|
||||
ret->generate_session_id = NULL;
|
||||
|
||||
memset((char *)&ret->stats, 0, sizeof(ret->stats));
|
||||
|
||||
@ -2105,12 +2105,12 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
||||
|
||||
ret->info_callback = NULL;
|
||||
|
||||
ret->app_verify_callback = 0;
|
||||
ret->app_verify_callback = NULL;
|
||||
ret->app_verify_arg = NULL;
|
||||
|
||||
ret->max_cert_list = SSL_MAX_CERT_LIST_DEFAULT;
|
||||
ret->read_ahead = 0;
|
||||
ret->msg_callback = 0;
|
||||
ret->msg_callback = NULL;
|
||||
ret->msg_callback_arg = NULL;
|
||||
ret->verify_mode = SSL_VERIFY_NONE;
|
||||
ret->sid_ctx_length = 0;
|
||||
@ -2119,11 +2119,11 @@ SSL_CTX_new(const SSL_METHOD *meth)
|
||||
if ((ret->cert = ssl_cert_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
ret->default_passwd_callback = 0;
|
||||
ret->default_passwd_callback = NULL;
|
||||
ret->default_passwd_callback_userdata = NULL;
|
||||
ret->client_cert_cb = 0;
|
||||
ret->app_gen_cookie_cb = 0;
|
||||
ret->app_verify_cookie_cb = 0;
|
||||
ret->client_cert_cb = NULL;
|
||||
ret->app_gen_cookie_cb = NULL;
|
||||
ret->app_verify_cookie_cb = NULL;
|
||||
|
||||
ret->sessions = lh_SSL_SESSION_new();
|
||||
if (ret->sessions == NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh -
|
||||
# $OpenBSD: sedtest.sh,v 1.8 2018/12/07 15:30:31 schwarze Exp $
|
||||
# $OpenBSD: sedtest.sh,v 1.9 2023/09/18 18:33:17 anton Exp $
|
||||
#
|
||||
# Copyright (c) 1992 Diomidis Spinellis.
|
||||
# Copyright (c) 1992, 1993
|
||||
@ -359,8 +359,7 @@ p
|
||||
test_print()
|
||||
{
|
||||
echo Testing print and file routines
|
||||
awk 'END {for (i = 1; i < 256; i++) printf("%c", i);print "\n"}' \
|
||||
</dev/null >lines3
|
||||
{ jot -c -s '' 255 1; printf '\n'; } >lines3
|
||||
# GNU and SunOS sed behave differently here
|
||||
mark '7.1'
|
||||
$SED -n l lines3
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: awk.h,v 1.29 2023/09/17 14:49:44 millert Exp $ */
|
||||
/* $OpenBSD: awk.h,v 1.30 2023/09/18 19:32:19 millert Exp $ */
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
@ -66,6 +66,8 @@ extern bool do_posix; /* true if POSIXLY_CORRECT set */
|
||||
#define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */
|
||||
extern int recsize; /* size of current record, orig RECSIZE */
|
||||
|
||||
extern size_t awk_mb_cur_max; /* max size of a multi-byte character */
|
||||
|
||||
extern char EMPTY[]; /* this avoid -Wwritable-strings issues */
|
||||
extern char **FS;
|
||||
extern char **RS;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: b.c,v 1.38 2023/09/17 14:49:44 millert Exp $ */
|
||||
/* $OpenBSD: b.c,v 1.41 2023/09/19 01:14:05 millert Exp $ */
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
@ -533,7 +533,7 @@ int first(Node *p) /* collects initially active leaves of p into setvec */
|
||||
setvec[lp] = 1;
|
||||
setcnt++;
|
||||
}
|
||||
if (type(p) == CCL && (*(char *) right(p)) == '\0')
|
||||
if (type(p) == CCL && (*(int *) right(p)) == 0)
|
||||
return(0); /* empty CCL */
|
||||
return(1);
|
||||
case PLUS:
|
||||
@ -834,7 +834,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum)
|
||||
buf[k++] = (c = getc(f)) != EOF ? c : 0;
|
||||
}
|
||||
c = (uschar)buf[j];
|
||||
if (c < 128)
|
||||
if (c < 128 || awk_mb_cur_max == 1)
|
||||
rune = c;
|
||||
else {
|
||||
j--;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.60 2023/09/18 15:20:48 jmc Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.61 2023/09/18 19:32:19 millert Exp $ */
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
@ -56,6 +56,8 @@ bool CSV = false; /* true for csv input */
|
||||
bool safe = false; /* true => "safe" mode */
|
||||
bool do_posix = false; /* true => POSIX mode */
|
||||
|
||||
size_t awk_mb_cur_max = 1;
|
||||
|
||||
static noreturn void fpecatch(int n
|
||||
#ifdef SA_SIGINFO
|
||||
, siginfo_t *si, void *uc
|
||||
@ -135,6 +137,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */
|
||||
awk_mb_cur_max = MB_CUR_MAX;
|
||||
|
||||
cmdname = __progname;
|
||||
if (pledge("stdio rpath wpath cpath proc exec", NULL) == -1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: run.c,v 1.76 2023/09/18 15:16:22 deraadt Exp $ */
|
||||
/* $OpenBSD: run.c,v 1.77 2023/09/18 19:32:19 millert Exp $ */
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
@ -606,7 +606,7 @@ int u8_isutf(const char *s)
|
||||
unsigned char c;
|
||||
|
||||
c = s[0];
|
||||
if (c < 128)
|
||||
if (c < 128 || awk_mb_cur_max == 1)
|
||||
return 1; /* what if it's 0? */
|
||||
|
||||
n = strlen(s);
|
||||
@ -633,7 +633,7 @@ int u8_rune(int *rune, const char *s)
|
||||
unsigned char c;
|
||||
|
||||
c = s[0];
|
||||
if (c < 128) {
|
||||
if (c < 128 || awk_mb_cur_max == 1) {
|
||||
*rune = c;
|
||||
return 1;
|
||||
}
|
||||
@ -680,7 +680,7 @@ int u8_strlen(const char *s)
|
||||
totlen = 0;
|
||||
for (i = 0; i < n; i += len) {
|
||||
c = s[i];
|
||||
if (c < 128) {
|
||||
if (c < 128 || awk_mb_cur_max == 1) {
|
||||
len = 1;
|
||||
} else {
|
||||
len = u8_nextlen(&s[i]);
|
||||
@ -1290,7 +1290,7 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
|
||||
int charval = (int) getfval(x);
|
||||
|
||||
if (charval != 0) {
|
||||
if (charval < 128)
|
||||
if (charval < 128 || awk_mb_cur_max == 1)
|
||||
snprintf(p, BUFSZ(p), fmt, charval);
|
||||
else {
|
||||
// possible unicode character
|
||||
|
Loading…
Reference in New Issue
Block a user