ellswift: fix overflow flag handling in secp256k1_ellswift_xdh#1821
ellswift: fix overflow flag handling in secp256k1_ellswift_xdh#1821SHAKE256 wants to merge 2 commits intobitcoin-core:masterfrom
Conversation
The secp256k1_ellswift_xdh function uses overflow = secp256k1_scalar_is_zero(&s) which overwrites the overflow flag from the preceding secp256k1_scalar_set_b32 call. This means secret keys >= the curve order are silently accepted (reduced mod n) instead of being rejected. The fix changes = to |=, matching the correct pattern already used in secp256k1_ecdh (main_impl.h, line 51). The ECDH module's test suite explicitly tests overflow rejection (passes secp256k1_group_order_bytes as a key and checks the function returns 0). The ellswift test suite has no corresponding test, which is why this went undetected.
|
Hi, AFK right now due to Fasnacht. Today will write the test. Greetings |
|
CI failures seem to be unrelated. I emptied the GitHub Actions cache and triggered a rebuild. Let's see if this fixes CI. |
Unfortunately, no. @hebasto Any ideas? |
No idea, at this moment. I'll look into it thoroughly tomorrow. |
I've reviewed the CI code. One line looks suspicious... |
|
@real-or-random Could you update your comment to use my new username? |
I assume you want it to disappear forever, so I'll delete my comment. (Editing keeps a history.) Let me see. |
ed02466 ci: Load Docker image by ID from builder step (Hennadii Stepanov) Pull request description: Fixes loading wrong Docker images. For instance, see #1821 (comment). ACKs for top commit: real-or-random: utACK ed02466 Tree-SHA512: 4de31bebe64d2b2adfbc5e1f2cbdea5e609a5640d17949bfe5aef9071948693ae7d8ac81772dd9620b101a72b553f38511b882119987e3c8342b6544571eca93
|
I'm suggesting to rebase this PR. |
|
That's not that easy @hebasto . Both are in master. I think it's fine how it is. I can do but then this will have to be closed, new branch, push, create PR... I will not keep my repository after the merge so the whole process would be just waste. |
|
|
Btw, you might also want to change commits author's name. |
I think there's a misunderstanding. It's just two commands: :) (assuming See also https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes for background. But if you really don't want to do it, someone else could take over and open a new PR. In general, I think we'd want to avoid merging PRs with failing CI. I don't think it's a super strict rule, but we should follow it unless there's some good reason not to. |
The secp256k1_ellswift_xdh function uses overflow = secp256k1_scalar_is_zero(&s) which overwrites the overflow flag from the preceding secp256k1_scalar_set_b32 call. This means secret keys >= the curve order are silently accepted (reduced mod n) instead of being rejected.
The fix changes = to |=, matching the correct pattern already used in secp256k1_ecdh (main_impl.h, line 51).
The ECDH module's test suite explicitly tests overflow rejection (passes secp256k1_group_order_bytes as a key and checks the function returns 0). The ellswift test suite has no corresponding test, which is why this went undetected.
Previous PR to the wrong repository: bitcoin/bitcoin#34558