Fix ECIES params nil bug
* Change ECIES params init function to static var as it does not have state; fixes TestMarshalencryption.
This commit is contained in:
parent
04c1a81509
commit
5136fc9ab7
10
params.go
10
params.go
@ -36,14 +36,8 @@ type ECIESParams struct {
|
|||||||
// * ECIES using AES256 and HMAC-SHA-256-32
|
// * ECIES using AES256 and HMAC-SHA-256-32
|
||||||
// * ECIES using AES256 and HMAC-SHA-384-48
|
// * ECIES using AES256 and HMAC-SHA-384-48
|
||||||
// * ECIES using AES256 and HMAC-SHA-512-64
|
// * 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{
|
ECIES_AES128_SHA256 = &ECIESParams{
|
||||||
Hash: sha256.New,
|
Hash: sha256.New,
|
||||||
hashAlgo: crypto.SHA256,
|
hashAlgo: crypto.SHA256,
|
||||||
@ -75,7 +69,7 @@ func init() {
|
|||||||
BlockSize: aes.BlockSize,
|
BlockSize: aes.BlockSize,
|
||||||
KeyLen: 32,
|
KeyLen: 32,
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
var paramsFromCurve = map[elliptic.Curve]*ECIESParams{
|
var paramsFromCurve = map[elliptic.Curve]*ECIESParams{
|
||||||
elliptic.P256(): ECIES_AES128_SHA256,
|
elliptic.P256(): ECIES_AES128_SHA256,
|
||||||
|
Loading…
Reference in New Issue
Block a user