-
Notifications
You must be signed in to change notification settings - Fork 6
Fixes to build on ubuntu 20.04 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
8d19e7b
455fd72
8266ea0
b125d60
7bc2dd5
0e6552f
8a141e6
27b7c8d
66b1ae3
8365020
6262444
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,11 @@ void Challenge::Set(const CommitPoint& aggregatedCommit, | |
|
|
||
| bytes buf(Schnorr::PUBKEY_COMPRESSED_SIZE_BYTES); | ||
|
|
||
| unique_ptr<BN_CTX, void (*)(BN_CTX*)> ctx(BN_CTX_new(), BN_CTX_free); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allocate temporary ctx variable here |
||
| if (!ctx) { | ||
| throw std::bad_alloc(); | ||
| } | ||
|
|
||
| // Convert the committment to octets first | ||
| if (EC_POINT_point2oct(Schnorr::GetCurveGroup(), aggregatedCommit.m_p.get(), | ||
| POINT_CONVERSION_COMPRESSED, buf.data(), | ||
|
|
@@ -166,7 +171,8 @@ void Challenge::Set(const CommitPoint& aggregatedCommit, | |
| return; | ||
| } | ||
|
|
||
| if (BN_nnmod(m_c.get(), m_c.get(), Schnorr::GetCurveOrder(), NULL) == 0) { | ||
| if (BN_nnmod(m_c.get(), m_c.get(), Schnorr::GetCurveOrder(), ctx.get()) == | ||
| 0) { | ||
| // Could not reduce challenge modulo group order | ||
| return; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,8 +112,9 @@ bool PubKey::Serialize(bytes& dst, unsigned int offset) const { | |
| } | ||
|
|
||
| bool PubKey::Deserialize(const bytes& src, unsigned int offset) { | ||
|
|
||
| shared_ptr<EC_POINT> result = | ||
| ECPOINTSerialize::GetNumber(src, offset, PUB_KEY_SIZE); | ||
| ECPOINTSerialize::GetNumber(src, offset, src.size()); | ||
|
||
|
|
||
| if (result == nullptr) { | ||
| // ECPOINTSerialize::GetNumber failed | ||
|
|
||
There was a problem hiding this comment.
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;