diff --git a/autogen.rc b/autogen.rc index d7ffc796e4..f31d9e62cd 100755 --- a/autogen.rc +++ b/autogen.rc @@ -1,12 +1,13 @@ #!/bin/rc +flag e + rfork ne -./update.rc -ape/patch -p0 /dev/null 2>&1 -then - dirname() { basename -d "$@"; } -fi - target=$1 wdir=`dirname $2` recipe=`basename $2` diff --git a/gen-mkfiles-all.sh b/gen-mkfiles-all.sh deleted file mode 100755 index 74d59e1283..0000000000 --- a/gen-mkfiles-all.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -./gen-mkfile.sh lib crypto/Makefile.am -./gen-mkfile.sh lib ssl/Makefile.am -./gen-mkfile.sh lib tls/Makefile.am -./gen-mkfile.sh bin apps/openssl/Makefile.am -./gen-mkfile.sh include include/Makefile.am diff --git a/update.rc b/update.rc deleted file mode 100755 index 2ef4748dad..0000000000 --- a/update.rc +++ /dev/null @@ -1,317 +0,0 @@ -#!/bin/rc -flag e + -flag x + - -openbsd_branch=`{cat OPENBSD_BRANCH} - -# pull in latest upstream code -echo 'pulling upstream openbsd source' -if(! test -d openbsd){ - if(~ $LIBRESSL_GIT '') - git clone https://github.com/libressl-portable/openbsd.git - if not - git clone $LIBRESSL_GIT/openbsd -} -@{ - cd openbsd - git fetch - git checkout $openbsd_branch - git pull --rebase -} - -# setup source paths -CWD=`{pwd} -OPENBSD_SRC=$CWD/openbsd/src -libc_src=$OPENBSD_SRC/lib/libc -libc_regress=$OPENBSD_SRC/regress/lib/libc -libcrypto_src=$OPENBSD_SRC/lib/libcrypto -libcrypto_regress=$OPENBSD_SRC/regress/lib/libcrypto -libssl_src=$OPENBSD_SRC/lib/libssl -libssl_regress=$OPENBSD_SRC/regress/lib/libssl -libtls_src=$OPENBSD_SRC/lib/libtls -libtls_regress=$OPENBSD_SRC/regress/lib/libtls -bin_src=$OPENBSD_SRC/usr.bin -sbin_src=$OPENBSD_SRC/usr.sbin - -# load library versions -. $libcrypto_src/shlib_version -libcrypto_version=$major:$minor:0 -echo libcrypto version $libcrypto_version -echo $libcrypto_version >crypto/VERSION - -. $libssl_src/shlib_version -libssl_version=$major:$minor:0 -echo libssl version $libssl_version -echo $libssl_version >ssl/VERSION - -. $libtls_src/shlib_version -libtls_version=$major:$minor:0 -echo libtls version $libtls_version -echo $libtls_version >tls/VERSION -echo $major.$minor.0 >libtls-standalone/VERSION - -fn do_mv { - if(! cmp -s $1 $2) - mv $1 $2 - if not - rm -f $1 -} -MV='do_mv' - -fn do_cp_libc { - sed '/DEF_WEAK/d' <$1 >$2/`{basename $1} -} -CP_LIBC='do_cp_libc' - -CP='cp' -GREP='grep' - -$CP $libssl_src/LICENSE COPYING - -$CP $libcrypto_src/arch/amd64/opensslconf.h include/openssl -$CP $libcrypto_src/opensslfeatures.h include/openssl -$CP $libssl_src/pqueue.h include - -$CP $libtls_src/tls.h include -$CP $libtls_src/tls.h libtls-standalone/include - -for(i in crypto/compat libtls-standalone/compat){ - for(j in $libc_src/crypt/arc4random.c \ - $libc_src/crypt/arc4random_uniform.c \ - $libc_src/crypt/chacha_private.h \ - $libc_src/stdlib/reallocarray.c \ - $libc_src/stdlib/recallocarray.c \ - $libc_src/string/explicit_bzero.c \ - $libc_src/string/strcasecmp.c \ - $libc_src/string/strlcpy.c \ - $libc_src/string/strlcat.c \ - $libc_src/string/strndup.c \ - $libc_src/string/strnlen.c \ - $libc_src/string/strsep.c \ - $libc_src/string/timingsafe_bcmp.c \ - $libc_src/string/timingsafe_memcmp.c \ - $libcrypto_src/arc4random/getentropy_*.c \ - $libcrypto_src/arc4random/arc4random_*.h){ - $CP_LIBC $j $i - } -} - -$CP include/compat/stdlib.h \ - include/compat/string.h \ - include/compat/unistd.h \ - libtls-standalone/include - -$CP crypto/compat/arc4random*.h \ - crypto/compat/bsd-asprintf.c \ - libtls-standalone/compat - -# TODO -#(cd $libcrypto_src/objects/; -# perl objects.pl objects.txt obj_mac.num obj_mac.h; -# perl obj_dat.pl obj_mac.h obj_dat.h ) -#mkdir -p include/openssl crypto/objects -#$MV $libcrypto_src/objects/obj_mac.h ./include/openssl/obj_mac.h -#$MV $libcrypto_src/objects/obj_dat.h ./crypto/objects/obj_dat.h - -fn copy_hdrs { - dir=$1 - shift - for(file) - $CP $dir/$file include/openssl -} - -copy_hdrs $libcrypto_src stack/stack.h lhash/lhash.h stack/safestack.h \ - ossl_typ.h err/err.h crypto.h comp/comp.h x509/x509.h buffer/buffer.h \ - objects/objects.h asn1/asn1.h bn/bn.h ec/ec.h ecdsa/ecdsa.h \ - ecdh/ecdh.h rsa/rsa.h sha/sha.h x509/x509_vfy.h pkcs7/pkcs7.h pem/pem.h \ - pem/pem2.h hkdf/hkdf.h hmac/hmac.h rand/rand.h md5/md5.h \ - x509v3/x509v3.h conf/conf.h ocsp/ocsp.h \ - aes/aes.h modes/modes.h asn1/asn1t.h dso/dso.h bf/blowfish.h \ - bio/bio.h cast/cast.h cmac/cmac.h conf/conf_api.h des/des.h dh/dh.h \ - dsa/dsa.h engine/engine.h ui/ui.h pkcs12/pkcs12.h ts/ts.h \ - md4/md4.h ripemd/ripemd.h whrlpool/whrlpool.h idea/idea.h \ - rc2/rc2.h rc4/rc4.h ui/ui_compat.h txt_db/txt_db.h \ - sm3/sm3.h sm4/sm4.h chacha/chacha.h evp/evp.h poly1305/poly1305.h \ - camellia/camellia.h gost/gost.h curve25519/curve25519.h - -copy_hdrs $libssl_src srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h - -$CP $libcrypto_src/opensslv.h include/openssl -awk '/LIBRESSL_VERSION_TEXT/ {print $4}' include/openssl/opensslv.h | sed 's/".*//' >VERSION -echo LibreSSL version `{cat VERSION} - -# copy libcrypto source -echo copying libcrypto source -rm -f crypto/*.c crypto/*.h -for(i in `{awk '/SOURCES|HEADERS/ { print $3 }' crypto/Makefile.am}){ - dir=`{dirname $i} - mkdir -p crypto/$dir - if(! ~ $dir compat){ - if(test -e $libcrypto_src/$i) - $CP $libcrypto_src/$i crypto/$i - } -} -$CP crypto/compat/b_win.c crypto/bio -$CP crypto/compat/ui_openssl_win.c crypto/ui -# add the libcrypto symbol export list -$GREP -v OPENSSL_ia32cap_P $libcrypto_src/Symbols.list | $GREP '^[A-Za-z0-9_]' >crypto/crypto.sym - -# copy libtls source -echo copying libtls source -rm -f tls/*.c tls/*.h libtls/src/*.c libtls/src/*.h -for(i in `{awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am}){ - if(test -e $libtls_src/$i){ - $CP $libtls_src/$i tls - $CP $libtls_src/$i libtls-standalone/src - } -} -# add the libtls symbol export list -$GREP '^[A-Za-z0-9_]' <$libtls_src/Symbols.list >tls/tls.sym - -mkdir -p libtls-standalone/m4 -$CP m4/check*.m4 \ - m4/disable*.m4 \ - libtls-standalone/m4 -sed -e 's/compat\///' crypto/Makefile.am.arc4random > \ - libtls-standalone/compat/Makefile.am.arc4random - -# copy nc(1) source -echo 'copying nc(1) source' -$CP $bin_src/nc/nc.1 apps/nc -rm -f apps/nc/*.c apps/nc/*.h -$CP_LIBC $libc_src/net/base64.c apps/nc/compat -$CP_LIBC $libc_src/stdlib/strtonum.c apps/nc/compat -for(i in `{awk '/SOURCES|HEADERS|MANS/ { print $3 }' apps/nc/Makefile.am}){ - if(test -e $bin_src/nc/$i) - $CP $bin_src/nc/$i apps/nc -} - -# copy ocspcheck(1) source -echo 'copying ocspcheck(1) source' -$CP $sbin_src/ocspcheck/ocspcheck.8 apps/ocspcheck -rm -f apps/ocspcheck/*.c apps/ocspcheck/*.h -$CP_LIBC $libc_src/string/memmem.c apps/ocspcheck/compat -for(i in `{awk '/SOURCES|HEADERS|MANS/ { print $3 }' apps/ocspcheck/Makefile.am}){ - if(test -e $sbin_src/ocspcheck/$i) - $CP $sbin_src/ocspcheck/$i apps/ocspcheck -} - -# copy openssl(1) source -echo 'copying openssl(1) source' -$CP $bin_src/openssl/openssl.1 apps/openssl -$CP_LIBC $libc_src/stdlib/strtonum.c apps/openssl/compat -$CP $libcrypto_src/cert.pem apps/openssl -$CP $libcrypto_src/openssl.cnf apps/openssl -$CP $libcrypto_src/x509v3.cnf apps/openssl -for(i in `{awk '/SOURCES|HEADERS|MANS/ { print $3 }' apps/openssl/Makefile.am}){ - if(test -e $bin_src/openssl/$i) - $CP $bin_src/openssl/$i apps/openssl -} - -# copy libssl source -echo copying libssl source -rm -f ssl/*.c ssl/*.h -for(i in `{awk '/SOURCES|HEADERS/ { print $3 }' ssl/Makefile.am}) - $CP $libssl_src/$i ssl -# add the libssl symbol export list -$GREP '^[A-Za-z0-9_]' <$libssl_src/Symbols.list >ssl/ssl.sym - -# copy libcrypto tests -fn find_c { - du -a $1 | - sed 's/^[ ]*[0-9][0-9]*[ ]*//' | - $GREP '\.c$' -} -echo copying tests -for(i in `{find_c $libcrypto_regress}) - $CP $i tests -$CP $libcrypto_regress/evp/evptests.txt tests -$CP $libcrypto_regress/aead/aeadtests.txt tests - -# copy libc tests -$CP $libc_regress/arc4random-fork/arc4random-fork.c tests/arc4randomforktest.c -$CP $libc_regress/explicit_bzero/explicit_bzero.c tests -$CP_LIBC $libc_src/string/memmem.c tests/compat -$CP $libc_regress/timingsafe/timingsafe.c tests - -# copy libssl tests -$CP $libssl_regress/ssl/testssl tests -for(i in `{find_c $libssl_regress}) - $CP $i tests -$CP $libssl_regress/unit/tests.h tests -$CP $libssl_regress/certs/ca.pem tests -$CP $libssl_regress/certs/server.pem tests -$CP $libssl_regress/pqueue/expected.txt tests/pq_expected.txt - -# copy libtls tests -for(i in `{find_c $libtls_regress}) - $CP $i tests - -chmod 755 tests/testssl - -# add headers -@{ - cd include/openssl - $CP Makefile.am.tpl Makefile.am - for(i in `{ls *.h | sort}) - echo 'opensslinclude_HEADERS += '^$i >>Makefile.am -} - -fn add_man_links { - filter=$1 - dest=$2 - echo install-data-hook: >>$dest - for(i in `{$GREP $filter man/links}){ - ifs=, {v=`{echo -n $i}} - if(! ~ $v(2) '') - echo ' ln -sf "'^$v(1)^'" "$(DESTDIR)$(mandir)/man3/$2"' >>$dest - } - echo '' >>$dest - echo 'uninstall-local:' >>$dest - for(i in `{$GREP $filter man/links}){ - ifs=, {v=`{echo -n $i}} - if(! ~ $v(2) '') - echo ' -rm -f "$(DESTDIR)$(mandir)/man3/$2"' >>$dest - } -} - -# apply local patches -#PATCH=ape/patch -PATCH=patch -# Prefer gnu patch on AIX systems, if available -for(i in patches/*.patch) - $PATCH -p0 <$i - -# copy manpages -echo copying manpages -echo 'EXTRA_DIST = CMakeLists.txt' >man/Makefile.am -echo 'dist_man3_MANS =' >>man/Makefile.am -echo 'dist_man5_MANS =' >>man/Makefile.am - -@{ - cd man - for(i in `{ls $libssl_src/man/*.3 | sort}){ - NAME=`{basename $i} - $CP $i . - echo 'dist_man3_MANS += '^$NAME >>Makefile.am - } - - for(i in `{ls $libcrypto_src/man/*.3 | sort}){ - NAME=`{basename $i} - $CP $i . - echo 'dist_man3_MANS += '^$NAME >>Makefile.am - } - - for(i in `{ls $libtls_src/man/*.3 | sort}){ - NAME=`{basename $i} - $CP $i . - echo 'dist_man3_MANS += '^$NAME >>Makefile.am - } - - for(i in `{ls $libcrypto_src/man/*.5 | sort}){ - NAME=`{basename $i} - $CP $i . - echo 'dist_man5_MANS += '^$NAME >>Makefile.am - } -} -add_man_links . man/Makefile.am diff --git a/update.sh b/update.sh index 2e1f5c75a8..b9c5eda59d 100755 --- a/update.sh +++ b/update.sh @@ -64,10 +64,23 @@ do_cp_libc() { CP_LIBC='do_cp_libc' CP='cp -p' +LS='ls -1' GREP='grep' if [ -x /opt/csw/bin/ggrep ]; then GREP='/opt/csw/bin/ggrep' fi +find_c_src() { + find $1 -name '*.c' +} +if [ `uname` = Plan9 ]; then + CP='cp' + LS='ls' + find_c_src() { + du -a $1 | + sed 's/^[ ]*[0-9][0-9]*[ ]*//' | + $GREP '\.c$' + } +fi $CP $libssl_src/LICENSE COPYING @@ -138,7 +151,7 @@ copy_hdrs $libcrypto_src "stack/stack.h lhash/lhash.h stack/safestack.h copy_hdrs $libssl_src "srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h" $CP $libcrypto_src/opensslv.h include/openssl -awk '/LIBRESSL_VERSION_TEXT/ {print $4}' < include/openssl/opensslv.h | cut -d\" -f1 > VERSION +awk '/LIBRESSL_VERSION_TEXT/ {print $4}' < include/openssl/opensslv.h | awk -F\" '{ print $1 }' > VERSION echo "LibreSSL version `cat VERSION`" # copy libcrypto source @@ -178,6 +191,11 @@ gen_asm() { EOF $MV $3.tmp $3 } +if [ `uname` = Plan9 ]; then + # Plan 9 don't assemble .S files; always compile C sources. + gen_asm(){ } + gen_asm_stdout(){ } +fi echo generating arm ASM source for elf gen_asm_stdout elf aes/asm/aes-armv4.pl crypto/aes/aes-elf-armv4.S @@ -280,7 +298,7 @@ $GREP '^[A-Za-z0-9_]' < $libssl_src/Symbols.list > ssl/ssl.sym # copy libcrypto tests echo "copying tests" -for i in `find $libcrypto_regress -name '*.c'`; do +for i in `find_c_src $libcrypto_regress`; do $CP "$i" tests done $CP $libcrypto_regress/evp/evptests.txt tests @@ -301,7 +319,7 @@ $CP $libc_regress/timingsafe/timingsafe.c tests # copy libssl tests $CP $libssl_regress/ssl/testssl tests -for i in `find $libssl_regress -name '*.c'`; do +for i in `find_c_src $libssl_regress`; do $CP "$i" tests done $CP $libssl_regress/unit/tests.h tests @@ -310,7 +328,7 @@ $CP $libssl_regress/certs/server.pem tests $CP $libssl_regress/pqueue/expected.txt tests/pq_expected.txt # copy libtls tests -for i in `find $libtls_regress -name '*.c'`; do +for i in `find_c_src $libtls_regress`; do $CP "$i" tests done @@ -319,7 +337,7 @@ chmod 755 tests/testssl # add headers (cd include/openssl $CP Makefile.am.tpl Makefile.am - for i in `ls -1 *.h|sort`; do + for i in `$LS *.h|sort`; do echo "opensslinclude_HEADERS += $i" >> Makefile.am done ) @@ -353,6 +371,11 @@ fi for i in patches/*.patch; do $PATCH -p0 < $i done +if [ `uname` = Plan9 ]; then + for i in plan9/*.patch; do + $PATCH -p0 < $i + done +fi # copy manpages echo "copying manpages" @@ -361,25 +384,25 @@ echo dist_man3_MANS = >> man/Makefile.am echo dist_man5_MANS = >> man/Makefile.am (cd man - for i in `ls -1 $libssl_src/man/*.3 | sort`; do + for i in `$LS $libssl_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `ls -1 $libcrypto_src/man/*.3 | sort`; do + for i in `$LS $libcrypto_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `ls -1 $libtls_src/man/*.3 | sort`; do + for i in `$LS $libtls_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `ls -1 $libcrypto_src/man/*.5 | sort`; do + for i in `$LS $libcrypto_src/man/*.5 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man5_MANS += $NAME" >> Makefile.am