summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ecdsa_sign.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-10-28 17:57:51 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-12-09 23:09:19 +0100
commita200a817add039d0515e6ecf94237b634819687d (patch)
tree8a968313e9398c4dfd7d462293888e586ce2325e /crypto/ec/ecdsa_sign.c
parentEngine EC_KEY_METHOD functionality. (diff)
downloadopenssl-a200a817add039d0515e6ecf94237b634819687d.tar.xz
openssl-a200a817add039d0515e6ecf94237b634819687d.zip
Top level ECDSA sign/verify redirection.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/ec/ecdsa_sign.c')
-rw-r--r--crypto/ec/ecdsa_sign.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/crypto/ec/ecdsa_sign.c b/crypto/ec/ecdsa_sign.c
index f3c6d7871c..aeccda74a2 100644
--- a/crypto/ec/ecdsa_sign.c
+++ b/crypto/ec/ecdsa_sign.c
@@ -82,20 +82,14 @@ int ECDSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char
return ECDSA_sign_ex(type, dgst, dlen, sig, siglen, NULL, NULL, eckey);
}
-int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char
- *sig, unsigned int *siglen, const BIGNUM *kinv,
+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)
{
- ECDSA_SIG *s;
- RAND_seed(dgst, dlen);
- s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey);
- if (s == NULL) {
- *siglen = 0;
- return 0;
- }
- *siglen = i2d_ECDSA_SIG(s, &sig);
- ECDSA_SIG_free(s);
- return 1;
+ if (eckey->meth->sign)
+ return eckey->meth->sign(type, dgst, dlen, sig, siglen, kinv, r, eckey);
+ ECerr(EC_F_ECDSA_SIGN_EX, EC_R_OPERATION_NOT_SUPPORTED);
+ return 0;
}
int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,