From 458c882ff4f99874ead0718054fd6a8fdae92969 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 2 Jun 2022 17:46:19 +0300 Subject: [PATCH] [#261] session: Make failed `Sign` pure on failed signature calculation Make `Sign` method implementation to not modify `issuerSet` state variable after signature calculation's failures. Signed-off-by: Leonard Lyubich --- session/common.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/session/common.go b/session/common.go index 0eb6254..751a65f 100644 --- a/session/common.go +++ b/session/common.go @@ -157,7 +157,6 @@ func (x commonData) signedData(w contextWriter) []byte { func (x *commonData) sign(key ecdsa.PrivateKey, w contextWriter) error { user.IDFromKey(&x.issuer, key.PublicKey) - x.issuerSet = true var sig neofscrypto.Signature @@ -166,6 +165,8 @@ func (x *commonData) sign(key ecdsa.PrivateKey, w contextWriter) error { return err } + x.issuerSet = true + sig.WriteToV2(&x.sig) x.sigSet = true