From de2c22b5d162cbacccac7178dac649d24f8c5d98 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Mon, 21 Jan 2019 08:36:04 +0300 Subject: [PATCH] ec_sign: map tc26-2012 256-bit parameters to cp-2001 parameters This will make at least signature verification work. --- gost_ec_sign.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gost_ec_sign.c b/gost_ec_sign.c index be6f9b1..ba12783 100644 --- a/gost_ec_sign.c +++ b/gost_ec_sign.c @@ -42,6 +42,18 @@ static R3410_ec_params *gost_nid2params(int nid) { R3410_ec_params *params; + /* Map tc26-2012 256-bit parameters to cp-2001 parameters */ + switch (nid) { + case NID_id_tc26_gost_3410_2012_256_paramSetB: + nid = NID_id_GostR3410_2001_CryptoPro_A_ParamSet; + break; + case NID_id_tc26_gost_3410_2012_256_paramSetC: + nid = NID_id_GostR3410_2001_CryptoPro_B_ParamSet; + break; + case NID_id_tc26_gost_3410_2012_256_paramSetD: + nid = NID_id_GostR3410_2001_CryptoPro_C_ParamSet; + } + /* Search nid in 2012 paramset */ params = R3410_2012_512_paramset; while (params->nid != NID_undef) { -- 2.39.5