eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Possibly missing calls to ENGINE_free in net__load_engine on error condition #3034

Open Kitty-Hawk1 opened 5 months ago

Kitty-Hawk1 commented 5 months ago

Linux - 4e6fbae45ce424d2204c8b5d51b37dc5a08013bc. But seen on master

When using an openssl engine with a secure element, it has been noticed that very occasionally it fails, and after which mosquitto can't be used as the openssl engine thinks it's already in use.

Not familiar with opesnssl engine but I think to make it recover, the following is required:

in net__load_engine()

calls ENGINE_init << if the call fails it should call ENGINE_free before returning

similarly ENGINE_load_private_key << if the call fails it should call ENGINE_free before returning

and SSL_CTX_use_PrivateKey << if the call fails it should call ENGINE_free before returning

and finally ENGINE_ctrl_cmd << if the call fails it should call ENGINE_free before returning

Many thanks.