If an engine comes up explicitely, it must also come down explicitely
authorRichard Levitte <levitte@openssl.org>
Wed, 28 Sep 2016 21:39:18 +0000 (23:39 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 19 Oct 2016 15:44:08 +0000 (17:44 +0200)
commitdd1abd4462e4e4fa84b8f8de2ec70375f9b0e191
tree66ed9bf5494cf999e57f754b5fa43ccd51ffc36e
parente972273194303e15f8dd7ce69dbcfa27cc024e9f
If an engine comes up explicitely, it must also come down explicitely

In apps/apps.c, one can set up an engine with setup_engine().
However, we freed the structural reference immediately, which means
that for engines that don't already have a structural reference
somewhere else (because it's a built in engine), we end up returning
an invalid reference.

Instead, the function release_engine() is added, and called at the end
of the routines that call setup_engine().

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1643)
32 files changed:
apps/apps.c
apps/apps.h
apps/ca.c
apps/cms.c
apps/dgst.c
apps/dhparam.c
apps/dsa.c
apps/dsaparam.c
apps/ec.c
apps/ecparam.c
apps/enc.c
apps/gendsa.c
apps/genpkey.c
apps/genrsa.c
apps/pkcs12.c
apps/pkcs7.c
apps/pkcs8.c
apps/pkey.c
apps/pkeyparam.c
apps/pkeyutl.c
apps/rand.c
apps/req.c
apps/rsa.c
apps/rsautl.c
apps/s_client.c
apps/s_server.c
apps/smime.c
apps/speed.c
apps/spkac.c
apps/srp.c
apps/verify.c
apps/x509.c