goto err;
if (!seed_in)
- RAND_pseudo_bytes(seed, qsize);
+ RAND_pseudo_bytes(seed, seed_len);
/* step 2 */
if (!EVP_Digest(seed, seed_len, md, NULL, evpmd, NULL))
goto err;
/* do a callback call */
/* step 5 */
}
+ /* Copy seed to seed_out before we mess with it */
+ if (seed_out)
+ memcpy(seed_out, seed, seed_len);
if(!BN_GENCB_call(cb, 2, 0)) goto err;
if(!BN_GENCB_call(cb, 3, 0)) goto err;
ok=1;
err:
- if (ok)
+ if (ok == 1)
{
if(ret->p) BN_free(ret->p);
if(ret->q) BN_free(ret->q);
}
if (counter_ret != NULL) *counter_ret=counter;
if (h_ret != NULL) *h_ret=h;
- if (seed_out)
- memcpy(seed_out, seed, seed_len);
}
if (seed)
OPENSSL_free(seed);