On Mon, 2009-09-14 at 23:13 +0200, David Woodhouse via RT wrote:
> For now, let's at least address the major disadvantage of the engine,
> which is that it doesn't even get _used_ unless someone registers it.

Updated patch, following the discussion in PR#2305:

On Tue, 2010-07-20 at 00:59 +0200, Stephen Henson via RT wrote:
> The change suggested in PR#2045 has problems if the ENGINE_add() call
> fails: it ends up adding a reference to a freed up ENGINE which is
> likely to subsequently contain garbage and generally spoil your whole
> day.
> 
> This will happen if an ENGINE with the same name is added multiple
> times, for example different libraries, in your case curl and mod_ssl.
> ...
> 1. The patch in PR#2045 should check the return value of ENGINE_add()
> so you now have:
> 
> if (ENGINE_add(toadd))
>      ENGINE_register_complete(toadd);

-- 
David Woodhouse                            Open Source Technology Centre
david.woodho...@intel.com                              Intel Corporation

Index: crypto/engine/eng_aesni.c
===================================================================
RCS file: /home/dwmw2/openssl-cvs/openssl/crypto/engine/eng_aesni.c,v
retrieving revision 1.7
diff -u -p -r1.7 eng_aesni.c
--- crypto/engine/eng_aesni.c	22 May 2010 00:20:42 -0000	1.7
+++ crypto/engine/eng_aesni.c	20 Jul 2010 08:11:06 -0000
@@ -104,7 +104,8 @@ void ENGINE_load_aesni (void)
 	ENGINE *toadd = ENGINE_aesni();
 	if (!toadd)
 		return;
-	ENGINE_add (toadd);
+	if (ENGINE_add (toadd))
+		ENGINE_register_complete (toadd);
 	ENGINE_free (toadd);
 	ERR_clear_error ();
 #endif

Reply via email to