sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
f57be82572
commit
58b04bcee7
468 changed files with 9958 additions and 7882 deletions
|
@ -1,11 +1,11 @@
|
|||
# $OpenBSD: Makefile,v 1.52 2023/07/02 17:21:32 beck Exp $
|
||||
# $OpenBSD: Makefile,v 1.54 2023/07/15 19:32:54 tb Exp $
|
||||
|
||||
SUBDIR += api
|
||||
SUBDIR += asn1
|
||||
SUBDIR += buffer
|
||||
SUBDIR += bytestring
|
||||
SUBDIR += ciphers
|
||||
#SUBDIR += client
|
||||
SUBDIR += client
|
||||
SUBDIR += dtls
|
||||
SUBDIR += exporter
|
||||
SUBDIR += handshake
|
||||
|
@ -13,8 +13,9 @@ SUBDIR += pqueue
|
|||
SUBDIR += quic
|
||||
SUBDIR += record
|
||||
SUBDIR += record_layer
|
||||
#SUBDIR += server
|
||||
SUBDIR += server
|
||||
SUBDIR += ssl
|
||||
SUBDIR += symbols
|
||||
SUBDIR += tls
|
||||
SUBDIR += tlsext
|
||||
SUBDIR += tlslegacy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: clienttest.c,v 1.40 2023/04/23 18:59:41 tb Exp $ */
|
||||
/* $OpenBSD: clienttest.c,v 1.42 2023/07/11 17:03:44 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
#define TLS13_RANDOM_OFFSET (TLS13_HM_OFFSET + 2)
|
||||
#define TLS13_SESSION_OFFSET (TLS13_HM_OFFSET + 34)
|
||||
#define TLS13_CIPHER_OFFSET (TLS13_HM_OFFSET + 69)
|
||||
#define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 192)
|
||||
#define TLS13_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 188)
|
||||
#define TLS13_ONLY_KEY_SHARE_OFFSET (TLS13_HM_OFFSET + 98)
|
||||
|
||||
#define TLS1_3_VERSION_ONLY (TLS1_3_VERSION | 0x10000)
|
||||
|
@ -213,7 +213,7 @@ static const uint8_t cipher_list_tls12_chacha[] = {
|
|||
};
|
||||
|
||||
static const uint8_t client_hello_tls12[] = {
|
||||
0x16, 0x03, 0x01, 0x00, 0xbb, 0x01, 0x00, 0x00,
|
||||
0x16, 0x03, 0x03, 0x00, 0xbb, 0x01, 0x00, 0x00,
|
||||
0xb7, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -270,8 +270,8 @@ static const uint8_t cipher_list_tls13_chacha[] = {
|
|||
};
|
||||
|
||||
static const uint8_t client_hello_tls13[] = {
|
||||
0x16, 0x03, 0x01, 0x01, 0x18, 0x01, 0x00, 0x01,
|
||||
0x14, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x16, 0x03, 0x03, 0x01, 0x14, 0x01, 0x00, 0x01,
|
||||
0x10, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -292,20 +292,20 @@ static const uint8_t client_hello_tls13[] = {
|
|||
0x00, 0x2f, 0x00, 0xba, 0x00, 0x41, 0xc0, 0x11,
|
||||
0xc0, 0x07, 0x00, 0x05, 0xc0, 0x12, 0xc0, 0x08,
|
||||
0x00, 0x16, 0x00, 0x0a, 0x00, 0xff, 0x01, 0x00,
|
||||
0x00, 0x6b, 0x00, 0x2b, 0x00, 0x09, 0x08, 0x03,
|
||||
0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00,
|
||||
0x33, 0x00, 0x26, 0x00, 0x24, 0x00, 0x1d, 0x00,
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x67, 0x00, 0x2b, 0x00, 0x05, 0x04, 0x03,
|
||||
0x04, 0x03, 0x03, 0x00, 0x33, 0x00, 0x26, 0x00,
|
||||
0x24, 0x00, 0x1d, 0x00, 0x20, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00,
|
||||
0x0a, 0x00, 0x0a, 0x00, 0x08, 0x00, 0x1d, 0x00,
|
||||
0x17, 0x00, 0x18, 0x00, 0x19, 0x00, 0x23, 0x00,
|
||||
0x00, 0x00, 0x0d, 0x00, 0x18, 0x00, 0x16, 0x08,
|
||||
0x06, 0x06, 0x01, 0x06, 0x03, 0x08, 0x05, 0x05,
|
||||
0x01, 0x05, 0x03, 0x08, 0x04, 0x04, 0x01, 0x04,
|
||||
0x03, 0x02, 0x01, 0x02, 0x03,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00,
|
||||
0x02, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00,
|
||||
0x08, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00,
|
||||
0x19, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00,
|
||||
0x18, 0x00, 0x16, 0x08, 0x06, 0x06, 0x01, 0x06,
|
||||
0x03, 0x08, 0x05, 0x05, 0x01, 0x05, 0x03, 0x08,
|
||||
0x04, 0x04, 0x01, 0x04, 0x03, 0x02, 0x01, 0x02,
|
||||
0x03,
|
||||
};
|
||||
|
||||
static const uint8_t cipher_list_tls13_only_aes[] = {
|
||||
|
@ -351,6 +351,7 @@ struct client_hello_test {
|
|||
const size_t key_share_start;
|
||||
const SSL_METHOD *(*ssl_method)(void);
|
||||
const long ssl_options;
|
||||
int connect_fails;
|
||||
};
|
||||
|
||||
static const struct client_hello_test client_hello_tests[] = {
|
||||
|
@ -359,6 +360,7 @@ static const struct client_hello_test client_hello_tests[] = {
|
|||
.protocol = DTLS1_VERSION,
|
||||
.random_start = DTLS_RANDOM_OFFSET,
|
||||
.ssl_method = DTLSv1_client_method,
|
||||
.connect_fails = 1,
|
||||
},
|
||||
{
|
||||
.desc = "DTLSv1.2 client method",
|
||||
|
@ -378,6 +380,7 @@ static const struct client_hello_test client_hello_tests[] = {
|
|||
.random_start = DTLS_RANDOM_OFFSET,
|
||||
.ssl_method = DTLS_client_method,
|
||||
.ssl_options = SSL_OP_NO_DTLSv1_2,
|
||||
.connect_fails = 1,
|
||||
},
|
||||
{
|
||||
.desc = "DTLS client method (no DTLSv1.0)",
|
||||
|
@ -391,12 +394,14 @@ static const struct client_hello_test client_hello_tests[] = {
|
|||
.protocol = TLS1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.ssl_method = TLSv1_client_method,
|
||||
.connect_fails = 1,
|
||||
},
|
||||
{
|
||||
.desc = "TLSv1_1 client method",
|
||||
.protocol = TLS1_1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.ssl_method = TLSv1_1_client_method,
|
||||
.connect_fails = 1,
|
||||
},
|
||||
{
|
||||
.desc = "TLSv1_2 client method",
|
||||
|
@ -422,15 +427,19 @@ static const struct client_hello_test client_hello_tests[] = {
|
|||
},
|
||||
{
|
||||
.desc = "SSLv23 (no TLSv1.2)",
|
||||
.protocol = TLS1_1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.protocol = TLS1_3_VERSION_ONLY,
|
||||
.random_start = TLS13_RANDOM_OFFSET,
|
||||
.session_start = TLS13_SESSION_OFFSET,
|
||||
.key_share_start = TLS13_ONLY_KEY_SHARE_OFFSET,
|
||||
.ssl_method = SSLv23_client_method,
|
||||
.ssl_options = SSL_OP_NO_TLSv1_2,
|
||||
},
|
||||
{
|
||||
.desc = "SSLv23 (no TLSv1.1)",
|
||||
.protocol = TLS1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.protocol = TLS1_3_VERSION,
|
||||
.random_start = TLS13_RANDOM_OFFSET,
|
||||
.session_start = TLS13_SESSION_OFFSET,
|
||||
.key_share_start = TLS13_KEY_SHARE_OFFSET,
|
||||
.ssl_method = SSLv23_client_method,
|
||||
.ssl_options = SSL_OP_NO_TLSv1_1,
|
||||
},
|
||||
|
@ -452,15 +461,19 @@ static const struct client_hello_test client_hello_tests[] = {
|
|||
},
|
||||
{
|
||||
.desc = "TLS (no TLSv1.2)",
|
||||
.protocol = TLS1_1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.protocol = TLS1_3_VERSION_ONLY,
|
||||
.random_start = TLS13_RANDOM_OFFSET,
|
||||
.session_start = TLS13_SESSION_OFFSET,
|
||||
.key_share_start = TLS13_ONLY_KEY_SHARE_OFFSET,
|
||||
.ssl_method = TLS_client_method,
|
||||
.ssl_options = SSL_OP_NO_TLSv1_2,
|
||||
},
|
||||
{
|
||||
.desc = "TLS (no TLSv1.1)",
|
||||
.protocol = TLS1_VERSION,
|
||||
.random_start = SSL3_RANDOM_OFFSET,
|
||||
.protocol = TLS1_3_VERSION,
|
||||
.random_start = TLS13_RANDOM_OFFSET,
|
||||
.session_start = TLS13_SESSION_OFFSET,
|
||||
.key_share_start = TLS13_KEY_SHARE_OFFSET,
|
||||
.ssl_method = TLS_client_method,
|
||||
.ssl_options = SSL_OP_NO_TLSv1_1,
|
||||
},
|
||||
|
@ -661,6 +674,8 @@ client_hello_test(int testno, const struct client_hello_test *cht)
|
|||
SSL_set_bio(ssl, rbio, wbio);
|
||||
|
||||
if (SSL_connect(ssl) != 0) {
|
||||
if (cht->connect_fails)
|
||||
goto done;
|
||||
fprintf(stderr, "SSL_connect() returned non-zero\n");
|
||||
goto failure;
|
||||
}
|
||||
|
@ -709,6 +724,7 @@ client_hello_test(int testno, const struct client_hello_test *cht)
|
|||
goto failure;
|
||||
}
|
||||
|
||||
done:
|
||||
ret = 0;
|
||||
|
||||
failure:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: servertest.c,v 1.7 2022/06/10 22:00:15 tb Exp $ */
|
||||
/* $OpenBSD: servertest.c,v 1.9 2023/07/11 11:52:35 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, 2017 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
|
@ -84,6 +84,7 @@ struct server_hello_test {
|
|||
const SSL_METHOD *(*ssl_method)(void);
|
||||
const long ssl_clear_options;
|
||||
const long ssl_set_options;
|
||||
int accept_fails;
|
||||
};
|
||||
|
||||
static struct server_hello_test server_hello_tests[] = {
|
||||
|
@ -94,6 +95,7 @@ static struct server_hello_test server_hello_tests[] = {
|
|||
.ssl_method = tls_legacy_method,
|
||||
.ssl_clear_options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1,
|
||||
.ssl_set_options = 0,
|
||||
.accept_fails = 1,
|
||||
},
|
||||
{
|
||||
.desc = "TLSv1.2 in SSLv2 record",
|
||||
|
@ -102,6 +104,7 @@ static struct server_hello_test server_hello_tests[] = {
|
|||
.ssl_method = tls_legacy_method,
|
||||
.ssl_clear_options = SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1,
|
||||
.ssl_set_options = 0,
|
||||
.accept_fails = 1,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -160,11 +163,14 @@ server_hello_test(int testno, struct server_hello_test *sht)
|
|||
SSL_set_bio(ssl, rbio, wbio);
|
||||
|
||||
if (SSL_accept(ssl) != 0) {
|
||||
if (sht->accept_fails)
|
||||
goto done;
|
||||
fprintf(stderr, "SSL_accept() returned non-zero\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
done:
|
||||
ret = 0;
|
||||
|
||||
failure:
|
||||
|
|
22
regress/lib/libssl/symbols/Makefile
Normal file
22
regress/lib/libssl/symbols/Makefile
Normal file
|
@ -0,0 +1,22 @@
|
|||
# $OpenBSD: Makefile,v 1.2 2023/07/15 23:40:46 tb Exp $
|
||||
|
||||
PROG = symbols
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
DPADD= ${LIBCRYPTO} ${LIBSSL}
|
||||
LDFLAGS+= -lcrypto -lssl
|
||||
LDFLAGS+= -Wl,--no-allow-shlib-undefined
|
||||
CFLAGS+= -Wno-deprecated-declarations
|
||||
|
||||
CLEANFILES+= symbols.c symbols.c.tmp
|
||||
|
||||
symbols.c: symbols.awk ../../../../lib/libssl/Symbols.list
|
||||
awk -f ${.CURDIR}/symbols.awk \
|
||||
< ${BSDSRCDIR}/lib/libssl/Symbols.list > $@.tmp && \
|
||||
mv -f $@.tmp $@
|
||||
|
||||
run-regress-symbols: symbols
|
||||
./symbols 2>/dev/null
|
||||
|
||||
.include <bsd.regress.mk>
|
65
regress/lib/libssl/symbols/symbols.awk
Normal file
65
regress/lib/libssl/symbols/symbols.awk
Normal file
|
@ -0,0 +1,65 @@
|
|||
# $OpenBSD: symbols.awk,v 1.2 2023/07/19 21:01:29 tb Exp $
|
||||
|
||||
# Copyright (c) 2018,2020,2023 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.
|
||||
|
||||
# usage: awk -f symbols.awk < Symbols.list > symbols.c
|
||||
|
||||
BEGIN {
|
||||
printf("#include <stdio.h>\n\n")
|
||||
|
||||
printf("#include <openssl/dtls1.h>\n")
|
||||
printf("#include <openssl/ssl.h>\n")
|
||||
printf("#include <openssl/ssl2.h>\n")
|
||||
printf("#include <openssl/ssl23.h>\n")
|
||||
printf("#include <openssl/ssl3.h>\n")
|
||||
printf("#include <openssl/tls1.h>\n\n")
|
||||
|
||||
printf("#include <openssl/srtp.h>\n\n") # depends on ssl.h
|
||||
}
|
||||
|
||||
/^SSL_version_str$/ {
|
||||
printf("extern const char *%s;\n", $0)
|
||||
}
|
||||
|
||||
{
|
||||
symbols[$0] = $0
|
||||
|
||||
# Undefine aliases, so we don't accidentally leave them in Symbols.list.
|
||||
printf("#ifdef %s\n#undef %s\n#endif\n", $0, $0)
|
||||
}
|
||||
|
||||
END {
|
||||
printf("\nint\nmain(void)\n{\n")
|
||||
printf("\tsize_t i;\n");
|
||||
|
||||
printf("\tstruct {\n")
|
||||
printf("\t\tconst char *const name;\n")
|
||||
printf("\t\tconst void *addr;\n")
|
||||
printf("\t} symbols[] = {\n")
|
||||
|
||||
for (symbol in symbols) {
|
||||
printf("\t\t{\n")
|
||||
printf("\t\t\t.name = \"%s\",\n", symbol)
|
||||
printf("\t\t\t.addr = &%s,\n", symbol)
|
||||
printf("\t\t},\n")
|
||||
}
|
||||
|
||||
printf("\t\};\n\n")
|
||||
|
||||
printf("\tfor (i = 0; i < sizeof(symbols) / sizeof(symbols[0]); i++)\n")
|
||||
printf("\t\tfprintf(stderr, \"%%s: %%p\\n\", symbols[i].name, symbols[i].addr);\n")
|
||||
printf("\n\tprintf(\"OK\\n\");\n")
|
||||
printf("\n\treturn 0;\n}\n")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue