From d8720a8dea3706e98a2a858dafb2c8a88caf0d18 Mon Sep 17 00:00:00 2001 From: tb <> Date: Sun, 2 Jul 2023 03:20:44 +0000 Subject: Invert method checks to avoid stupid line breaks --- src/lib/libcrypto/ecdsa/ecs_ossl.c | 48 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'src/lib/libcrypto/ecdsa') diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index 251a938e2d..8614bf1968 100644 --- a/src/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecs_ossl.c,v 1.37 2023/06/25 19:33:39 tb Exp $ */ +/* $OpenBSD: ecs_ossl.c,v 1.38 2023/07/02 03:20:44 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project */ @@ -528,10 +528,11 @@ ECDSA_SIG * ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey) { - if (eckey->meth->sign_sig != NULL) - return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey); - ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); - return 0; + if (eckey->meth->sign_sig == NULL) { + ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); + return 0; + } + return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey); } int @@ -545,40 +546,43 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey) { - if (eckey->meth->sign != NULL) - return eckey->meth->sign(type, dgst, dlen, sig, siglen, kinv, r, eckey); - ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); - return 0; + if (eckey->meth->sign == NULL) { + ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); + return 0; + } + return eckey->meth->sign(type, dgst, dlen, sig, siglen, kinv, r, eckey); } int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { - if (eckey->meth->sign_setup != NULL) - return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp); - ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); - return 0; + if (eckey->meth->sign_setup == NULL) { + ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); + return 0; + } + return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp); } int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, EC_KEY *eckey) { - if (eckey->meth->verify_sig != NULL) - return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey); - ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); - return 0; + if (eckey->meth->verify_sig == NULL) { + ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); + return 0; + } + return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey); } int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int sig_len, EC_KEY *eckey) { - if (eckey->meth->verify != NULL) - return eckey->meth->verify(type, dgst, dgst_len, - sigbuf, sig_len, eckey); - ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); - return 0; + if (eckey->meth->verify == NULL) { + ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); + return 0; + } + return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len, eckey); } int -- cgit v1.2.3-55-g6feb