summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-25 21:27:03 +0000
committertb <>2023-12-25 21:27:03 +0000
commitf91c8aaaffa17b5b5f5799a50c9c6a13878acba8 (patch)
treeeebe11b8a970d81302071eec896729e39114c56a /src/lib
parent72e7392b981301719f6e0c2310ef0290b821e603 (diff)
downloadopenbsd-f91c8aaaffa17b5b5f5799a50c9c6a13878acba8.tar.gz
openbsd-f91c8aaaffa17b5b5f5799a50c9c6a13878acba8.tar.bz2
openbsd-f91c8aaaffa17b5b5f5799a50c9c6a13878acba8.zip
Simplify EVP_PKEY_up_ref()
There is no need for a local variable and a ternary operator here. ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index dce4dbd5a6..2b409220bb 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.40 2023/12/25 21:25:24 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.41 2023/12/25 21:27:03 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -213,8 +213,7 @@ EVP_PKEY_new(void)
213int 213int
214EVP_PKEY_up_ref(EVP_PKEY *pkey) 214EVP_PKEY_up_ref(EVP_PKEY *pkey)
215{ 215{
216 int refs = CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); 216 return CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY) > 0;
217 return ((refs > 1) ? 1 : 0);
218} 217}
219 218
220/* Setup a public key ASN1 method from a NID or a string. 219/* Setup a public key ASN1 method from a NID or a string.