Skip to content

Release native verify callback when SSLEngine is closed#180

Merged
douzzer merged 3 commits intowolfSSL:masterfrom
cconlon:SSLEngineGCFix
Mar 30, 2024
Merged

Release native verify callback when SSLEngine is closed#180
douzzer merged 3 commits intowolfSSL:masterfrom
cconlon:SSLEngineGCFix

Conversation

@cconlon
Copy link
Copy Markdown
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
@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