fix: remove public param from rsa_crypt, extract check_max_message_length#167
Closed
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Closed
fix: remove public param from rsa_crypt, extract check_max_message_length#167toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
toddr-bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
…ngth The `public` parameter in rsa_crypt() was only used to decide whether to run plaintext length pre-validation. This refactor: - Extracts pre-validation into a standalone check_max_message_length() static function, called directly from encrypt() and private_encrypt() - Removes the now-unnecessary `public` parameter from rsa_crypt() - Keeps OAEP overhead as the fixed SHA-1 value (size - 42) since this module never sets EVP_PKEY_CTX_set_rsa_oaep_md() — OpenSSL always uses SHA-1 for OAEP regardless of hashMode - Fixes C89 compliance: moves `int size` declaration to function top and assigns in the #else block to avoid declaration-after-statement Closes cpan-authors#165 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Closing #165 is fixed |
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.
Summary
Refactors
rsa_crypt()to remove the now-unnecessarypublicparameter by extracting plaintext length pre-validation into a standalonecheck_max_message_length()static function called directly fromencrypt()andprivate_encrypt(). Keeps OAEP overhead as the fixed SHA-1 value (size - 42) since this module never callsEVP_PKEY_CTX_set_rsa_oaep_md(). Also fixes a C89 declaration-after-statement violation in the pre-3.x code path.Closes #165
Changes
check_max_message_length()as a static function with correct SHA-1 OAEP overheadpublicparameter fromrsa_crypt()signature and all call sitesencrypt()andprivate_encrypt()XS entry pointsint sizedeclared at function top, assigned in#elseblockTest plan
z_kwalitee.tauthor test unrelated failure)t/crypto.tandt/error.tcontinue to use correctsize - 42valuest/padding.tOAEP pad value remains 42 for all hash modesGenerated by Kōan /implement
Quality Report
Changes: 1 file changed, 44 insertions(+), 35 deletions(-)
Code scan: clean
Tests: failed (18 Failed, 1 test)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline