static struct gost_cipher_minfo {
int nid;
const EVP_CIPHER *(*cipher)(void);
+ GOST_cipher *reg;
} gost_cipher_array[] = {
{
NID_id_Gost28147_89,
- cipher_gost,
+ NULL,
+ &Gost28147_89_cipher,
},
{
NID_gost89_cnt,
- cipher_gost_cpacnt,
+ NULL,
+ &Gost28147_89_cnt_cipher,
},
{
NID_gost89_cnt_12,
- cipher_gost_cpcnt_12,
+ NULL,
+ &Gost28147_89_cnt_12_cipher,
},
{
NID_gost89_cbc,
- cipher_gost_cbc,
+ NULL,
+ &Gost28147_89_cbc_cipher,
},
{
NID_grasshopper_ecb,
},
{
NID_magma_ctr,
- cipher_magma_ctr,
+ NULL,
+ &magma_ctr_cipher,
+ },
+ {
+ NID_magma_ctr_acpkm,
+ NULL,
+ &magma_ctr_acpkm_cipher,
+ },
+ {
+ NID_magma_ctr_acpkm_omac,
+ cipher_magma_ctr_acpkm_omac,
},
{
NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm,
cipher_gost_grasshopper_ctracpkm,
},
+ {
+ NID_kuznyechik_ctr_acpkm_omac,
+ cipher_gost_grasshopper_ctracpkm_omac,
+ },
+ {
+ NID_magma_kexp15,
+ cipher_magma_wrap,
+ },
+ {
+ NID_kuznyechik_kexp15,
+ cipher_kuznyechik_wrap,
+ },
{ 0 },
};
NID_grasshopper_mac,
&pmeth_grasshopper_mac,
&ameth_grasshopper_mac,
- "GRASSHOPPER-MAC",
+ "KUZNYECHIK-MAC",
"GOST R 34.13-2015 Grasshopper MAC",
},
{
dinfo->destroy();
}
- cipher_gost_destroy();
- cipher_gost_grasshopper_destroy();
+ struct gost_cipher_minfo *cinfo = gost_cipher_array;
+ for (; cinfo->nid; cinfo++) {
+ if (cinfo->reg)
+ GOST_deinit_cipher(cinfo->reg);
+ else
+ EVP_CIPHER_meth_free((EVP_CIPHER *)cinfo->cipher());
+ }
+
+ //cipher_gost_grasshopper_destroy();
+ //wrap_ciphers_destroy();
gost_param_free();
goto end;
struct gost_cipher_minfo *cinfo = gost_cipher_array;
- for (; cinfo->nid; cinfo++)
- if (!EVP_add_cipher(cinfo->cipher()))
+ for (; cinfo->nid; cinfo++) {
+ const EVP_CIPHER *cipher;
+
+ if (cinfo->reg)
+ cipher = GOST_init_cipher(cinfo->reg);
+ else
+ cipher = cinfo->cipher();
+ if (!EVP_add_cipher(cipher))
goto end;
+ }
struct gost_digest_minfo *dinfo = gost_digest_array;
for (; dinfo->nid; dinfo++) {
for (; info->nid; info++)
if (nid == info->nid) {
- *cipher = info->cipher();
+ if (info->reg)
+ *cipher = GOST_init_cipher(info->reg);
+ else
+ *cipher = info->cipher();
return 1;
}
*cipher = NULL;