R3410_ec_params *params = gost_nid2params(nid);
EC_GROUP *grp = NULL;
EC_POINT *P = NULL;
- BIGNUM *p = NULL, *q = NULL, *a = NULL, *b = NULL, *x = NULL, *y = NULL;
+ BIGNUM *p = NULL, *q = NULL, *a = NULL, *b = NULL, *x = NULL, *y = NULL, *cofactor = NULL;
BN_CTX *ctx;
int ok = 0;
x = BN_CTX_get(ctx);
y = BN_CTX_get(ctx);
q = BN_CTX_get(ctx);
- if (!p || !a || !b || !x || !y || !q) {
+ cofactor = BN_CTX_get(ctx);
+ if (!p || !a || !b || !x || !y || !q || !cofactor) {
GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_MALLOC_FAILURE);
goto end;
}
if (!BN_hex2bn(&p, params->p)
|| !BN_hex2bn(&a, params->a)
- || !BN_hex2bn(&b, params->b)) {
+ || !BN_hex2bn(&b, params->b)
+ || !BN_hex2bn(&cofactor, params->cofactor) ) {
GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
goto end;
}
goto end;
}
- if (!EC_GROUP_set_generator(grp, P, q, NULL)) {
+ if (!EC_GROUP_set_generator(grp, P, q, cofactor)) {
GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
goto end;
}
BIGNUM *r = NULL, *s = NULL, *X = NULL, *tmp = NULL, *tmp2 = NULL,
*k = NULL, *e = NULL;
- const BIGNUM *new_r = NULL, *new_s = NULL;
+ BIGNUM *new_r = NULL, *new_s = NULL;
EC_POINT *C = NULL;
BN_CTX *ctx;
}
while (BN_is_zero(s));
- DSA_SIG_get0(newsig, &new_r, &new_s);
new_s = BN_dup(s);
new_r = BN_dup(r);
if (!new_s || !new_r) {
GOSTerr(GOST_F_GOST_EC_SIGN, ERR_R_MALLOC_FAILURE);
goto err;
}
+ DSA_SIG_set0(newsig, new_r, new_s);
ret = newsig;
err: