Conversation
| } | ||
| err2 = (BN_nnmod(challenge_built.get(), challenge_built.get(), | ||
| Schnorr::GetCurveOrder(), NULL) == 0); | ||
| Schnorr::GetCurveOrder(), ctx.get()) == 0); |
There was a problem hiding this comment.
This caused a SEGV when running ubuntu 20.04 - the API for bignum indicates that this argument should be provided. It is a scratch variable:
https://linux.die.net/man/3/bn_nnmod
For all functions, ctx is a previously allocated BN_CTX used for temporary variables;
|
|
||
| bytes buf(Schnorr::PUBKEY_COMPRESSED_SIZE_BYTES); | ||
|
|
||
| unique_ptr<BN_CTX, void (*)(BN_CTX*)> ctx(BN_CTX_new(), BN_CTX_free); |
There was a problem hiding this comment.
Allocate temporary ctx variable here
|
|
||
| shared_ptr<EC_POINT> result = | ||
| ECPOINTSerialize::GetNumber(src, offset, PUB_KEY_SIZE); | ||
| ECPOINTSerialize::GetNumber(src, offset, src.size()); |
There was a problem hiding this comment.
when the size of src was not PUB_KEY_SIZE this would fail. However if you allow compressed and uncompressed signatures your pub key size could vary.
Codecov Report
@@ Coverage Diff @@
## master #14 +/- ##
==========================================
- Coverage 76.83% 76.50% -0.33%
==========================================
Files 19 19
Lines 1105 1111 +6
==========================================
+ Hits 849 850 +1
- Misses 256 261 +5
Continue to review full report at Codecov.
|
See comments inline