-/* $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
*/
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
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