From 5884c3020ebf4b904db0c16bfa83b15d24bdce69 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Sun, 11 Mar 2018 19:32:12 +0000 Subject: [PATCH 1/4] Travis: Upgrade to Go 1.10. Remove older Go versions, because ncdns's x509 fork no longer builds with them. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c2fc532..d6904ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.9 + - "1.10" addons: apt: From 8d44b532aa69567538aaab6aa13aed1c5ca4f171 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Sun, 11 Mar 2018 19:34:40 +0000 Subject: [PATCH 2/4] x509: Update install script for Go 1.10. --- x509/install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/x509/install.sh b/x509/install.sh index 7577cc7..5834df7 100755 --- a/x509/install.sh +++ b/x509/install.sh @@ -5,3 +5,13 @@ shopt -s failglob cp -a $(go env GOROOT)/src/crypto/x509/* ./ rm ./x509_test.go + +# The following code is utterly horrifying. I can't find a better way to do it. :( +mkdir -p ${GOPATH}/src/vendor/golang.org/ +cp -R $(go env GOROOT)/src/vendor/golang_org/* ${GOPATH}/src/vendor/golang.org/ +# h/t to https://www.cyberciti.biz/faq/unix-linux-replace-string-words-in-many-files/ +OLD_PACKAGE='"golang_org/x/crypto/cryptobyte' +OLD_PACKAGE="${OLD_PACKAGE//\//\\/}" +NEW_PACKAGE='"golang.org/x/crypto/cryptobyte' +NEW_PACKAGE="${NEW_PACKAGE//\//\\/}" +sed -i "s/${OLD_PACKAGE}/${NEW_PACKAGE}/g" ./*.go ${GOPATH}/src/vendor/golang.org/x/crypto/cryptobyte/*.go From 437303f33de066685697b1bef636b2fe1bfc7c0c Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Mon, 12 Mar 2018 22:39:27 +0000 Subject: [PATCH 3/4] Rebase x509 onto Go 1.10. --- x509/x509_splice.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x509/x509_splice.go b/x509/x509_splice.go index 176781c..54c62c8 100644 --- a/x509/x509_splice.go +++ b/x509/x509_splice.go @@ -6,7 +6,7 @@ // This code is modified from the stock CreateCertificate to use a // pre-existing signature. -// Last rebased on Go 1.9 +// Last rebased on Go 1.10 // Remove all content between "import" and "CreateCertificate" in original. // Remove all content after "CreateCertificate" in original. //go:generate bash install.sh @@ -36,11 +36,17 @@ import ( //"io" //"math/big" //"net" + //"net/url" //"strconv" + //"strings" //"time" + //"unicode/utf8" + + //"golang_org/x/crypto/cryptobyte" + //cryptobyte_asn1 "golang_org/x/crypto/cryptobyte/asn1" ) -// CreateCertificate creates a new certificate based on a template. +// CreateCertificate creates a new X.509v3 certificate based on a template. // The following members of template are used: AuthorityKeyId, // BasicConstraintsValid, DNSNames, ExcludedDNSDomains, ExtKeyUsage, // IsCA, KeyUsage, MaxPathLen, MaxPathLenZero, NotAfter, NotBefore, @@ -104,7 +110,7 @@ func CreateCertificateWithSplicedSignature(template, parent *Certificate) (cert authorityKeyId = parent.SubjectKeyId } - extensions, err := buildExtensions(template, authorityKeyId) + extensions, err := buildExtensions(template, bytes.Equal(asn1Subject, emptyASN1Subject), authorityKeyId) if err != nil { return } From 443f1b157431d47428a9e356aabac7589ad0e417 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Wed, 8 Aug 2018 05:12:56 +0000 Subject: [PATCH 4/4] x509: Fix goimports warning in x509_splice.go --- x509/x509_splice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x509/x509_splice.go b/x509/x509_splice.go index 54c62c8..6825f6b 100644 --- a/x509/x509_splice.go +++ b/x509/x509_splice.go @@ -41,7 +41,7 @@ import ( //"strings" //"time" //"unicode/utf8" - + // //"golang_org/x/crypto/cryptobyte" //cryptobyte_asn1 "golang_org/x/crypto/cryptobyte/asn1" )