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

Call Finalize on Module destroy #164

Merged
merged 3 commits into from
Nov 15, 2022
Merged

Call Finalize on Module destroy #164

merged 3 commits into from
Nov 15, 2022

Conversation

op
Copy link
Contributor

@op op commented Nov 7, 2022

While using softhsm in some tests, I ran into issues while re-using the same pkcs11 context. Calling module.Destroy together with these fixes allow me to use the p11 module (instead of going all in on the raw pkcs11 interface).

  • Returns error from the Module.Destroy in p11. This is an API change. I can remove this if wanted.

  • Calls ctx.Finalize before calling ctx.Destroy in Module.Destroy

This allow a more graceful unloading of modules. I suspect there are multiple reasons why you didn't do this before? At least removing the loaded module from the map should improve a lot.

p11/module.go Outdated
break
}
}
if path == "" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really needed to return an error, or just make this a noop? With the later approach we don't need to change the method's signature

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it works without it too. I've reverted the API change now 👍

@miekg miekg merged commit 5434247 into miekg:master Nov 15, 2022
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.

2 participants