From 1b226e58af4058190ce0889aa54b5c489ede554f Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 28 Oct 2023 08:26:20 -0400 Subject: A bunch of linting and refactorings (#1893) --- crypto/ecdsa.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'crypto') diff --git a/crypto/ecdsa.go b/crypto/ecdsa.go index 6f377390..02212b20 100644 --- a/crypto/ecdsa.go +++ b/crypto/ecdsa.go @@ -10,15 +10,21 @@ import ( "fmt" ) -var ( - // Curves is a map of curve names to curves - Curves = map[string]elliptic.Curve{ - "P224": elliptic.P224(), - "P256": elliptic.P256(), - "P384": elliptic.P384(), - "P521": elliptic.P521(), +// Curves - +func Curves(c string) (elliptic.Curve, bool) { + switch c { + case "P224": + return elliptic.P224(), true + case "P256": + return elliptic.P256(), true + case "P384": + return elliptic.P384(), true + case "P521": + return elliptic.P521(), true + default: + return nil, false } -) +} // ECDSAGenerateKey - func ECDSAGenerateKey(curve elliptic.Curve) ([]byte, error) { -- cgit v1.2.3