Skip to content

Fixes to build on ubuntu 20.04#14

Open
n-hutton wants to merge 11 commits intomasterfrom
fix_bn2
Open

Fixes to build on ubuntu 20.04#14
n-hutton wants to merge 11 commits intomasterfrom
fix_bn2

Conversation

@n-hutton
Copy link

See comments inline

}
err2 = (BN_nnmod(challenge_built.get(), challenge_built.get(),
Schnorr::GetCurveOrder(), NULL) == 0);
Schnorr::GetCurveOrder(), ctx.get()) == 0);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocate temporary ctx variable here


shared_ptr<EC_POINT> result =
ECPOINTSerialize::GetNumber(src, offset, PUB_KEY_SIZE);
ECPOINTSerialize::GetNumber(src, offset, src.size());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter
Copy link

codecov-commenter commented Jul 15, 2022

Codecov Report

Merging #14 (66b1ae3) into master (efa28df) will decrease coverage by 0.32%.
The diff coverage is 50.00%.

@@            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     
Impacted Files Coverage Δ
src/libSchnorr/src/MultiSig_CommitPointHash.cpp 0.00% <0.00%> (ø)
src/libSchnorr/src/MultiSig_Challenge.cpp 80.30% <75.00%> (-0.65%) ⬇️
src/libSchnorr/src/MultiSig.cpp 70.86% <100.00%> (ø)
src/libSchnorr/src/Schnorr_PubKey.cpp 64.36% <100.00%> (ø)
src/libSchnorr/src/ECPOINTSerialize.cpp 81.81% <0.00%> (-4.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efa28df...66b1ae3. Read the comment docs.

@n-hutton n-hutton changed the title Fixes to build on ubuntu 20.04 and allow uncompressed signatures Fixes to build on ubuntu 20.04 Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments