Skip to content
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

Release native verify callback when SSLEngine is closed #180

Merged
merged 3 commits into from
Mar 30, 2024

Conversation

cconlon
Copy link
Member

@cconlon cconlon commented Mar 26, 2024

This PR modifies SSLEngine so that it explicitly releases the native wolfSSL verify callback when the SSLEngine enters the CLOSED state. Once CLOSED, an SSLEngine will not be reused. From the Javadocs for SSLEngine, "Once an engine is closed, it is not reusable: a new SSLEngine must be created."

The native verify callback is stored as a JNI global variable, which can hold up garbage collection if not explicitly released. Prior to this PR it was being released/freed when the native WOLFSSL structure was freed, but with the changes in #159, the circular reference between SSLEngine and WolfSSLInternalVerifyCallback prevented SSLEngine objects from being garbage collected.

@cconlon cconlon assigned cconlon and wolfSSL-Bot and unassigned cconlon Mar 26, 2024
@douzzer douzzer merged commit 4d556fb into wolfSSL:master Mar 30, 2024
36 checks passed
@cconlon cconlon changed the title Release native verify callback with SSLEngine is closed Release native verify callback when SSLEngine is closed Apr 1, 2024
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