From 5136fc9ab71f77b0741c52b312ca9fdbfb5240c3 Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Thu, 12 Feb 2015 02:31:00 +0100 Subject: Fix ECIES params nil bug * Change ECIES params init function to static var as it does not have state; fixes TestMarshalencryption. --- params.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'params.go') diff --git a/params.go b/params.go index b968c7c17..fd1ceedd0 100644 --- a/params.go +++ b/params.go @@ -36,14 +36,8 @@ type ECIESParams struct { // * ECIES using AES256 and HMAC-SHA-256-32 // * ECIES using AES256 and HMAC-SHA-384-48 // * ECIES using AES256 and HMAC-SHA-512-64 -var ( - ECIES_AES128_SHA256 *ECIESParams - ECIES_AES256_SHA256 *ECIESParams - ECIES_AES256_SHA384 *ECIESParams - ECIES_AES256_SHA512 *ECIESParams -) -func init() { +var ( ECIES_AES128_SHA256 = &ECIESParams{ Hash: sha256.New, hashAlgo: crypto.SHA256, @@ -75,7 +69,7 @@ func init() { BlockSize: aes.BlockSize, KeyLen: 32, } -} +) var paramsFromCurve = map[elliptic.Curve]*ECIESParams{ elliptic.P256(): ECIES_AES128_SHA256, -- cgit v1.2.3