64 static ECDSA_SIG *ecdsa_do_sign(
const unsigned char *dgst,
int dlen,
68 static int ecdsa_do_verify(
const unsigned char *dgst,
int dgst_len,
72 "OpenSSL ECDSA method",
86 return &openssl_ecdsa_meth;
93 BIGNUM *
k = NULL, *r = NULL, *order = NULL, *
X = NULL;
119 if (!k || !r || !order || !X)
151 if (!
BN_add(k, k, order))
goto err;
153 if (!
BN_add(k, k, order))
goto err;
156 if (!
EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx))
164 tmp_point, X, NULL, ctx))
170 #ifndef OPENSSL_NO_EC2M
174 tmp_point, X, NULL, ctx))
214 if (tmp_point != NULL)
222 static ECDSA_SIG *ecdsa_do_sign(
const unsigned char *dgst,
int dgst_len,
226 BIGNUM *kinv=NULL, *s, *m=NULL,*tmp=NULL,*order=NULL;
238 if (group == NULL || priv_key == NULL || ecdsa == NULL)
268 if (8 * dgst_len > i)
269 dgst_len = (i + 7)/8;
276 if ((8 * dgst_len > i) && !
BN_rshift(m, m, 8 - (i & 0x7)))
283 if (in_kinv == NULL || in_r == NULL)
302 if (!
BN_mod_mul(tmp, priv_key, ret->
r, order, ctx))
321 if (in_kinv != NULL && in_r != NULL)
353 static int ecdsa_do_verify(
const unsigned char *dgst,
int dgst_len,
358 BIGNUM *order, *u1, *u2, *m, *
X;
414 if (8 * dgst_len > i)
415 dgst_len = (i + 7)/8;
422 if ((8 * dgst_len > i) && !
BN_rshift(m, m, 8 - (i & 0x7)))
453 point, X, NULL, ctx))
459 #ifndef OPENSSL_NO_EC2M
463 point, X, NULL, ctx))