summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-07-02 03:20:44 +0000
committertb <>2023-07-02 03:20:44 +0000
commitd8720a8dea3706e98a2a858dafb2c8a88caf0d18 (patch)
treee112cefd2317a919f1c47469b863db070ca2c62c /src
parent89f22c5e5bcb6134af6bdd052ae173fbc385bd03 (diff)
downloadopenbsd-d8720a8dea3706e98a2a858dafb2c8a88caf0d18.tar.gz
openbsd-d8720a8dea3706e98a2a858dafb2c8a88caf0d18.tar.bz2
openbsd-d8720a8dea3706e98a2a858dafb2c8a88caf0d18.zip
Invert method checks to avoid stupid line breaks
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c48
1 files changed, 26 insertions, 22 deletions
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 @@
1/* $OpenBSD: ecs_ossl.c,v 1.37 2023/06/25 19:33:39 tb Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.38 2023/07/02 03:20:44 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -528,10 +528,11 @@ ECDSA_SIG *
528ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv, 528ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv,
529 const BIGNUM *rp, EC_KEY *eckey) 529 const BIGNUM *rp, EC_KEY *eckey)
530{ 530{
531 if (eckey->meth->sign_sig != NULL) 531 if (eckey->meth->sign_sig == NULL) {
532 return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey); 532 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED);
533 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); 533 return 0;
534 return 0; 534 }
535 return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey);
535} 536}
536 537
537int 538int
@@ -545,40 +546,43 @@ int
545ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char *sig, 546ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
546 unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey) 547 unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey)
547{ 548{
548 if (eckey->meth->sign != NULL) 549 if (eckey->meth->sign == NULL) {
549 return eckey->meth->sign(type, dgst, dlen, sig, siglen, kinv, r, eckey); 550 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED);
550 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); 551 return 0;
551 return 0; 552 }
553 return eckey->meth->sign(type, dgst, dlen, sig, siglen, kinv, r, eckey);
552} 554}
553 555
554int 556int
555ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) 557ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
556{ 558{
557 if (eckey->meth->sign_setup != NULL) 559 if (eckey->meth->sign_setup == NULL) {
558 return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp); 560 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED);
559 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); 561 return 0;
560 return 0; 562 }
563 return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp);
561} 564}
562 565
563int 566int
564ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig, 567ECDSA_do_verify(const unsigned char *dgst, int dgst_len, const ECDSA_SIG *sig,
565 EC_KEY *eckey) 568 EC_KEY *eckey)
566{ 569{
567 if (eckey->meth->verify_sig != NULL) 570 if (eckey->meth->verify_sig == NULL) {
568 return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey); 571 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED);
569 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); 572 return 0;
570 return 0; 573 }
574 return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey);
571} 575}
572 576
573int 577int
574ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, 578ECDSA_verify(int type, const unsigned char *dgst, int dgst_len,
575 const unsigned char *sigbuf, int sig_len, EC_KEY *eckey) 579 const unsigned char *sigbuf, int sig_len, EC_KEY *eckey)
576{ 580{
577 if (eckey->meth->verify != NULL) 581 if (eckey->meth->verify == NULL) {
578 return eckey->meth->verify(type, dgst, dgst_len, 582 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED);
579 sigbuf, sig_len, eckey); 583 return 0;
580 ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); 584 }
581 return 0; 585 return eckey->meth->verify(type, dgst, dgst_len, sigbuf, sig_len, eckey);
582} 586}
583 587
584int 588int