From c6be8cfcd6cac6c33c09bb46b32edd3b2c809ffe Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 26 Oct 2018 15:51:11 +0200 Subject: [PATCH] Allow to skip malleability check when deserializing BLS primitives Useful when many sigs need to be deserialized and at the same time the hash of these is never used. --- src/bls/bls.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bls/bls.h b/src/bls/bls.h index ba614c6231168..dc67b9175cb00 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -165,13 +165,15 @@ class CBLSWrapper // } } template - inline void Unserialize(Stream& s) + inline void Unserialize(Stream& s, bool checkMalleable = true) { char buf[SerSize]; s.read((char*)buf, SerSize); SetBuf(buf, SerSize); - CheckMalleable(buf, SerSize); + if (checkMalleable) { + CheckMalleable(buf, SerSize); + } } inline void CheckMalleable(void* buf, size_t size) const