aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-02-12 09:31:00 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-02-12 09:35:35 +0800
commit5136fc9ab71f77b0741c52b312ca9fdbfb5240c3 (patch)
tree172e17bc69a9003b7e133eb1aefc157218b877a1
parent04c1a81509576c898f4d30a76f9d84d087e2a4cf (diff)
downloadgo-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar.gz
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar.bz2
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar.lz
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar.xz
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.tar.zst
go-tangerine-5136fc9ab71f77b0741c52b312ca9fdbfb5240c3.zip
Fix ECIES params nil bug
* Change ECIES params init function to static var as it does not have state; fixes TestMarshalencryption.
-rw-r--r--params.go10
1 files changed, 2 insertions, 8 deletions
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,