more checkpointing

This commit is contained in:
christos 2023-05-07 16:22:10 +00:00
parent 325dc460fc
commit f4748aaa01
20 changed files with 437 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.5 2018/09/23 15:08:41 christos Exp $
# $NetBSD: Makefile,v 1.6 2023/05/07 16:22:10 christos Exp $
.include "bsd.own.mk"
# OpenSSL libraries.
SUBDIR= libcrypto libcryptotest libdes
SUBDIR= libapps liblegacy libcrypto libcryptotest libdes
SUBDIR+= .WAIT libssl # depends on libcrypto

View File

@ -0,0 +1,66 @@
# $NetBSD: Makefile,v 1.1 2023/05/07 16:22:10 christos Exp $
# RCSid:
# Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@quick.com.au
#
LIBISPRIVATE= yes
LIB= apps
USE_FORT?= yes # cryptographic software
USE_SHLIBDIR= no
USE_FIPS= no
#DBG=-g
.include <bsd.own.mk>
.include <bsd.shlib.mk>
# XXX: There's a bit of work to do before we can enable warnings.
WARNS=0
CWARNFLAGS.clang+= -Wno-empty-body -Wno-unused-value -Wno-parentheses -Wno-implicit-int-float-conversion
# XXX: This warning seems to trigger incorrectly
CWARNFLAGS.clang+= -Wno-atomic-alignment
LINTFLAGS+= -X 161 # constant in conditional context
LINTFLAGS+= -X 129 # expression has null effect
LINTFLAGS+= -X 117 # bitwise '>>' on signed value possibly nonportable
LINTFLAGS+= -X 231 # argument '%s' unused in function '%s'
LINTFLAGS+= -X 220 # fallthrough on case statement
LINTFLAGS+= -X 118 # semantics of '%s' change in ANSI C; use explicit cast
CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC} -I${.CURDIR}
CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes
CPPFLAGS+= -I${OPENSSLSRC}/../include
CPPFLAGS+= -I${OPENSSLSRC}/apps/lib
CPPFLAGS+= -I${OPENSSLSRC}/apps/include
CRYPTODIST= ${NETBSDSRCDIR}/crypto
OPENSSLINC= ${OPENSSLSRC}/include/openssl
.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
.PATH: ${OPENSSLSRC} ${OPENSSLINC}
.PATH: ${OPENSSLSRC}/../include/openssl
.PATH: ${OPENSSLSRC}/providers/implementations/digests
.PATH: ${OPENSSLSRC}/providers/implementations/macs
.include "srcs.inc"
AFLAGS+=-DELF
OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
.include <bsd.lib.mk>

View File

@ -0,0 +1,12 @@
# $NetBSD: PROTO.in,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/@proto@
@PROTO@_SRCS += \
@SRCS@
SRCS += ${@PROTO@_SRCS}
.for appssrc in ${@PROTO@_SRCS}
CPPFLAGS.${appssrc} += -I${OPENSSLSRC}/@proto@ ${@PROTO@CPPFLAGS}
.endfor

View File

@ -0,0 +1,29 @@
# $NetBSD: apps_lib.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/apps/lib
APPS_LIB_SRCS += \
app_libctx.c \
app_params.c \
app_provider.c \
app_rand.c \
app_x509.c \
apps.c \
apps_ui.c \
columns.c \
cmp_mock_srv.c \
engine.c \
engine_loader.c \
fmt.c \
http_server.c \
names.c \
opt.c \
s_cb.c \
s_socket.c \
tlssrp_depr.c \
SRCS += ${APPS_LIB_SRCS}
.for commonsrc in ${APPS_LIB_SRCS}
CPPFLAGS.${commonsrc} += -I${OPENSSLSRC}/apps/lib ${APPS_LIBCPPFLAGS}
.endfor

