R
1323565.1.023-2018 forbids encoding hash oid into TC26 (2012)
parameters in AlgorithmIdentifier, so this is removed.
New "paramset" names for 256-bit TC26 parameters: TCA, TCB, TCC, TCD,
for 512-bit parameter: C.
Using these new OIDs for gost2012_256:
NID_id_tc26_gost_3410_2012_256_paramSetA = TCA
NID_id_tc26_gost_3410_2012_256_paramSetB = TCB
NID_id_tc26_gost_3410_2012_256_paramSetC = TCC
NID_id_tc26_gost_3410_2012_256_paramSetD = TCD
for gost2012_512:
NID_id_tc26_gost_3410_2012_512_paramSetC = C
Resolves #84.
Use -pkeyopt option to pass paramset to algorithm. The following paramsets
are supported by
gost2001: 0,A,B,C,XA,XB
- gost2012_256: 0,A,B,C,XA,XB
- gost2012_512: A,B
+ gost2012_256: 0,A,B,C,XA,XB,TCA,TCB,TCC,TCD
+ gost2012_512: A,B,C
You can also use numeric representation of OID as to destinate
paramset.
switch (EVP_PKEY_base_id(key)) {
case NID_id_GostR3410_2012_256:
pkey_param_nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(key_ptr));
- gkp->hash_params = OBJ_nid2obj(NID_id_GostR3411_2012_256);
+ switch (pkey_param_nid) {
+ case NID_id_GostR3410_2001_TestParamSet:
+ case NID_id_GostR3410_2001_CryptoPro_A_ParamSet:
+ case NID_id_GostR3410_2001_CryptoPro_B_ParamSet:
+ case NID_id_GostR3410_2001_CryptoPro_C_ParamSet:
+ case NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet:
+ case NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet:
+ gkp->hash_params = OBJ_nid2obj(NID_id_GostR3411_2012_256);
+ }
break;
case NID_id_GostR3410_2012_512:
pkey_param_nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(key_ptr));
- gkp->hash_params = OBJ_nid2obj(NID_id_GostR3411_2012_512);
break;
case NID_id_GostR3410_2001:
pkey_param_nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(key_ptr));
GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
goto end;
}
- EC_GROUP_set_curve_name(grp, params->nid);
+ EC_GROUP_set_curve_name(grp, nid);
if (!EC_KEY_set_group(eckey, grp)) {
GOSTerr(GOST_F_FILL_GOST_EC_PARAMS, ERR_R_INTERNAL_ERROR);
goto end;
default:
return 0;
}
+ } else if ((strlen(value) == 3)
+ && (toupper((unsigned char)value[0]) == 'T')
+ && (toupper((unsigned char)value[1]) == 'C')) {
+ switch (toupper((unsigned char)value[2])) {
+ case 'A':
+ param_nid = NID_id_tc26_gost_3410_2012_256_paramSetA;
+ break;
+ case 'B':
+ param_nid = NID_id_tc26_gost_3410_2012_256_paramSetB;
+ break;
+ case 'C':
+ param_nid = NID_id_tc26_gost_3410_2012_256_paramSetC;
+ break;
+ case 'D':
+ param_nid = NID_id_tc26_gost_3410_2012_256_paramSetD;
+ break;
+ default:
+ return 0;
+ }
} else {
R3410_ec_params *p = R3410_2001_paramset;
param_nid = OBJ_txt2nid(value);
param_nid = NID_id_tc26_gost_3410_2012_512_paramSetB;
break;
+ case 'C':
+ param_nid = NID_id_tc26_gost_3410_2012_512_paramSetC;
+ break;
+
default:
return 0;
}
switch (data->sign_param_nid) {
case NID_id_tc26_gost_3410_2012_512_paramSetA:
case NID_id_tc26_gost_3410_2012_512_paramSetB:
+ case NID_id_tc26_gost_3410_2012_512_paramSetC:
result =
(EVP_PKEY_assign(pkey, NID_id_GostR3410_2012_512, ec)) ? 1 : 0;
break;
case NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet:
case NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet:
case NID_id_GostR3410_2001_TestParamSet:
+ case NID_id_tc26_gost_3410_2012_256_paramSetA:
+ case NID_id_tc26_gost_3410_2012_256_paramSetB:
+ case NID_id_tc26_gost_3410_2012_256_paramSetC:
+ case NID_id_tc26_gost_3410_2012_256_paramSetD:
result =
(EVP_PKEY_assign(pkey, NID_id_GostR3410_2012_256, ec)) ? 1 : 0;
break;