-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
fix: check extraEntropy according to the spec #56
Conversation
Length of Fp.bytes are for compatibility with libsecp256k1: https://github.com/bitcoin-core/secp256k1/blob/67214f5f7d8e0bdf193ceb1f47ba8277d1a0871a/src/secp256k1.c#L476
Do you need longer value for something, or this is just fixing spec non-compliance? |
I'm moving from our lovely For the EOS crypto 1 byte additional data is used. So I checked the spec and realized that it is not mandatory for additional data to be 32 bytes. According to the comment from libsecp256k1 https://github.com/bitcoin-core/secp256k1/blob/67214f5f7d8e0bdf193ceb1f47ba8277d1a0871a/src/secp256k1.c#L477 additional 16 bytes may be appended too. |
if the byte is e.g. With regards to 16-byte algorithm name: that's true. I did not add it, because extraEntropy is used for |
Yes, it is possible to produce valid EOS signature by using I think it is better to follow specification and check that |
I agree with you.
That's weird. I would have thought they are the same - which would have worked for now. |
Could you add a test for this, please? |
@mahnunchik ping |
@paulmillr done |
Why was .json changed? I think we're having it in repo because it was copied from some other library. Can't we test the dynamic size without changing json? |
Yep, additional test may be added just to test different entropy sizes. |
Ok, please add it and revert json change and we'll be good to go. |
@paulmillr please check the changes |
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123) <h3>Snyk has created this PR to upgrade @noble/curves from 1.2.0 to 1.4.2.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **4 versions** ahead of your current version. - The recommended version was released on **a month ago**. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@noble/curves</b></summary> <ul> <li> <b>1.4.2</b> - <a href="https://github.com/paulmillr/noble-curves/releases/tag/1.4.2">2024-07-01</a></br><ul> <li>Typescript build: revert target from ES2022 to ES2020 due to compat issues</li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://github.com/paulmillr/noble-curves/compare/1.4.1...1.4.2"><tt>1.4.1...1.4.2</tt></a></p> </li> <li> <b>1.4.1</b> - <a href="https://github.com/paulmillr/noble-curves/releases/tag/1.4.1">2024-07-01</a></br><ul> <li>bls12-381: Add mapToCurve; fix typescript types</li> <li>ed25519, utils: Improve tree-shaking</li> <li>Typescript build: emit separate type declarations for ESM, to improve compatibility</li> <li>Typescript build: change target from ES2020 to ES2022</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/carleeto/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/carleeto">@ carleeto</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2204585940" data-permission-text="Title is private" data-url="paulmillr/noble-curves#133" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/133/hovercard" href="https://github.com/paulmillr/noble-curves/pull/133">#133</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://github.com/paulmillr/noble-curves/compare/1.4.0...1.4.1"><tt>1.4.0...1.4.1</tt></a></p> </li> <li> <b>1.4.0</b> - <a href="https://github.com/paulmillr/noble-curves/releases/tag/1.4.0">2024-03-14</a></br><ul> <li>Fix verification of BLS short signatures when using hex</li> <li>Fix types in hash-to-field and weierstrass Entropy</li> <li>Update noble-hashes <a href="https://github.com/paulmillr/noble-hashes/releases/tag/1.4.0">to v1.4</a>, adding support for Big-Endian platforms</li> <li>Small utilities refactor to reduce code duplication</li> <li>tsconfig improvements</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ardislu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ardislu">@ ardislu</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2091950555" data-permission-text="Title is private" data-url="paulmillr/noble-curves#110" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/110/hovercard" href="https://github.com/paulmillr/noble-curves/pull/110">#110</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dhrubabasu/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dhrubabasu">@ dhrubabasu</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2139607575" data-permission-text="Title is private" data-url="paulmillr/noble-curves#117" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/117/hovercard" href="https://github.com/paulmillr/noble-curves/pull/117">#117</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/xrchz/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/xrchz">@ xrchz</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2174811602" data-permission-text="Title is private" data-url="paulmillr/noble-curves#129" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/129/hovercard" href="https://github.com/paulmillr/noble-curves/pull/129">#129</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://github.com/paulmillr/noble-curves/compare/1.3.0...1.4.0"><tt>1.3.0...1.4.0</tt></a></p> </li> <li> <b>1.3.0</b> - <a href="https://github.com/paulmillr/noble-curves/releases/tag/1.3.0">2023-12-11</a></br><ul> <li>BLS: <ul> <li>Add support for short signatures. Short sigs allow using G1 as sig and G2 as pubkeys, instead of wise-versa.</li> <li>Contributed by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/randombit/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/randombit">@ randombit</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1857210226" data-permission-text="Title is private" data-url="paulmillr/noble-curves#74" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/74/hovercard" href="https://github.com/paulmillr/noble-curves/pull/74">#74</a></li> <li>Refactor mask-bit settings, improve encoding resiliency</li> </ul> </li> <li>ed25519, ed448: implement <code>Group</code> interface for <code>DecafPoint</code> and <code>RistrettoPoint</code> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sublimator/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sublimator">@ sublimator</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1904561201" data-permission-text="Title is private" data-url="paulmillr/noble-curves#85" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/85/hovercard" href="https://github.com/paulmillr/noble-curves/pull/85">#85</a></li> <li>ed448: Fix x448 private keys, to be 56 bytes, not 57</li> <li>weierstrass: fix <code>weierstrassPoints</code> missing CURVE object by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/secure12/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/secure12">@ secure12</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1938367323" data-permission-text="Title is private" data-url="paulmillr/noble-curves#92" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/92/hovercard" href="https://github.com/paulmillr/noble-curves/pull/92">#92</a></li> <li>utils: <ul> <li><code>hexToBytes</code>: speed-up 6x, improve error formatting by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/arobsn/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/arobsn">@ arobsn</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1895299733" data-permission-text="Title is private" data-url="paulmillr/noble-curves#83" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/83/hovercard" href="https://github.com/paulmillr/noble-curves/pull/83">#83</a></li> <li><code>isBytes</code>: improve reliability in bad environments such as jsdom</li> <li><code>concatBytes</code>: improve safety by early-checking the type</li> <li><code>equalBytes</code>: make constant-time</li> </ul> </li> <li>Bump noble-hashes to <a href="https://github.com/paulmillr/noble-hashes/releases/tag/1.3.3">1.3.3</a></li> <li>Bump typescript version used to build the package to 5.3.2</li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/randombit/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/randombit">@ randombit</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1857210226" data-permission-text="Title is private" data-url="paulmillr/noble-curves#74" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/74/hovercard" href="https://github.com/paulmillr/noble-curves/pull/74">#74</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/arobsn/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/arobsn">@ arobsn</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1895299733" data-permission-text="Title is private" data-url="paulmillr/noble-curves#83" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/83/hovercard" href="https://github.com/paulmillr/noble-curves/pull/83">#83</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/secure12/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/secure12">@ secure12</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1938367323" data-permission-text="Title is private" data-url="paulmillr/noble-curves#92" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/92/hovercard" href="https://github.com/paulmillr/noble-curves/pull/92">#92</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/yhc125/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/yhc125">@ yhc125</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1945514191" data-permission-text="Title is private" data-url="paulmillr/noble-curves#93" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/93/hovercard" href="https://github.com/paulmillr/noble-curves/pull/93">#93</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://github.com/paulmillr/noble-curves/compare/1.2.0...1.3.0"><tt>1.2.0...1.3.0</tt></a></p> </li> <li> <b>1.2.0</b> - <a href="https://github.com/paulmillr/noble-curves/releases/tag/1.2.0">2023-08-23</a></br><ul> <li>ed448: add decaf448 support</li> <li>weierstrass: improve security of random private keys<br> by decreasing bias from <code>2^-64</code> to <code>2^-curve_security_level</code></li> <li>weierstrass: allow extraEntropy to take any amount of bytes</li> <li>poseidon: improve security, make sboxPower mandatory and prohibit values other than 3, 5, 7; prohibit odd roundsFull</li> <li>hash-to-curve: allow string and Uint8Array DSTs</li> <li>tree-shaking improvements: add <code>sideEffects: false</code> to package.json,<br> add pure annotations to ed25519</li> <li>update noble-hashes to <a href="https://github.com/paulmillr/noble-hashes/releases/tag/1.3.2">1.3.2</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/stknob/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stknob">@ stknob</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1772904613" data-permission-text="Title is private" data-url="paulmillr/noble-curves#59" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/59/hovercard" href="https://github.com/paulmillr/noble-curves/pull/59">#59</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mahnunchik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mahnunchik">@ mahnunchik</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1760879918" data-permission-text="Title is private" data-url="paulmillr/noble-curves#56" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/56/hovercard" href="https://github.com/paulmillr/noble-curves/pull/56">#56</a></li> <li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/steveluscher/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/steveluscher">@ steveluscher</a> made their first contribution in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1782908940" data-permission-text="Title is private" data-url="paulmillr/noble-curves#62" data-hovercard-type="pull_request" data-hovercard-url="/paulmillr/noble-curves/pull/62/hovercard" href="https://github.com/paulmillr/noble-curves/pull/62">#62</a></li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://github.com/paulmillr/noble-curves/compare/1.1.0...1.2.0"><tt>1.1.0...1.2.0</tt></a></p> </li> </ul> from <a href="https://github.com/paulmillr/noble-curves/releases">@noble/curves GitHub release notes</a> </details> </details> --- > [!IMPORTANT] > > - Check the changes in this PR to ensure they won't cause issues with your project. > - This PR was automatically created by Snyk using the credentials of a real user. --- **Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._ **For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIyOGRiMDgxMy03OTIyLTQ1YjMtODEzYy04OGIzM2MxNzkwMDAiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjI4ZGIwODEzLTc5MjItNDViMy04MTNjLTg4YjMzYzE3OTAwMCJ9fQ==" width="0" height="0"/> > - 🧐 [View latest project report](https://app.snyk.io/org/okeamah/project/79f5fe07-5650-42a8-a92c-0ae46036ffc8?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates) > - 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/okeamah/project/79f5fe07-5650-42a8-a92c-0ae46036ffc8/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/okeamah/project/79f5fe07-5650-42a8-a92c-0ae46036ffc8/settings/integration?pkg=&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) <!--- (snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"","from":"noble/curves","to":"noble/curves"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"28db0813-7922-45b3-813c-88b33c179000","prPublicId":"28db0813-7922-45b3-813c-88b33c179000","packageManager":"npm","priorityScoreList":[],"projectPublicId":"79f5fe07-5650-42a8-a92c-0ae46036ffc8","projectUrl":"https://app.snyk.io/org/okeamah/project/79f5fe07-5650-42a8-a92c-0ae46036ffc8?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":4,"publishedDate":"2024-07-01T15:29:19.878Z"},"vulns":[]}) --->
#55