Add wrapper for wolfSSL_SNI_GetFromBuffer()#339
Open
cconlon wants to merge 1 commit intowolfSSL:masterfrom
Open
Add wrapper for wolfSSL_SNI_GetFromBuffer()#339cconlon wants to merge 1 commit intowolfSSL:masterfrom
cconlon wants to merge 1 commit intowolfSSL:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a JNI wrapper for the native wolfSSL_SNI_GetFromBuffer() function, enabling extraction of Server Name Indication (SNI) from raw ClientHello buffers without requiring an SSL context or session. This is useful for SNI-based routing scenarios where the server needs to inspect the SNI before establishing the TLS session.
Changes:
- Added
WolfSSL.getSNIFromBuffer()static native method for extracting SNI from ClientHello buffers - Implemented corresponding JNI native function with proper parameter validation and error handling
- Added comprehensive JUnit test with hand-crafted TLS 1.2 ClientHello message
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/java/com/wolfssl/WolfSSL.java | Added public static native method getSNIFromBuffer() with JavaDoc documentation |
| native/com_wolfssl_WolfSSL.h | Added JNI function declaration for the new method |
| native/com_wolfssl_WolfSSL.c | Implemented JNI wrapper with parameter validation, memory management, and exception handling for both HAVE_SNI and non-SNI builds |
| src/test/com/wolfssl/test/WolfSSLTest.java | Added test method that constructs a minimal TLS 1.2 ClientHello with SNI and validates extraction, including null parameter tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR adds a static
WolfSSL.getSNIFromBuffer()method, wrapping nativewolfSSL_SNI_GetFromBuffer(), allowing SNI extraction from a raw ClientHello buffer without requiring an SSL context or session.Also adds JUnit test with mock TLS 1.2 ClientHello containing SNI.
ZD 21200