test: expand key_lifecycle.t with parameter derivation coverage#113
Merged
atoomic merged 1 commit intoMar 18, 2026
Merged
Conversation
Add 22 tests for previously untested _new_key_from_parameters() paths: - Derive q from n/p (BN_div branch) - Derive p from n/q (BN_div branch) - Derive d from p/q (BN_mod_inverse branch) - Private key from n/e/d only (no CRT params — else branch) - Cross-derived key interop (encrypt/decrypt, sign/verify) - Error case: missing n and e Also fixes test plan: skip() reports skipped tests which count toward the total, so plan must always include all tests (9+14+20+2=45).
timlegge
approved these changes
Mar 18, 2026
Member
timlegge
left a comment
There was a problem hiding this comment.
looks fine approved - tested fine against 0.37 as well
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.
What
Add 22 tests covering previously untested
_new_key_from_parameters()code paths.Why
The parameter derivation branches (derive q from n/p, derive p from n/q, derive d from p/q) and the n/e/d-only private key path had zero test coverage. These paths include BN_CTX allocation, BN_div, and BN_mod_inverse operations that should be verified.
New test cases
elsebranch in_new_key_from_parameters()Also fixes test plan:
skip()reports skipped tests which count toward the total, so the plan must be 45 regardless of Bignum availability.Testing
All 266 tests pass on macOS with OpenSSL 3.6.1. Bignum SKIP block ensures graceful degradation when Crypt::OpenSSL::Bignum is not installed.
🤖 Generated with Claude Code