summaryrefslogtreecommitdiffstats
path: root/crypto/ecdsa/ecs_sign.c
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2005-05-16 10:11:04 +0000
committerNils Larsch <nils@openssl.org>2005-05-16 10:11:04 +0000
commit9dd84053419aa220b5e66a5f9fcf809dbd6d9369 (patch)
tree7818c598a88a5b457333fd9f5951836fe96834b6 /crypto/ecdsa/ecs_sign.c
parent46a643763de6d8e39ecf6f76fa79b4d04885aa59 (diff)
ecc api cleanup; summary:
- hide the EC_KEY structure definition in ec_lcl.c + add some functions to use/access the EC_KEY fields - change the way how method specific data (ecdsa/ecdh) is attached to a EC_KEY - add ECDSA_sign_ex and ECDSA_do_sign_ex functions with additional parameters for pre-computed values - rebuild libeay.num from 0.9.7
Diffstat (limited to 'crypto/ecdsa/ecs_sign.c')
-rw-r--r--crypto/ecdsa/ecs_sign.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/crypto/ecdsa/ecs_sign.c b/crypto/ecdsa/ecs_sign.c
index ee6aef8010..5143923050 100644
--- a/crypto/ecdsa/ecs_sign.c
+++ b/crypto/ecdsa/ecs_sign.c
@@ -58,27 +58,40 @@
#include <openssl/engine.h>
#endif
-ECDSA_SIG * ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
+ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey)
+{
+ return ECDSA_do_sign_ex(dgst, dlen, NULL, NULL, eckey);
+}
+
+ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dlen,
+ const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey)
{
ECDSA_DATA *ecdsa = ecdsa_check(eckey);
if (ecdsa == NULL)
return NULL;
- return ecdsa->meth->ecdsa_do_sign(dgst, dlen, eckey);
+ return ecdsa->meth->ecdsa_do_sign(dgst, dlen, NULL, NULL, eckey);
}
int ECDSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char
*sig, unsigned int *siglen, EC_KEY *eckey)
{
+ 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, const BIGNUM *r,
+ EC_KEY *eckey)
+{
ECDSA_SIG *s;
- s=ECDSA_do_sign(dgst,dlen,eckey);
+ s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey);
if (s == NULL)
{
*siglen=0;
- return(0);
+ return 0;
}
- *siglen=i2d_ECDSA_SIG(s,&sig);
+ *siglen = i2d_ECDSA_SIG(s, &sig);
ECDSA_SIG_free(s);
- return(1);
+ return 1;
}
int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,