29
crypto/external/bsd/openssl/lib/libapps/mkinc vendored Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
BUILD=../../openssl-3.0.8
create() {
sed -e "s,@proto@,$proto,g" -e "s/@PROTO@/$PROTO/g" -e "/@SRCS@/ {
r $fn.out
d
}" PROTO.in > $fn.inc
rm -f $fn.out
}
d=
for i in $(find ${BUILD} -name 'libapps-lib-*.d'); do
nd=$(dirname "$i" | sed -e s,${BUILD}/,,)
if [ "$nd" != "$d" ]; then
if [ -n "$d" ]; then
create
fi
fn=$(echo $nd | tr '/' '_')
proto=$nd
PROTO=$(echo $fn | tr '[a-z]' '[A-Z]')
d=$nd
rm -f $fn.out
fi
echo $(basename $i) | \
sed -e 's/.*-lib-//' -e 's/\.d/.c \\/' >> $fn.out
done
create

View File

@ -0,0 +1,12 @@
# $NetBSD: srcs.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
APPSINCS= \
apps_lib.inc \
.for appsinc in ${APPSINCS}
.if exists(${.CURDIR}/arch/${APPS_MACHINE_CPU}/${appsinc})
.include "${.CURDIR}/arch/${APPS_MACHINE_CPU}/${appsinc}"
.else
.include "${appsinc}"
.endif
.endfor

View File

