Skip to content

Commit

Permalink
Merge #66: Upgrade to Go 1.10.
Browse files Browse the repository at this point in the history
443f1b1 x509: Fix goimports warning in x509_splice.go (JeremyRand)
437303f Rebase x509 onto Go 1.10. (JeremyRand)
8d44b53 x509: Update install script for Go 1.10. (JeremyRand)
5884c30 Travis: Upgrade to Go 1.10. (JeremyRand)

Pull request description:

  Depends on #65 .  Should not be merged until The Tor Project has upgraded their RBM descriptor to Go 1.10 or higher.

Tree-SHA512: e32dac7b7e1edeb16ffc94c53d1c25fb97fff5ab12ae2ab175a190babde38735d9785805f1f8455b7883283c949db4fd3dcd9f749bb0766bbbb46acd47c8051b
  • Loading branch information
JeremyRand committed Aug 13, 2018
2 parents 5150db0 + 443f1b1 commit 21c3c3d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
go:
- 1.9
- "1.10"

addons:
apt:
Expand Down
10 changes: 10 additions & 0 deletions x509/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 9 additions & 3 deletions x509/x509_splice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 21c3c3d

Please sign in to comment.