From 1e9445503c3ea65f8c138ab5dc555db0f1db91a7 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sat, 14 Apr 2018 07:18:37 +0000 Subject: Make ENGINE_free() succeed on NULL. Matches OpenSSL's behavior and simplifies the caller side. tested by & ok inoguchi; discussed with schwarze --- src/lib/libcrypto/engine/eng_padlock.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/lib/libcrypto/engine/eng_padlock.c') diff --git a/src/lib/libcrypto/engine/eng_padlock.c b/src/lib/libcrypto/engine/eng_padlock.c index 4f2d426a06..0281ab810c 100644 --- a/src/lib/libcrypto/engine/eng_padlock.c +++ b/src/lib/libcrypto/engine/eng_padlock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_padlock.c,v 1.15 2016/11/04 13:56:05 miod Exp $ */ +/* $OpenBSD: eng_padlock.c,v 1.16 2018/04/14 07:18:37 tb Exp $ */ /* * Support for VIA PadLock Advanced Cryptography Engine (ACE) * Written by Michal Ludvig @@ -108,19 +108,21 @@ #ifdef OPENSSL_NO_DYNAMIC_ENGINE #ifdef COMPILE_HW_PADLOCK -static ENGINE *ENGINE_padlock (void); +static ENGINE *ENGINE_padlock(void); #endif -void ENGINE_load_padlock (void) +void +ENGINE_load_padlock(void) { /* On non-x86 CPUs it just returns. */ #ifdef COMPILE_HW_PADLOCK - ENGINE *toadd = ENGINE_padlock (); - if (!toadd) + ENGINE *toadd = ENGINE_padlock(); + + if (toadd == NULL) return; - ENGINE_add (toadd); - ENGINE_free (toadd); - ERR_clear_error (); + ENGINE_add(toadd); + ENGINE_free(toadd); + ERR_clear_error(); #endif } @@ -203,9 +205,8 @@ ENGINE_padlock(void) { ENGINE *eng = ENGINE_new(); - if (!eng) { + if (eng == NULL) return NULL; - } if (!padlock_bind_helper(eng)) { ENGINE_free(eng); -- cgit v1.2.3-55-g6feb