Refactor initialization of custom OpenSSL BIO#16651
Merged
straight-shoota merged 7 commits intocrystal-lang:masterfrom Feb 12, 2026
Merged
Refactor initialization of custom OpenSSL BIO#16651straight-shoota merged 7 commits intocrystal-lang:masterfrom
straight-shoota merged 7 commits intocrystal-lang:masterfrom
Conversation
Properly declare a BIO id with correct flag types instead of hardcording 0xFF and enabling all the type flags.
Because Box(Reference) merely casts the reference as a void pointer so we end up saving the same pointer to IO twice.
straight-shoota
approved these changes
Feb 10, 2026
Collaborator
Author
|
Just added: some BIO methods can fail. That should never happen, but something may have registered 127 custom BIOs or we could reach OOM when calling |
straight-shoota
approved these changes
Feb 10, 2026
ysbaddaden
added a commit
to ysbaddaden/crystal
that referenced
this pull request
Feb 10, 2026
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.
Properly initializes the custom BIO by asking libcrypto for an available BIO identifier and declaring the actual BIO types (SOURCE SINK, DESCRIPTOR) instead of enabling all flags and hardcoding an arbitrary identifier.
Implements
BIO_C_GET_FDwhen the underlying IO is a file descriptor since we declare the BIO as being a DESCRIPTOR.Also fixes
Crystal::BIO#initializethat stored the boxed IO, butBox.box(IO)merely castsIOas aVoid*so we end up storing the same pointer to IO twice.Follow up to #16640.
Extracted from #16642.