From: tb Date: Sun, 2 Jul 2023 03:20:44 +0000 (+0000) Subject: Invert method checks to avoid stupid line breaks X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=25809939e45dbd74b09122e7f266db72da1c4b1e;p=openbsd Invert method checks to avoid stupid line breaks --- diff --git a/lib/libcrypto/ecdsa/ecs_ossl.c b/lib/libcrypto/ecdsa/ecs_ossl.c index 251a938e2df..8614bf19680 100644 --- a/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/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