X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_eng.c;h=11344db10e33258166706a6c79fb7d710b71f3a0;hb=a430c355a1d2eff5df6c96c7b6f928a609c2dd73;hp=0cef2faf00320f1edf20cbfc7efba370f667502b;hpb=14e654cab19089027b00733594480eb03d8c6da5;p=openssl-gost%2Fengine.git diff --git a/gost_eng.c b/gost_eng.c index 0cef2fa..11344db 100644 --- a/gost_eng.c +++ b/gost_eng.c @@ -48,6 +48,8 @@ static int gost_cipher_nids[] = { NID_grasshopper_ofb, NID_grasshopper_ctr, NID_magma_cbc, + NID_magma_ctr, + NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm, 0 }; @@ -113,38 +115,40 @@ static int gost_engine_finish(ENGINE* e) { } static int gost_engine_destroy(ENGINE* e) { - digest_gost_destroy(); - digest_gost2012_256_destroy(); - digest_gost2012_512_destroy(); - - imit_gost_cpa_destroy(); - imit_gost_cp_12_destroy(); - magma_omac_destroy(); - grasshopper_omac_destroy(); - - cipher_gost_destroy(); - - gost_param_free(); - - pmeth_GostR3410_2001 = NULL; - pmeth_Gost28147_MAC = NULL; - pmeth_GostR3410_2012_256 = NULL; - pmeth_GostR3410_2012_512 = NULL; - pmeth_Gost28147_MAC_12 = NULL; - pmeth_magma_mac = NULL; - pmeth_grasshopper_mac = NULL; - - ameth_GostR3410_2001 = NULL; - ameth_Gost28147_MAC = NULL; - ameth_GostR3410_2012_256 = NULL; - ameth_GostR3410_2012_512 = NULL; - ameth_Gost28147_MAC_12 = NULL; - ameth_magma_mac = NULL; - ameth_grasshopper_mac = NULL; - - ERR_unload_GOST_strings(); - - return 1; + digest_gost_destroy(); + digest_gost2012_256_destroy(); + digest_gost2012_512_destroy(); + + imit_gost_cpa_destroy(); + imit_gost_cp_12_destroy(); + magma_omac_destroy(); + grasshopper_omac_destroy(); + grasshopper_omac_acpkm_destroy(); + + cipher_gost_destroy(); + cipher_gost_grasshopper_destroy(); + + gost_param_free(); + + pmeth_GostR3410_2001 = NULL; + pmeth_Gost28147_MAC = NULL; + pmeth_GostR3410_2012_256 = NULL; + pmeth_GostR3410_2012_512 = NULL; + pmeth_Gost28147_MAC_12 = NULL; + pmeth_magma_mac = NULL; + pmeth_grasshopper_mac = NULL; + + ameth_GostR3410_2001 = NULL; + ameth_Gost28147_MAC = NULL; + ameth_GostR3410_2012_256 = NULL; + ameth_GostR3410_2012_512 = NULL; + ameth_Gost28147_MAC_12 = NULL; + ameth_magma_mac = NULL; + ameth_grasshopper_mac = NULL; + + ERR_unload_GOST_strings(); + + return 1; } static int bind_gost(ENGINE* e, const char* id) { @@ -214,10 +218,10 @@ static int bind_gost(ENGINE* e, const char* id) { "GOST 28147-89 MAC with 2012 params")) goto end; if (!register_ameth_gost(NID_magma_mac, &ameth_magma_mac, - "MAGMA-OMAC", "GOST R 34.13-2015 Magma MAC")) + "MAGMA-MAC", "GOST R 34.13-2015 Magma MAC")) goto end; if (!register_ameth_gost(NID_grasshopper_mac, &ameth_grasshopper_mac, - "GRASSHOPPER-OMAC", "GOST R 34.13-2015 Grasshopper MAC")) + "GRASSHOPPER-MAC", "GOST R 34.13-2015 Grasshopper MAC")) goto end; if (!register_pmeth_gost(NID_id_GostR3410_2001, &pmeth_GostR3410_2001, 0)) @@ -251,12 +255,16 @@ static int bind_gost(ENGINE* e, const char* id) { || !EVP_add_cipher(cipher_gost_grasshopper_cfb()) || !EVP_add_cipher(cipher_gost_grasshopper_ofb()) || !EVP_add_cipher(cipher_gost_grasshopper_ctr()) + || !EVP_add_cipher(cipher_gost_grasshopper_ctracpkm()) || !EVP_add_cipher(cipher_magma_cbc()) + || !EVP_add_cipher(cipher_magma_ctr()) || !EVP_add_digest(digest_gost()) || !EVP_add_digest(digest_gost2012_512()) || !EVP_add_digest(digest_gost2012_256()) || !EVP_add_digest(imit_gost_cpa()) || !EVP_add_digest(imit_gost_cp_12()) + || !EVP_add_digest(magma_omac()) + || !EVP_add_digest(grasshopper_omac()) ) { goto end; } @@ -294,6 +302,8 @@ static int gost_digests(ENGINE* e, const EVP_MD** digest, *digest = magma_omac(); } else if (nid == NID_grasshopper_mac) { *digest = grasshopper_omac(); + } else if (nid == NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm_omac) { + *digest = grasshopper_omac_acpkm(); } else { ok = 0; *digest = NULL; @@ -327,8 +337,12 @@ static int gost_ciphers(ENGINE* e, const EVP_CIPHER** cipher, *cipher = cipher_gost_grasshopper_ofb(); } else if (nid == NID_grasshopper_ctr) { *cipher = cipher_gost_grasshopper_ctr(); + } else if (nid == NID_id_tc26_cipher_gostr3412_2015_kuznyechik_ctracpkm) { + *cipher = cipher_gost_grasshopper_ctracpkm(); } else if (nid == NID_magma_cbc) { *cipher = cipher_magma_cbc(); + } else if (nid == NID_magma_ctr) { + *cipher = cipher_magma_ctr(); } else { ok = 0; *cipher = NULL;