build(deps): Bump golang.org/x/crypto from 0.1.0 to 0.7.0 (#6776)

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.1.0
to 0.7.0.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-03-29 19:08:32 -04:00 committed by GitHub
parent 511f5b79f1
commit 3850ab3bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 46 deletions

4
go.mod
View File

@ -28,9 +28,9 @@ require (
github.com/weppos/publicsuffix-go v0.30.0 github.com/weppos/publicsuffix-go v0.30.0
github.com/zmap/zcrypto v0.0.0-20220402174210-599ec18ecbac github.com/zmap/zcrypto v0.0.0-20220402174210-599ec18ecbac
github.com/zmap/zlint/v3 v3.4.0 github.com/zmap/zlint/v3 v3.4.0
golang.org/x/crypto v0.1.0 golang.org/x/crypto v0.7.0
golang.org/x/exp v0.0.0-20230118134722-a68e582fa157 golang.org/x/exp v0.0.0-20230118134722-a68e582fa157
golang.org/x/net v0.7.0 golang.org/x/net v0.8.0
golang.org/x/sync v0.1.0 golang.org/x/sync v0.1.0
golang.org/x/term v0.6.0 golang.org/x/term v0.6.0
golang.org/x/text v0.8.0 golang.org/x/text v0.8.0

7
go.sum
View File

@ -335,8 +335,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -410,8 +410,9 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=

View File

@ -264,36 +264,35 @@ func (s *String) ReadASN1Boolean(out *bool) bool {
return true return true
} }
var bigIntType = reflect.TypeOf((*big.Int)(nil)).Elem()
// ReadASN1Integer decodes an ASN.1 INTEGER into out and advances. If out does // ReadASN1Integer decodes an ASN.1 INTEGER into out and advances. If out does
// not point to an integer or to a big.Int, it panics. It reports whether the // not point to an integer, to a big.Int, or to a []byte it panics. Only
// read was successful. // positive and zero values can be decoded into []byte, and they are returned as
// big-endian binary values that share memory with s. Positive values will have
// no leading zeroes, and zero will be returned as a single zero byte.
// ReadASN1Integer reports whether the read was successful.
func (s *String) ReadASN1Integer(out interface{}) bool { func (s *String) ReadASN1Integer(out interface{}) bool {
if reflect.TypeOf(out).Kind() != reflect.Ptr { switch out := out.(type) {
panic("out is not a pointer") case *int, *int8, *int16, *int32, *int64:
}
switch reflect.ValueOf(out).Elem().Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
var i int64 var i int64
if !s.readASN1Int64(&i) || reflect.ValueOf(out).Elem().OverflowInt(i) { if !s.readASN1Int64(&i) || reflect.ValueOf(out).Elem().OverflowInt(i) {
return false return false
} }
reflect.ValueOf(out).Elem().SetInt(i) reflect.ValueOf(out).Elem().SetInt(i)
return true return true
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: case *uint, *uint8, *uint16, *uint32, *uint64:
var u uint64 var u uint64
if !s.readASN1Uint64(&u) || reflect.ValueOf(out).Elem().OverflowUint(u) { if !s.readASN1Uint64(&u) || reflect.ValueOf(out).Elem().OverflowUint(u) {
return false return false
} }
reflect.ValueOf(out).Elem().SetUint(u) reflect.ValueOf(out).Elem().SetUint(u)
return true return true
case reflect.Struct: case *big.Int:
if reflect.TypeOf(out).Elem() == bigIntType { return s.readASN1BigInt(out)
return s.readASN1BigInt(out.(*big.Int)) case *[]byte:
} return s.readASN1Bytes(out)
} default:
panic("out does not point to an integer type") panic("out does not point to an integer type")
}
} }
func checkASN1Integer(bytes []byte) bool { func checkASN1Integer(bytes []byte) bool {
@ -333,6 +332,21 @@ func (s *String) readASN1BigInt(out *big.Int) bool {
return true return true
} }
func (s *String) readASN1Bytes(out *[]byte) bool {
var bytes String
if !s.ReadASN1(&bytes, asn1.INTEGER) || !checkASN1Integer(bytes) {
return false
}
if bytes[0]&0x80 == 0x80 {
return false
}
for len(bytes) > 1 && bytes[0] == 0 {
bytes = bytes[1:]
}
*out = bytes
return true
}
func (s *String) readASN1Int64(out *int64) bool { func (s *String) readASN1Int64(out *int64) bool {
var bytes String var bytes String
if !s.ReadASN1(&bytes, asn1.INTEGER) || !checkASN1Integer(bytes) || !asn1Signed(out, bytes) { if !s.ReadASN1(&bytes, asn1.INTEGER) || !checkASN1Integer(bytes) || !asn1Signed(out, bytes) {
@ -532,7 +546,7 @@ func (s *String) ReadASN1BitString(out *encoding_asn1.BitString) bool {
return false return false
} }
paddingBits := uint8(bytes[0]) paddingBits := bytes[0]
bytes = bytes[1:] bytes = bytes[1:]
if paddingBits > 7 || if paddingBits > 7 ||
len(bytes) == 0 && paddingBits != 0 || len(bytes) == 0 && paddingBits != 0 ||
@ -545,7 +559,7 @@ func (s *String) ReadASN1BitString(out *encoding_asn1.BitString) bool {
return true return true
} }
// ReadASN1BitString decodes an ASN.1 BIT STRING into out and advances. It is // ReadASN1BitStringAsBytes decodes an ASN.1 BIT STRING into out and advances. It is
// an error if the BIT STRING is not a whole number of bytes. It reports // an error if the BIT STRING is not a whole number of bytes. It reports
// whether the read was successful. // whether the read was successful.
func (s *String) ReadASN1BitStringAsBytes(out *[]byte) bool { func (s *String) ReadASN1BitStringAsBytes(out *[]byte) bool {
@ -554,7 +568,7 @@ func (s *String) ReadASN1BitStringAsBytes(out *[]byte) bool {
return false return false
} }
paddingBits := uint8(bytes[0]) paddingBits := bytes[0]
if paddingBits != 0 { if paddingBits != 0 {
return false return false
} }
@ -654,34 +668,27 @@ func (s *String) SkipOptionalASN1(tag asn1.Tag) bool {
return s.ReadASN1(&unused, tag) return s.ReadASN1(&unused, tag)
} }
// ReadOptionalASN1Integer attempts to read an optional ASN.1 INTEGER // ReadOptionalASN1Integer attempts to read an optional ASN.1 INTEGER explicitly
// explicitly tagged with tag into out and advances. If no element with a // tagged with tag into out and advances. If no element with a matching tag is
// matching tag is present, it writes defaultValue into out instead. If out // present, it writes defaultValue into out instead. Otherwise, it behaves like
// does not point to an integer or to a big.Int, it panics. It reports // ReadASN1Integer.
// whether the read was successful.
func (s *String) ReadOptionalASN1Integer(out interface{}, tag asn1.Tag, defaultValue interface{}) bool { func (s *String) ReadOptionalASN1Integer(out interface{}, tag asn1.Tag, defaultValue interface{}) bool {
if reflect.TypeOf(out).Kind() != reflect.Ptr {
panic("out is not a pointer")
}
var present bool var present bool
var i String var i String
if !s.ReadOptionalASN1(&i, &present, tag) { if !s.ReadOptionalASN1(&i, &present, tag) {
return false return false
} }
if !present { if !present {
switch reflect.ValueOf(out).Elem().Kind() { switch out.(type) {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, case *int, *int8, *int16, *int32, *int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: *uint, *uint8, *uint16, *uint32, *uint64, *[]byte:
reflect.ValueOf(out).Elem().Set(reflect.ValueOf(defaultValue)) reflect.ValueOf(out).Elem().Set(reflect.ValueOf(defaultValue))
case reflect.Struct: case *big.Int:
if reflect.TypeOf(out).Elem() != bigIntType { if defaultValue, ok := defaultValue.(*big.Int); ok {
panic("invalid integer type") out.(*big.Int).Set(defaultValue)
} } else {
if reflect.TypeOf(defaultValue).Kind() != reflect.Ptr ||
reflect.TypeOf(defaultValue).Elem() != bigIntType {
panic("out points to big.Int, but defaultValue does not") panic("out points to big.Int, but defaultValue does not")
} }
out.(*big.Int).Set(defaultValue.(*big.Int))
default: default:
panic("invalid integer type") panic("invalid integer type")
} }

View File

@ -303,9 +303,9 @@ func (b *Builder) add(bytes ...byte) {
b.result = append(b.result, bytes...) b.result = append(b.result, bytes...)
} }
// Unwrite rolls back n bytes written directly to the Builder. An attempt by a // Unwrite rolls back non-negative n bytes written directly to the Builder.
// child builder passed to a continuation to unwrite bytes from its parent will // An attempt by a child builder passed to a continuation to unwrite bytes
// panic. // from its parent will panic.
func (b *Builder) Unwrite(n int) { func (b *Builder) Unwrite(n int) {
if b.err != nil { if b.err != nil {
return return
@ -317,6 +317,9 @@ func (b *Builder) Unwrite(n int) {
if length < 0 { if length < 0 {
panic("cryptobyte: internal error") panic("cryptobyte: internal error")
} }
if n < 0 {
panic("cryptobyte: attempted to unwrite negative number of bytes")
}
if n > length { if n > length {
panic("cryptobyte: attempted to unwrite more than was written") panic("cryptobyte: attempted to unwrite more than was written")
} }

4
vendor/modules.txt vendored
View File

@ -275,7 +275,7 @@ github.com/zmap/zlint/v3/lints/etsi
github.com/zmap/zlint/v3/lints/mozilla github.com/zmap/zlint/v3/lints/mozilla
github.com/zmap/zlint/v3/lints/rfc github.com/zmap/zlint/v3/lints/rfc
github.com/zmap/zlint/v3/util github.com/zmap/zlint/v3/util
# golang.org/x/crypto v0.1.0 # golang.org/x/crypto v0.7.0
## explicit; go 1.17 ## explicit; go 1.17
golang.org/x/crypto/cryptobyte golang.org/x/crypto/cryptobyte
golang.org/x/crypto/cryptobyte/asn1 golang.org/x/crypto/cryptobyte/asn1
@ -289,7 +289,7 @@ golang.org/x/exp/slices
# golang.org/x/mod v0.8.0 # golang.org/x/mod v0.8.0
## explicit; go 1.17 ## explicit; go 1.17
golang.org/x/mod/semver golang.org/x/mod/semver
# golang.org/x/net v0.7.0 # golang.org/x/net v0.8.0
## explicit; go 1.17 ## explicit; go 1.17
golang.org/x/net/bpf golang.org/x/net/bpf
golang.org/x/net/context golang.org/x/net/context