diff --git a/.gitignore b/.gitignore index 0885dbeca0..04cfc1e66f 100644 --- a/.gitignore +++ b/.gitignore @@ -167,7 +167,6 @@ include/openssl/*.h /crypto/* !/crypto/Makefile.am.* -!/crypto/mkfile !/crypto/compat/arc4random.h !/crypto/compat/b_win.c !/crypto/compat/explicit_bzero_win.c diff --git a/README.plan9 b/README.plan9 index b463c8b91e..87eb10b074 100644 --- a/README.plan9 +++ b/README.plan9 @@ -10,10 +10,12 @@ ## Steps that apply to all builds ## Before building LibreSSL, You must install latest 9legacy stable patches, and -two pull-requests for 0intro/plan9-contrib. +four pull-requests for 0intro/plan9-contrib and lufia/plan9. * https://github.com/0intro/plan9-contrib/pull/6 * https://github.com/0intro/plan9-contrib/pull/7 +* https://github.com/0intro/plan9-contrib/pull/13 +* https://github.com/lufia/plan9/pull/10 Once you have a source tree, either by downloaded using git and having run the `autogen.sh` script above, or by downloading a release distribution from @@ -21,11 +23,6 @@ an OpenBSD mirror, run these commands to build and install the package on most systems: ```sh -./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 mk mk install ``` diff --git a/autogen.rc b/autogen.rc index 1e0b3202d4..8ccf62cbd7 100755 --- a/autogen.rc +++ b/autogen.rc @@ -6,6 +6,25 @@ rfork ne ape/psh ./update.sh for(f in `{ls apps/*/*.c}){ - sed 's/ \.opt\.value = (.*),$/ .opt = { .value = \1 },/' $f >/tmp/autogen.$pid + sed 's/ \.opt\.([a-zA-Z0-9_]+) = (.*),$/ .opt = { .\1 = \2 },/' $f >/tmp/autogen.$pid cp /tmp/autogen.$pid $f } +for(f in `{grep -l '' */*.c */*/*.c}){ + awk ' + { print } + n > 0 { next } + /^#include[ \t]+$/ { + print "#include " + n++ + } + ' $f >/tmp/autogen.$pid + cp /tmp/autogen.$pid $f +} +rm /tmp/autogen.$pid + +cp plan9/apps.mkfile apps/mkfile +ape/psh ./gen-mkfile.sh lib crypto/Makefile.am +ape/psh ./gen-mkfile.sh lib ssl/Makefile.am +ape/psh ./gen-mkfile.sh lib tls/Makefile.am +ape/psh ./gen-mkfile.sh bin apps/openssl/Makefile.am +ape/psh ./gen-mkfile.sh include include/Makefile.am diff --git a/gen-mkfile.sh b/gen-mkfile.sh index c262ef6409..f0fc44c855 100755 --- a/gen-mkfile.sh +++ b/gen-mkfile.sh @@ -386,7 +386,7 @@ function mkfilehdr(m, wfile, a,n,i,name) { # -T flag is dropped; will cause incompatible type signatures error. # -w flag is dropped; is very chatty. # -B flag is needed because apps/openssl still have K&R style prototype. - print "CFLAGS=-FV -B -c\\" >>wfile + print "CFLAGS=-FV -B -u -c\\" >>wfile printf "\t-I%s/include\\\n", topdir() >>wfile printf "\t-I%s/include/compat\\\n", topdir() >>wfile for(name in defs) diff --git a/apps/mkfile b/plan9/apps.mkfile similarity index 100% rename from apps/mkfile rename to plan9/apps.mkfile diff --git a/plan9/apps.patch b/plan9/apps.patch deleted file mode 100644 index 1776eeceda..0000000000 --- a/plan9/apps.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -uprN -X mkfile apps.orig/openssl/apps.c apps/openssl/apps.c ---- apps.orig/openssl/apps.c Sun May 31 21:08:21 2020 -+++ apps/openssl/apps.c Sun May 31 19:27:30 2020 -@@ -146,6 +146,7 @@ - #include - - #include -+#include - - typedef struct { - const char *name; -diff -uprN -X mkfile apps.orig/openssl/x509.c apps/openssl/x509.c ---- apps.orig/openssl/x509.c Sun May 31 21:08:22 2020 -+++ apps/openssl/x509.c Sun May 31 20:33:49 2020 -@@ -65,6 +65,7 @@ - #include "apps.h" - - #include -+#include - #include - #include - #include -@@ -776,7 +777,7 @@ x509_main(int argc, char **argv) - } else if (startdate == i) { - ASN1_TIME *nB = X509_get_notBefore(x); - BIO_puts(STDout, "notBefore="); -- if (ASN1_time_parse(nB->data, nB->length, NULL, 0) == -1) -+ if (ASN1_time_parse((const char *)nB->data, nB->length, NULL, 0) == -1) - BIO_puts(STDout, "INVALID RFC5280 TIME"); - else - ASN1_TIME_print(STDout, nB); diff --git a/plan9/crypto.patch b/plan9/crypto.patch index 40421be586..35a15463cd 100644 --- a/plan9/crypto.patch +++ b/plan9/crypto.patch @@ -20,116 +20,6 @@ diff -uprN -X mkfile crypto.orig/cryptlib.c crypto/cryptlib.c #include #include -diff -uprN -X mkfile crypto.orig/ocsp/ocsp_cl.c crypto/ocsp/ocsp_cl.c ---- crypto.orig/ocsp/ocsp_cl.c Sun May 31 21:08:12 2020 -+++ crypto/ocsp/ocsp_cl.c Sun May 31 19:27:31 2020 -@@ -70,6 +70,7 @@ - #include - #include - #include -+#include - - /* Utility functions related to sending OCSP requests and extracting - * relevant information from the response. -diff -uprN -X mkfile crypto.orig/ocsp/ocsp_srv.c crypto/ocsp/ocsp_srv.c ---- crypto.orig/ocsp/ocsp_srv.c Sun May 31 21:08:12 2020 -+++ crypto/ocsp/ocsp_srv.c Sun May 31 19:27:31 2020 -@@ -64,6 +64,7 @@ - #include - #include - #include -+#include - - /* Utility functions related to sending OCSP responses and extracting - * relevant information from the request. -diff -uprN -X mkfile crypto.orig/ocsp/ocsp_vfy.c crypto/ocsp/ocsp_vfy.c ---- crypto.orig/ocsp/ocsp_vfy.c Sun May 31 21:08:12 2020 -+++ crypto/ocsp/ocsp_vfy.c Sun May 31 19:27:32 2020 -@@ -58,6 +58,7 @@ - - #include - #include -+#include - #include - - static int ocsp_find_signer(X509 **psigner, OCSP_BASICRESP *bs, -diff -uprN -X mkfile crypto.orig/pkcs12/p12_add.c crypto/pkcs12/p12_add.c ---- crypto.orig/pkcs12/p12_add.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs12/p12_add.c Sun May 31 19:27:32 2020 -@@ -60,6 +60,7 @@ - - #include - #include -+#include - - /* Pack an object into an OCTET STRING and turn into a safebag */ - -diff -uprN -X mkfile crypto.orig/pkcs12/p12_p8d.c crypto/pkcs12/p12_p8d.c ---- crypto.orig/pkcs12/p12_p8d.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs12/p12_p8d.c Sun May 31 19:27:32 2020 -@@ -59,6 +59,7 @@ - #include - - #include -+#include - - PKCS8_PRIV_KEY_INFO * - PKCS8_decrypt(const X509_SIG *p8, const char *pass, int passlen) -diff -uprN -X mkfile crypto.orig/pkcs12/p12_p8e.c crypto/pkcs12/p12_p8e.c ---- crypto.orig/pkcs12/p12_p8e.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs12/p12_p8e.c Sun May 31 19:27:32 2020 -@@ -60,6 +60,7 @@ - - #include - #include -+#include - - X509_SIG * - PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, const char *pass, -diff -uprN -X mkfile crypto.orig/pkcs12/p12_utl.c crypto/pkcs12/p12_utl.c ---- crypto.orig/pkcs12/p12_utl.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs12/p12_utl.c Sun May 31 19:27:32 2020 -@@ -61,6 +61,7 @@ - #include - - #include -+#include - - /* Cheap and nasty Unicode stuff */ - -diff -uprN -X mkfile crypto.orig/pkcs7/bio_pk7.c crypto/pkcs7/bio_pk7.c ---- crypto.orig/pkcs7/bio_pk7.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs7/bio_pk7.c Sun May 31 19:27:32 2020 -@@ -53,6 +53,7 @@ - */ - - #include -+#include - #include - #include - -diff -uprN -X mkfile crypto.orig/pkcs7/pk7_doit.c crypto/pkcs7/pk7_doit.c ---- crypto.orig/pkcs7/pk7_doit.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs7/pk7_doit.c Sun May 31 19:27:32 2020 -@@ -64,6 +64,7 @@ - #include - #include - #include -+#include - - static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, - void *value); -diff -uprN -X mkfile crypto.orig/pkcs7/pk7_mime.c crypto/pkcs7/pk7_mime.c ---- crypto.orig/pkcs7/pk7_mime.c Sun May 31 21:08:13 2020 -+++ crypto/pkcs7/pk7_mime.c Sun May 31 19:27:32 2020 -@@ -57,6 +57,7 @@ - - #include - #include -+#include - - /* PKCS#7 wrappers round generalised stream and MIME routines */ - diff -uprN -X mkfile crypto.orig/poly1305/poly1305-donna.c crypto/poly1305/poly1305-donna.c --- crypto.orig/poly1305/poly1305-donna.c Sun May 31 21:08:13 2020 +++ crypto/poly1305/poly1305-donna.c Sun May 31 19:27:32 2020 @@ -141,113 +31,3 @@ diff -uprN -X mkfile crypto.orig/poly1305/poly1305-donna.c crypto/poly1305/poly1 static inline void poly1305_init(poly1305_context *ctx, const unsigned char key[32]); -diff -uprN -X mkfile crypto.orig/x509/x_all.c crypto/x509/x_all.c ---- crypto.orig/x509/x_all.c Sun May 31 21:08:16 2020 -+++ crypto/x509/x_all.c Sun May 31 19:27:32 2020 -@@ -61,6 +61,7 @@ - #include - - #include -+#include - #include - #include - #include -diff -uprN -X mkfile crypto.orig/x509v3/v3_alt.c crypto/x509v3/v3_alt.c ---- crypto.orig/x509v3/v3_alt.c Sun May 31 21:08:16 2020 -+++ crypto/x509v3/v3_alt.c Sun May 31 19:27:32 2020 -@@ -62,6 +62,7 @@ - #include - #include - #include -+#include - - static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); -diff -uprN -X mkfile crypto.orig/x509v3/v3_bitst.c crypto/x509v3/v3_bitst.c ---- crypto.orig/x509v3/v3_bitst.c Sun May 31 21:08:16 2020 -+++ crypto/x509v3/v3_bitst.c Sun May 31 19:27:33 2020 -@@ -62,6 +62,7 @@ - #include - #include - #include -+#include - - static BIT_STRING_BITNAME ns_cert_type_table[] = { - {0, "SSL Client", "client"}, -diff -uprN -X mkfile crypto.orig/x509v3/v3_enum.c crypto/x509v3/v3_enum.c ---- crypto.orig/x509v3/v3_enum.c Sun May 31 21:08:16 2020 -+++ crypto/x509v3/v3_enum.c Sun May 31 19:27:33 2020 -@@ -59,6 +59,7 @@ - #include - #include - #include -+#include - - static ENUMERATED_NAMES crl_reasons[] = { - {CRL_REASON_UNSPECIFIED, "Unspecified", "unspecified"}, -diff -uprN -X mkfile crypto.orig/x509v3/v3_ia5.c crypto/x509v3/v3_ia5.c ---- crypto.orig/x509v3/v3_ia5.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_ia5.c Sun May 31 19:27:33 2020 -@@ -60,6 +60,7 @@ - #include - - #include -+#include - #include - #include - #include -diff -uprN -X mkfile crypto.orig/x509v3/v3_int.c crypto/x509v3/v3_int.c ---- crypto.orig/x509v3/v3_int.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_int.c Sun May 31 19:27:33 2020 -@@ -59,6 +59,7 @@ - #include - - #include -+#include - - const X509V3_EXT_METHOD v3_crl_num = { - .ext_nid = NID_crl_number, -diff -uprN -X mkfile crypto.orig/x509v3/v3_ocsp.c crypto/x509v3/v3_ocsp.c ---- crypto.orig/x509v3/v3_ocsp.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_ocsp.c Sun May 31 19:27:33 2020 -@@ -64,6 +64,7 @@ - #ifndef OPENSSL_NO_OCSP - - #include -+#include - #include - #include - #include -diff -uprN -X mkfile crypto.orig/x509v3/v3_pci.c crypto/x509v3/v3_pci.c ---- crypto.orig/x509v3/v3_pci.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_pci.c Sun May 31 19:27:33 2020 -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext, - BIO *out, int indent); -diff -uprN -X mkfile crypto.orig/x509v3/v3_skey.c crypto/x509v3/v3_skey.c ---- crypto.orig/x509v3/v3_skey.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_skey.c Sun May 31 19:27:33 2020 -@@ -60,6 +60,7 @@ - #include - - #include -+#include - #include - - static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, -diff -uprN -X mkfile crypto.orig/x509v3/v3_utl.c crypto/x509v3/v3_utl.c ---- crypto.orig/x509v3/v3_utl.c Sun May 31 21:08:17 2020 -+++ crypto/x509v3/v3_utl.c Sun May 31 19:27:33 2020 -@@ -61,6 +61,7 @@ - #include - #include - -+#include - #include - #include - #include diff --git a/update.sh b/update.sh index 5718393533..c4801dfe6d 100755 --- a/update.sh +++ b/update.sh @@ -63,7 +63,6 @@ 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' @@ -75,7 +74,6 @@ OBJECTS='perl objects.pl' OBJ_DAT='perl obj_dat.pl' if [ `uname` = Plan9 ]; then CP='cp' - LS='ls' find_c_src() { du -a $1 | sed 's/^[ ]*[0-9][0-9]*[ ]*//' | @@ -346,7 +344,7 @@ chmod 755 tests/testssl # add headers (cd include/openssl $CP Makefile.am.tpl Makefile.am - for i in `$LS *.h|sort`; do + for i in `ls -1 *.h|sort`; do echo "opensslinclude_HEADERS += $i" >> Makefile.am done echo endif >> Makefile.am @@ -394,25 +392,25 @@ echo "if !ENABLE_LIBTLS_ONLY" >> 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`; do + for i in `ls -1 $libssl_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `$LS $libcrypto_src/man/*.3 | sort`; do + for i in `ls -1 $libcrypto_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `$LS $libtls_src/man/*.3 | sort`; do + for i in `ls -1 $libtls_src/man/*.3 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man3_MANS += $NAME" >> Makefile.am done - for i in `$LS $libcrypto_src/man/*.5 | sort`; do + for i in `ls -1 $libcrypto_src/man/*.5 | sort`; do NAME=`basename "$i"` $CP $i . echo "dist_man5_MANS += $NAME" >> Makefile.am