diff options
author | 2018-08-24 19:25:31 +0000 | |
---|---|---|
committer | 2018-08-24 19:25:31 +0000 | |
commit | 19166cdd9eb4d39c19693cfb1e8d47c7855dc1f3 (patch) | |
tree | ca9b6187b356d473f5082f01ef6afe0c308aa3fb | |
parent | Document new prototype and return values of X509_OBJECT_up_ref_count() (diff) | |
download | wireguard-openbsd-19166cdd9eb4d39c19693cfb1e8d47c7855dc1f3.tar.xz wireguard-openbsd-19166cdd9eb4d39c19693cfb1e8d47c7855dc1f3.zip |
In ENGINE_up_ref(), check return value of CRYPTO_add() and report
failure accordingly.
ok jsing
-rw-r--r-- | lib/libcrypto/engine/eng_list.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libcrypto/engine/eng_list.c b/lib/libcrypto/engine/eng_list.c index 8bb1bc58f26..134866d2c69 100644 --- a/lib/libcrypto/engine/eng_list.c +++ b/lib/libcrypto/engine/eng_list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eng_list.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: eng_list.c,v 1.23 2018/08/24 19:25:31 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -373,10 +373,12 @@ ENGINE_by_id(const char *id) int ENGINE_up_ref(ENGINE *e) { + int refs; + if (e == NULL) { ENGINEerror(ERR_R_PASSED_NULL_PARAMETER); return 0; } - CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE); - return 1; + refs = CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE); + return refs > 1 ? 1 : 0; } |