/* ------------------- verify callbacks ---------------------------*/
/* Unpack signature according to cryptopro rules */
-DSA_SIG *unpack_cp_signature(const unsigned char *sig, size_t siglen)
+DSA_SIG *unpack_cp_signature(const unsigned char *sigbuf, size_t siglen)
{
- DSA_SIG *s;
- const BIGNUM *sig_r = NULL, *sig_s = NULL;
+ DSA_SIG *sig;
+ BIGNUM *r = NULL, *s = NULL;
- s = DSA_SIG_new();
- if (s == NULL) {
+ sig = DSA_SIG_new();
+ if (sig == NULL) {
GOSTerr(GOST_F_UNPACK_CP_SIGNATURE, ERR_R_MALLOC_FAILURE);
return NULL;
}
- DSA_SIG_get0(s, &sig_r, &sig_s);
- sig_s = BN_bin2bn(sig, siglen / 2, NULL);
- sig_r = BN_bin2bn(sig + siglen / 2, siglen / 2, NULL);
- return s;
+ s = BN_bin2bn(sigbuf, siglen / 2, NULL);
+ r = BN_bin2bn(sigbuf + siglen / 2, siglen / 2, NULL);
+ DSA_SIG_set0(sig, r, s);
+ return sig;
}
static int pkey_gost_ec_cp_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig,