Constant-time impl for part (but not all) of PosInt::invert_vartime#153
Constant-time impl for part (but not all) of PosInt::invert_vartime#153brian-pane wants to merge 2 commits intoctz:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
- Coverage 99.76% 99.76% -0.01%
==========================================
Files 184 184
Lines 50832 50843 +11
==========================================
+ Hits 50714 50723 +9
- Misses 118 120 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The performance regression reported by CodSpeed seems to be unrelated. It happens only in the libcrux ML-KEM test, and based on my reading of the code and CodSpeed's flamegraphs, that test doesn't appear to have any dependency on |
I just rebased, and the CodSpeed test is passing now. |
| let mask = mask_bit << 63; | ||
| let mask = mask | mask.saturating_sub(1); |
There was a problem hiding this comment.
On x86_64, rustc+llvm generates a cmov operation for the saturating_sub.
On Aarch64, it generates a csel operation. (Compiler Explorer)
As far as I can tell, both those instructions should run in constant time, independent of their inputs. But if there's a better idiom for "sign-extend this bit to fill 64 bits," I'm happy to switch to that.
No description provided.