Skip to content

Commit

Permalink
plan9: simplify patches
Browse files Browse the repository at this point in the history
  • Loading branch information
lufia committed May 30, 2021
1 parent d8a4192 commit 0569903
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 267 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions README.plan9
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@
## 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
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
```
Expand Down
21 changes: 20 additions & 1 deletion autogen.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<openssl/(asn1|ocsp|pkcs12|x509v3)\.h>' */*.c */*/*.c}){
awk '
{ print }
n > 0 { next }
/^#include[ \t]+<openssl\/(asn1|ocsp|pkcs12|x509v3)\.h>$/ {
print "#include <openssl/asn1t.h>"
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
2 changes: 1 addition & 1 deletion gen-mkfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
File renamed without changes.
31 changes: 0 additions & 31 deletions plan9/apps.patch

This file was deleted.

220 changes: 0 additions & 220 deletions plan9/crypto.patch
Original file line number Diff line number Diff line change
Expand Up @@ -20,116 +20,6 @@ diff -uprN -X mkfile crypto.orig/cryptlib.c crypto/cryptlib.c
#include <unistd.h>

#include <openssl/opensslconf.h>
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 <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

/* 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 <openssl/pem.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

/* 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 <openssl/ocsp.h>
#include <openssl/err.h>
+#include <openssl/asn1t.h>
#include <string.h>

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 <openssl/err.h>
#include <openssl/pkcs12.h>
+#include <openssl/asn1t.h>

/* 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 <stdio.h>

#include <openssl/pkcs12.h>
+#include <openssl/asn1t.h>

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 <openssl/err.h>
#include <openssl/pkcs12.h>
+#include <openssl/asn1t.h>

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 <string.h>

#include <openssl/pkcs12.h>
+#include <openssl/asn1t.h>

/* 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 <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/pkcs7.h>
#include <openssl/bio.h>

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 <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <openssl/asn1.h>
#include <openssl/x509.h>
+#include <openssl/asn1t.h>

/* 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
Expand All @@ -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 <openssl/opensslconf.h>

#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include <openssl/stack.h>
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 <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <stdio.h>
#include <string.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <string.h>

#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
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 <stdio.h>

#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/ocsp.h>
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 <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+#include <openssl/asn1t.h>

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 <string.h>

#include <openssl/err.h>
+#include <openssl/asn1t.h>
#include <openssl/x509v3.h>

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 <stdio.h>
#include <string.h>

+#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/conf.h>
#include <openssl/err.h>
12 changes: 5 additions & 7 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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]*[ ]*//' |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0569903

Please sign in to comment.