aboutsummaryrefslogtreecommitdiff
path: root/gost_pmeth.c
diff options
context:
space:
mode:
authorDmitry Belyavskiy <beldmit@gmail.com>2016-12-12 14:36:18 +0300
committerDmitry Belyavskiy <beldmit@gmail.com>2016-12-12 14:36:18 +0300
commit0d84f62acc3a66a91d846a15824b9d939d54aa79 (patch)
tree634300e5fc4024ba2d7532fe988ddb8d2e255070 /gost_pmeth.c
parent394129dbc476cb879876b7dfc05c403bcfe5ef46 (diff)
downloadgost-engine-0d84f62acc3a66a91d846a15824b9d939d54aa79.zip
gost-engine-0d84f62acc3a66a91d846a15824b9d939d54aa79.tar.gz
gost-engine-0d84f62acc3a66a91d846a15824b9d939d54aa79.tar.bz2
Fix signature verification.
Diffstat (limited to 'gost_pmeth.c')
-rw-r--r--gost_pmeth.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gost_pmeth.c b/gost_pmeth.c
index 9a01822..ce162f5 100644
--- a/gost_pmeth.c
+++ b/gost_pmeth.c
@@ -417,20 +417,20 @@ static int pkey_gost_ec_cp_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
/* ------------------- 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,