kdf: share Z hash state #220

This commit is contained in:
Sun Yimin 2024-05-15 08:29:37 +08:00 committed by GitHub
parent c99ad27ce1
commit 4fe8d28d31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,7 +9,6 @@ import (
"io" "io"
"sync" "sync"
"github.com/emmansun/gmsm/kdf"
"github.com/emmansun/gmsm/sm3" "github.com/emmansun/gmsm/sm3"
) )
@ -129,7 +128,7 @@ func (uv *PublicKey) SM2SharedKey(isResponder bool, kenLen int, sPub, sRemote *P
copy(buffer[96:], peerZ) copy(buffer[96:], peerZ)
} }
return kdf.Kdf(sm3.New(), buffer[:], kenLen), nil return sm3.Kdf(buffer[:], kenLen), nil
} }
// PrivateKey is an ECDH private key, usually kept secret. // PrivateKey is an ECDH private key, usually kept secret.