-
Notifications
You must be signed in to change notification settings - Fork 30
fix: remove stale BUGS POD about generate_key() leak #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
atoomic
merged 1 commit into
cpan-authors:main
from
atoomic:koan.atoomic/remove-stale-bugs-pod
Mar 15, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this was done on purpose, investigate why that choice was made
is it sill a problem today?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did it reference more than 512 bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. The BUGS section was added in v0.08 (April 2001) as a generic "small memory leaks in functions" note. In v0.16 (June 2002, Ian Robertson), it was narrowed to "generating new keys of more than 512 bits."
Why it was done on purpose: The pre-0.9.8 code path used
RSA_generate_key()and never freed the BIGNUM exponenteafterward — a real leak. The "512 bits" threshold was likely when the leak became noticeable (larger keys = more internal allocations).Is it still a problem today? No. I verified empirically: generating 1000 × 2048-bit keys shows flat RSS after initial OpenSSL warm-up. The leak existed in the
< 0x00908000code path, which is dead code on any OpenSSL built in the last 15+ years. The modern paths (both>= 0x00908000and>= 0x30000000) properly freeeviaBN_free()(the 3.x path was fixed in PR #78).That's why this PR removes the note — it documents a bug that no longer exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "512 bits" threshold comes from the era (2001-2002) when 512-bit RSA was the practical minimum. The underlying bug was a BIGNUM leak in
RSA_generate_key()(pre-0.9.8 API) — the exponentewas never freed. Larger keys made the leak more visible because OpenSSL allocated more internal state during generation.On any OpenSSL >= 0.9.8 (released 2005), this code path is dead — the modern
RSA_generate_key_ex()and OpenSSL 3.xEVP_PKEY_keygen()paths handle cleanup properly.