Repository navigation
Spec: retire the Api of vg_rsa_pkcs1_encrypt_precomputed - #4377
Merged
Merged
Conversation
No Rust code calls it any more: since #4355, encryption calls vg_rsa_pkcs1_encrypt_random, which calls vg_rsa_pkcs1_encrypt_precomputed (and its _adx, _ifma and _umaal variants). So it becomes an internal function: its signature and contract move from Spec/RsaPkcs1Enc/Precomputed.lean, which is deleted, to Proof/RsaPkcs1Enc/Contract.lean, untrusted, and the emitter writes it under internal/. Its registrations go, and so does what only they used: the dead encryptSig, encryptContract, encryptSummary and encryptSafety of Spec/RsaPkcs1Enc/Contract.lean (left from vg_rsa_pkcs1_encrypt's retirement), RISC-V's code_verified and satisfiability witness, and x86's code_sp. The other architectures' code_verified stay: the proofs of vg_rsa_pkcs1_encrypt_random call it by it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHHyzwQJxwPzPq89t3z
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.
Part of #4139 (finding 8: RSAES-PKCS1-v1_5 padding string)
This retires what #4355 left without a Rust caller, as #4303 did for RSA.
Trust change (removal only)
This PR removes trusted definitions from
Spec/and adds none. No contract that remains is weakened.Spec/RsaPkcs1Enc/Precomputed.leanis deleted. It heldencryptPrecomputedSig,encryptPrecomputedContractandencryptPrecomputedApi.vg_rsa_pkcs1_encrypt_precomputedor its_adx,_ifmaand_umaalvariants any more. Only the verifiedvg_rsa_pkcs1_encrypt_randomcalls them.Proof/RsaPkcs1Enc/Contract.lean, which is untrusted, and the emitter now writes it underinternal/.Spec/RsaPkcs1Enc/Contract.lean:encryptSig,encryptContract,encryptSummaryandencryptSafety.vg_rsa_pkcs1_encrypt's earlier retirement, and only the precomputed spec used them.Spec/RsaPkcs1Enc/Random.leanfor encryption.Spec/RsaPkcs1Enc/Random.leanchanges only its import and its docstring.Spec/RsaPkcs1Enc/Contract.leandirectly.PSare secret; and which of the tape's octets were zero may affect timing.encryptRandomContractitself is unchanged.Registrations and proofs
encryptPrecomputedApiartifacts are removed, inArtifacts/RsaPkcs1Enc/{X86,PPC64LE,RISCV64}.leanandGeneric/.../{X86_64,AArch64,Arm}/RsaPkcs1Enc.lean. As in Spec: retire the Apis of vg_rsa_private_checked, vg_rsa_public_precomputed_checked and vg_rsa_check_crt_key #4303, the callee needs no registration of its own: the emitter emits it fromvg_rsa_pkcs1_encrypt_random's code.Spec.RsaPkcs1Enc.encryptPrecomputed*toProof.RsaPkcs1Enc.encryptPrecomputed*.Enc.code_verified, with itssat,satStateandsat_args.Pc.code_sp.code_verifiedstay, because theirRndproofs call the precomputed function by that theorem.Generated code
On each target,
rsa_pkcs1_enc.rs/.slose the publicvg_rsa_pkcs1_encrypt_precomputed*functions, which now appear underinternal/, and eachrsa.rsgains theirmodlines.Overlap: the open dead-code PRs (#4349, #4354 and #4362) don't touch
RsaPkcs1Enc, and #4344 (RSA) has merged.Testing
All of these ran locally, on current
main(64c4f33):lake build, thenEmit.lean. Its audits passed: standard axioms only, and everyVG.Specdefinition is inSpec/.Static checksjob, includingcheck_variants.py.check_lean_public_imports.py --base origin/mainon the 36 edited modules.cargo fmt --checkandcargo clippy --all-targets -D warnings.cargo testwith Wycheproof.No Rust changed, and the emitted code of every function still called is unchanged. Nothing here can affect speed, so there is no benchmark run.
Generated by Claude Code