Skip to content

Commit

Permalink
Allow to skip malleability check when deserializing BLS primitives
Browse files Browse the repository at this point in the history
Useful when many sigs need to be deserialized and at the same time the hash
of these is never used.
  • Loading branch information
codablock committed Jan 9, 2019
1 parent 9d25bb1 commit c6be8cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bls/bls.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,15 @@ class CBLSWrapper
// }
}
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
Expand Down

0 comments on commit c6be8cf

Please sign in to comment.