-
Notifications
You must be signed in to change notification settings - Fork 109
refactor: use deterministic k-value for ECDSA signing to fix bad-protx-sig error #303
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 all commits
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -276,6 +276,11 @@ ECDSA.prototype.sign = function () { | |||||||||||||||||||
| return this; | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ECDSA.prototype.signDeterminicticK = function () { | ||||||||||||||||||||
| this.deterministicK(); | ||||||||||||||||||||
| return this.sign(); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+279
to
+282
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. 🟡 Suggestion: No tests added for the new deterministic signing method The PR description states "additional test cases were added to validate deterministic signing behavior", but grep of source: ['claude'] 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. 💬 Nitpick: Missing trailing semicolon and JSDoc on the new prototype method Compared with the adjacent
Suggested change
source: ['claude'] |
||||||||||||||||||||
|
|
||||||||||||||||||||
| ECDSA.prototype.signRandomK = function () { | ||||||||||||||||||||
| this.randomK(); | ||||||||||||||||||||
| return this.sign(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -65,7 +65,7 @@ Message.prototype._sign = function _sign(privateKey) { | |||||
| ecdsa.hashbuf = hash; | ||||||
| ecdsa.privkey = privateKey; | ||||||
| ecdsa.pubkey = privateKey.toPublicKey(); | ||||||
| ecdsa.signRandomK(); | ||||||
| ecdsa.signDeterminicticK(); | ||||||
|
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. 🔴 Blocking: Caller in
Suggested change
source: ['claude'] |
||||||
| ecdsa.calci(); | ||||||
| return ecdsa.sig; | ||||||
| }; | ||||||
|
Comment on lines
65
to
71
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. 🔴 Blocking: Change does not address The PR's stated purpose is to fix source: ['claude', 'codex']
Comment on lines
65
to
71
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. 🟡 Suggestion: Behavior change in Before this PR, source: ['claude'] |
||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
🔴 Blocking: Method name is misspelled:
signDeterminicticK(extra 'tic') exposed on public ECDSA APIECDSA.prototype.signDeterminicticKcontains an extra 'tic' — the intended name (per the PR title, commit message c5c63cc, and PR description) issignDeterministicK.ECDSAis exported asbitcore.crypto.ECDSAon the library's public surface, so this typo permanently misnames a public method. Any downstream caller following the PR description and invokingecdsa.signDeterministicK()will receiveTypeError: ecdsa.signDeterministicK is not a functionand may fall back to ad-hoc nonce generation — re-introducing the very RNG-reuse risk this PR sets out to mitigate. The misspelling is also propagated to the only in-tree caller at lib/message.js:68, which is why local tests didn't catch it. The closing brace also lacks a trailing semicolon (inconsistent with the adjacentsignRandomKdefinition on lines 284–287 and likely to failnpm run lint).source: ['claude', 'codex']