[openssl-users] Invalid ref coiunt for an openssl engine

Oleg Gryb oleg_gryb at yahoo.com
Fri Dec 4 19:50:49 UTC 2015

I'm trying to create a dynamic openssl engine, activate it from a client's code and then de-activate to do some important cleanup through the engine's "finish" function, when it's not needed anymore.
I use ENGINE_finish(e) call from a client's side to do that, but that function will call engine's "finish" only if ref count to the engine's object is equal to 1. In my case the ref count is 3 and I don't understand why it's happening since the mentioned client was the only one who has used the engine.
I've stripped out the client's and engine's code and put it here: http://stackoverflow.com/questions/34079310/why-ref-count-for-an-openssl-engine-is-so-high
As a work around I use the code below on the client's side:
   while (e->funct_ref) {

I got a feeling that this code could be unsafe and want to understand what the right way of fixing the problem is.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20151204/6d2c4450/attachment.html>

More information about the openssl-users mailing list