mirror of
https://github.com/slackhq/nebula.git
synced 2026-08-16 13:47:02 +02:00
return err instead of panic
This commit is contained in:
@@ -243,7 +243,7 @@ func newCipherSuite(curve cert.Curve, pkcs11backed bool, cipher string) (noise.C
|
|||||||
switch curve {
|
switch curve {
|
||||||
case cert.Curve_CURVE25519:
|
case cert.Curve_CURVE25519:
|
||||||
if fips140.Enforced() {
|
if fips140.Enforced() {
|
||||||
panic("pki: use of Curve25519 is not allowed in FIPS 140-only mode")
|
return nil, errors.New("pki: use of Curve25519 is not allowed in FIPS 140-only mode")
|
||||||
}
|
}
|
||||||
dhFunc = noise.DH25519
|
dhFunc = noise.DH25519
|
||||||
case cert.Curve_P256:
|
case cert.Curve_P256:
|
||||||
@@ -258,7 +258,7 @@ func newCipherSuite(curve cert.Curve, pkcs11backed bool, cipher string) (noise.C
|
|||||||
|
|
||||||
if cipher == "chachapoly" {
|
if cipher == "chachapoly" {
|
||||||
if fips140.Enforced() {
|
if fips140.Enforced() {
|
||||||
panic("pki: use of ChaChaPoly is not allowed in FIPS 140-only mode")
|
return nil, errors.New("pki: use of ChaChaPoly is not allowed in FIPS 140-only mode")
|
||||||
}
|
}
|
||||||
return noise.NewCipherSuite(dhFunc, noise.CipherChaChaPoly, noise.HashSHA256), nil
|
return noise.NewCipherSuite(dhFunc, noise.CipherChaChaPoly, noise.HashSHA256), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user