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.
This commit is contained in:
Alexander Block 2018-10-26 15:51:11 +02:00
parent 9d25bb1d8f
commit c6be8cfcd6

View File

@ -165,13 +165,15 @@ public:
// }
}
template <typename Stream>
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