@ -20,6 +20,21 @@
#include <openssl/evp.h>
#include "crypto/sha.h"
unsigned char *ossl_sha1(const unsigned char *d, size_t n, unsigned char *md)
{
SHA_CTX c;
static unsigned char m[SHA_DIGEST_LENGTH];
if (md == NULL)
md = m;
if (!SHA1_Init(&c))
return NULL;
SHA1_Update(&c, d, n);
SHA1_Final(md, &c);
OPENSSL_cleanse(&c, sizeof(c));
return md;
}
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
{
static unsigned char m[SHA_DIGEST_LENGTH];

View File

@ -0,0 +1,86 @@
# $NetBSD: Makefile,v 1.1 2023/05/07 16:22:10 christos Exp $
# RCSid:
# Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
#
# @(#) Copyright (c) 1994 Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
# Permission to copy, redistribute or otherwise
# use this file is hereby granted provided that
# the above copyright notice and this notice are
# left intact.
#
# Please send copies of changes and bug-fixes to:
# sjg@quick.com.au
#
NOLINT= # don't build a lint library
NOPROFILE= # don't build a profile library
NOPICINSTALL= # don't install _pic.a library
LIB= legacy
USE_FORT?= yes # cryptographic software
#DBG=-g
.include <bsd.own.mk>
.include <bsd.shlib.mk>
# XXX: There's a bit of work to do before we can enable warnings.
WARNS=0
CWARNFLAGS.clang+= -Wno-empty-body -Wno-unused-value -Wno-parentheses -Wno-implicit-int-float-conversion
# XXX: This warning seems to trigger incorrectly
CWARNFLAGS.clang+= -Wno-atomic-alignment
LINTFLAGS+= -X 161 # constant in conditional context
LINTFLAGS+= -X 129 # expression has null effect
LINTFLAGS+= -X 117 # bitwise '>>' on signed value possibly nonportable
LINTFLAGS+= -X 231 # argument '%s' unused in function '%s'
LINTFLAGS+= -X 220 # fallthrough on case statement
LINTFLAGS+= -X 118 # semantics of '%s' change in ANSI C; use explicit cast
CPPFLAGS+= -Dlib${LIB} -I. -I${OPENSSLSRC}/crypto -I${OPENSSLSRC} -I${.CURDIR}
CPPFLAGS+= -I${OPENSSLSRC}/include -I${OPENSSLSRC}/crypto/include
CPPFLAGS+= -I${OPENSSLSRC}/crypto/asn1 -I${OPENSSLSRC}/crypto/evp
CPPFLAGS+= -I${OPENSSLSRC}/crypto/modes
CPPFLAGS+= -I${OPENSSLSRC}/../include
CPPFLAGS+= -I${OPENSSLSRC}/providers/common/include
CPPFLAGS+= -I${OPENSSLSRC}/providers/implementations/include
CPPFLAGS+= -I${.CURDIR}/../libdefault
CRYPTODIST= ${NETBSDSRCDIR}/crypto
OPENSSLINC= ${OPENSSLSRC}/include/openssl
.include "${NETBSDSRCDIR}/crypto/Makefile.openssl"
.PATH: ${OPENSSLSRC} ${OPENSSLINC}
.PATH: ${OPENSSLSRC}/../include/openssl
.PATH: ${OPENSSLSRC}/providers/implementations/digests
.PATH: ${OPENSSLSRC}/providers/implementations/macs
.include "srcs.inc"
AFLAGS+=-DELF
OS_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
SHLIB_MAJOR=0
SHLIB_MINOR=0
LIBDIR=${OSSL_MODULESDIR}
.if ${MKPIC} != "no"
.PRECIOUS: ${DESTDIR}${LIBDIR}/${LIB}.so
libinstall:: ${DESTDIR}${LIBDIR}/${LIB}.so
.else
libinstall::
.endif
LDFLAGS+=-Wl,--version-script=${.CURDIR}/${LIB}.map
.include <bsd.lib.mk>
${DESTDIR}${LIBDIR}/${LIB}.so: lib${LIB}.so.${SHLIB_FULLVERSION}
${_MKTARGET_INSTALL}
${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${.ALLSRC} ${.TARGET}

View File

@ -0,0 +1,12 @@
# $NetBSD: PROTO.in,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/@proto@
@PROTO@_SRCS += \
@SRCS@
SRCS += ${@PROTO@_SRCS}
.for legacysrc in ${@PROTO@_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/@proto@ ${@PROTO@CPPFLAGS}
.endfor

View File

@ -0,0 +1,13 @@
# $NetBSD: crypto.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/crypto
CRYPTO_SRCS += \
cpuid.c \
ctype.c \
SRCS += ${CRYPTO_SRCS}
.for legacysrc in ${CRYPTO_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/crypto ${CRYPTOCPPFLAGS}
.endfor

View File

@ -0,0 +1,13 @@
# $NetBSD: crypto_des.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/crypto/des
CRYPTO_DES_SRCS += \
des_enc.c \
fcrypt_b.c \
SRCS += ${CRYPTO_DES_SRCS}
.for legacysrc in ${CRYPTO_DES_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/crypto/des ${CRYPTO_DESCPPFLAGS}
.endfor

View File

@ -0,0 +1,14 @@
# $NetBSD: crypto_md5.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/crypto/md5
CRYPTO_MD5_SRCS += \
md5_dgst.c \
md5_one.c \
md5_sha1.c \
SRCS += ${CRYPTO_MD5_SRCS}
.for legacysrc in ${CRYPTO_MD5_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/crypto/md5 ${CRYPTO_MD5CPPFLAGS}
.endfor

View File

@ -0,0 +1,5 @@
{
global:
OSSL_provider_init;
local: *;
};

View File

@ -0,0 +1,29 @@
#!/bin/sh
BUILD=../../openssl-3.0.8
create() {
sed -e "s,@proto@,$proto,g" -e "s/@PROTO@/$PROTO/g" -e "/@SRCS@/ {
r $fn.out
d
}" PROTO.in > $fn.inc
rm -f $fn.out
}
d=
for i in $(find ${BUILD} -name 'liblegacy-lib-*.d'); do
nd=$(dirname "$i" | sed -e s,${BUILD}/,,)
if [ "$nd" != "$d" ]; then
if [ -n "$d" ]; then
create
fi
fn=$(echo $nd | tr '/' '_')
proto=$nd
PROTO=$(echo $fn | tr '[a-z]' '[A-Z]')
d=$nd
rm -f $fn.out
fi
echo $(basename $i) | \
sed -e 's/.*-lib-//' -e 's/\.d/.c \\/' >> $fn.out
done
create

View File

@ -0,0 +1,12 @@
# $NetBSD: providers.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/providers
PROVIDERS_SRCS += \
prov_running.c \
SRCS += ${PROVIDERS_SRCS}
.for legacysrc in ${PROVIDERS_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/providers ${PROVIDERSCPPFLAGS}
.endfor

View File

@ -0,0 +1,12 @@
# $NetBSD: providers_common.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/providers/common
PROVIDERS_COMMON_SRCS += \
provider_util.c \
SRCS += ${PROVIDERS_COMMON_SRCS}
.for legacysrc in ${PROVIDERS_COMMON_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/providers/common ${PROVIDERS_COMMONCPPFLAGS}
.endfor

View File

@ -0,0 +1,30 @@
# $NetBSD: providers_implementations_ciphers.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/providers/implementations/ciphers
PROVIDERS_IMPLEMENTATIONS_CIPHERS_SRCS += \
cipher_blowfish.c \
cipher_blowfish_hw.c \
cipher_cast5.c \
cipher_cast5_hw.c \
cipher_des.c \
cipher_des_hw.c \
cipher_desx.c \
cipher_desx_hw.c \
cipher_idea.c \
cipher_idea_hw.c \
cipher_rc2.c \
cipher_rc2_hw.c \
cipher_rc4.c \
cipher_rc4_hmac_md5.c \
cipher_rc4_hmac_md5_hw.c \
cipher_rc4_hw.c \
cipher_seed.c \
cipher_seed_hw.c \
cipher_tdes_common.c \
SRCS += ${PROVIDERS_IMPLEMENTATIONS_CIPHERS_SRCS}
.for legacysrc in ${PROVIDERS_IMPLEMENTATIONS_CIPHERS_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/providers/implementations/ciphers ${PROVIDERS_IMPLEMENTATIONS_CIPHERSCPPFLAGS}
.endfor

View File

@ -0,0 +1,15 @@
# $NetBSD: providers_implementations_digests.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/providers/implementations/digests
PROVIDERS_IMPLEMENTATIONS_DIGESTS_SRCS += \
md4_prov.c \
mdc2_prov.c \
ripemd_prov.c \
wp_prov.c \
SRCS += ${PROVIDERS_IMPLEMENTATIONS_DIGESTS_SRCS}
.for legacysrc in ${PROVIDERS_IMPLEMENTATIONS_DIGESTS_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/providers/implementations/digests ${PROVIDERS_IMPLEMENTATIONS_DIGESTSCPPFLAGS}
.endfor

View File

@ -0,0 +1,12 @@
# $NetBSD: providers_implementations_kdfs.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
.PATH: ${OPENSSLSRC}/providers/implementations/kdfs
PROVIDERS_IMPLEMENTATIONS_KDFS_SRCS += \
pbkdf1.c \
SRCS += ${PROVIDERS_IMPLEMENTATIONS_KDFS_SRCS}
.for legacysrc in ${PROVIDERS_IMPLEMENTATIONS_KDFS_SRCS}
CPPFLAGS.${legacysrc} += -I${OPENSSLSRC}/providers/implementations/kdfs ${PROVIDERS_IMPLEMENTATIONS_KDFSCPPFLAGS}
.endfor

View File

@ -0,0 +1,19 @@
# $NetBSD: srcs.inc,v 1.1 2023/05/07 16:22:10 christos Exp $
LEGACYINCS= \
crypto.inc \
crypto_des.inc \
crypto_md5.inc \
providers.inc \
providers_common.inc \
providers_implementations_ciphers.inc \
providers_implementations_digests.inc \
providers_implementations_kdfs.inc \
.for legacyinc in ${LEGACYINCS}
.if exists(${.CURDIR}/arch/${LEGACY_MACHINE_CPU}/${legacyinc})
.include "${.CURDIR}/arch/${LEGACY_MACHINE_CPU}/${legacyinc}"
.else
.include "${legacyinc}"
.endif
.endfor