sync code with last fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-07-20 23:56:46 +00:00
parent f57be82572
commit 58b04bcee7
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
468 changed files with 9958 additions and 7882 deletions

View 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>

View 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")
}