mirror of
https://github.com/slackhq/nebula.git
synced 2026-03-10 00:31:54 -07:00
don't panic on bad ed25519 key lengths
This commit is contained in:
parent
f573e8a266
commit
8c828b3cae
2 changed files with 6 additions and 0 deletions
|
|
@ -112,6 +112,9 @@ func (c *certificateV1) CheckSignature(key []byte) bool {
|
|||
}
|
||||
switch c.details.curve {
|
||||
case Curve_CURVE25519:
|
||||
if len(key) != ed25519.PublicKeySize {
|
||||
return false //avoids a panic internal to ed25519
|
||||
}
|
||||
return ed25519.Verify(key, b, c.signature)
|
||||
case Curve_P256:
|
||||
pubKey, err := ecdsa.ParseUncompressedPublicKey(elliptic.P256(), key)
|
||||
|
|
|
|||
|
|
@ -151,6 +151,9 @@ func (c *certificateV2) CheckSignature(key []byte) bool {
|
|||
|
||||
switch c.curve {
|
||||
case Curve_CURVE25519:
|
||||
if len(key) != ed25519.PublicKeySize {
|
||||
return false //avoids a panic internal to ed25519
|
||||
}
|
||||
return ed25519.Verify(key, b, c.signature)
|
||||
case Curve_P256:
|
||||
pubKey, err := ecdsa.ParseUncompressedPublicKey(elliptic.P256(), key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue