Repository navigation
Conversation
The precomputation runs the private CRT's own frame and validation on a fabricated CRT call: a second frame pushes the CRT's stack arguments, the input and coefficient being the cleared pre and the exponents the factors, so that the validation accepts exactly when p q = n for a valid n. Each factor is then prepared in the narrow workspace at its own width, max(2, ceil(len/8)), and its R^2 mod p exported to pre after the modulus' values; the main workspace gives R^2 mod n, the public precomputation's export writes n and it, and the secret acceptance bit masks all of pre. CrtEntryReady exposes crt_begin_ok and crt_validateStage_ct, which the proof reuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHG7VqNCm5vQWRrXrv5
Member
Author
|
Split by entrypoint at alex's request into #4943 (stacked on #4940). Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the ARMv7 implementation of
vg_rsa_private_precompute(Spec.Rsa.privatePrecomputeContract), verified for correctness and constant time. No Rust caller yet: the Rust switch to the precomputed private-key path comes in a later PR, once every architecture has this function.Design
The function reuses the private CRT's own frame, entry and validation:
The caller's frame is saved and
preis cleared.A second frame pushes a made-up set of CRT stack arguments:
pre;The CRT's validation then accepts exactly when
p q = nfor a validn.Inside the CRT's frame, after the validation:
max(2, ⌈len/8⌉)(Spec.Rsa.primeWords), and itsR² mod pis exported topreafter the modulus' values;R² mod n, and the public precomputation's export (precomputeOut) writesnandR² mod n;maskOutput) masks all ofpre.The only branch tests the public modulus.
The stack use is 168 bytes.
Files
Impl/Bignum/Arm/PrivPreFn.lean: the code.Proof/Bignum/Arm/PrivPre{Enter,Phase,Modulus,Frame,Fn}.lean: correctness.Proof/Bignum/Arm/PrivPre{BlocksCT,ValidCT,FrameCT,Verified}.lean: constant time andVerified.Artifacts/Rsa/Arm.lean: registration.crates/verified-garbage-asm-arm: regenerated (full emitter).Changes to existing proofs
These are not TCB or Spec changes.
Proof/Bignum/Arm/CrtEntryReady.leannow makes public two sections it already had,crt_begin_okandcrt_validateStage_ct, and three of its imports, so that this proof can reuse them.Checks
check_lean_public_imports.pypasses on the changed modules.Emit.lean --checkpasses.cargo fmt --checkpasses.cargo clippy --target armv7-unknown-linux-gnueabihf -D warningspasses.No benchmark run: nothing calls the new function yet, so no speed changes.
Generated by Claude Code