Skip to content

Conversation

@Koan-Bot
Copy link
Contributor

Summary

  • Fix self-referencing typo in new_public_key POD: "use_pkcs1_pss_padding (or use_pkcs1_pss_padding)" → single reference with proper C<> formatting
  • Fix "Version 0.38" reference (unreleased version) → "On OpenSSL 3.x" to accurately describe automatic padding selection
  • Fix is_private POD: "false if it is private only" → "false if it is public only"
  • Fix BIGNUM memory leak in generate_key on OpenSSL 3.x: e = NULL; BN_free(e) was a no-op (BN_free(NULL) does nothing), leaking the BIGNUM allocated by BN_new(). The set1 semantics of EVP_PKEY_CTX_set1_rsa_keygen_pubexp copy the value internally, so the caller must still free the original.

Changes

  • RSA.pm — 3 POD documentation fixes
  • RSA.xs — Remove e = NULL before BN_free(e) in OpenSSL 3.x generate_key path

Test plan

  • make test — all 214 tests pass
  • Verified set1 copy semantics: caller retains ownership, must free
  • Consistent with OpenSSL 1.x path (line 518) which correctly calls BN_free(e)

🤖 Generated with Claude Code

- Fix self-referencing typo in new_public_key docs:
  "use_pkcs1_pss_padding (or use_pkcs1_pss_padding)" → single reference
  with proper C<> POD formatting
- Fix "Version 0.38" reference (unreleased) → "On OpenSSL 3.x"
  to accurately describe when automatic padding selection applies
- Fix is_private docs: "false if it is private only" → "public only"
- Fix BIGNUM memory leak in generate_key on OpenSSL 3.x:
  `e = NULL; BN_free(e)` was a no-op, leaking the BIGNUM allocated
  by BN_new(). The set1 semantics of EVP_PKEY_CTX_set1_rsa_keygen_pubexp
  copy the value, so the caller must still free the original.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic requested a review from timlegge February 11, 2026 04:00
=item is_private

Return true if this is a private key, and false if it is private only.
Return true if this is a private key, and false if it is public only.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

CHECK_OPEN_SSL(EVP_PKEY_generate(ctx, &rsa) == 1);
CHECK_OPEN_SSL(rsa != NULL);

e = NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch too, why setting it to null before calling free?

Copy link
Member

@timlegge timlegge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me

@atoomic atoomic marked this pull request as ready for review February 11, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants