-void cipher_gost_destroy(void)
-{
- EVP_CIPHER_meth_free(_hidden_Gost28147_89_cipher);
- _hidden_Gost28147_89_cipher = NULL;
- EVP_CIPHER_meth_free(_hidden_gost89_cnt);
- _hidden_gost89_cnt = NULL;
- EVP_CIPHER_meth_free(_hidden_Gost28147_89_cbc);
- _hidden_Gost28147_89_cbc = NULL;
- EVP_CIPHER_meth_free(_hidden_gost89_cnt_12);
- _hidden_gost89_cnt_12 = NULL;
- EVP_CIPHER_meth_free(_hidden_magma_cbc);
- _hidden_magma_cbc = NULL;
- EVP_CIPHER_meth_free(_hidden_magma_ctr);
- _hidden_magma_ctr = NULL;
- EVP_CIPHER_meth_free(_hidden_magma_ctr_acpkm);
- _hidden_magma_ctr_acpkm = NULL;
- EVP_CIPHER_meth_free(_hidden_magma_ctr_acpkm_omac);
- _hidden_magma_ctr_acpkm_omac = NULL;
-}
+GOST_cipher Gost28147_89_cnt_cipher = {
+ .nid = NID_gost89_cnt,
+ .template = &gost_template_cipher,
+ .block_size = 1,
+ .flags = EVP_CIPH_OFB_MODE |
+ EVP_CIPH_NO_PADDING,
+ .init = gost_cipher_init_cpa,
+ .do_cipher = gost_cipher_do_cnt,
+};
+
+GOST_cipher Gost28147_89_cnt_12_cipher = {
+ .nid = NID_gost89_cnt_12,
+ .template = &gost_template_cipher,
+ .block_size = 1,
+ .flags = EVP_CIPH_OFB_MODE |
+ EVP_CIPH_NO_PADDING,
+ .init = gost_cipher_init_cp_12,
+ .do_cipher = gost_cipher_do_cnt,
+};
+
+static GOST_cipher magma_template_cipher = {
+ .block_size = 8,
+ .key_len = 32,
+ .flags =
+ EVP_CIPH_RAND_KEY |
+ EVP_CIPH_ALWAYS_CALL_INIT,
+ .cleanup = gost_cipher_cleanup,
+ .ctx_size = sizeof(struct ossl_gost_cipher_ctx),
+ .set_asn1_parameters = magma_set_asn1_parameters,
+ .get_asn1_parameters = magma_get_asn1_parameters,
+ .do_cipher = magma_cipher_do_ctr,
+ .ctrl = magma_cipher_ctl,
+};
+
+GOST_cipher magma_ctr_cipher = {
+ .nid = NID_magma_ctr,
+ .template = &magma_template_cipher,
+ .block_size = 1,
+ .iv_len = 4,
+ .flags = EVP_CIPH_CTR_MODE |
+ EVP_CIPH_CUSTOM_IV |
+ EVP_CIPH_NO_PADDING,
+ .init = magma_cipher_init,
+};
+
+GOST_cipher magma_ctr_acpkm_cipher = {
+ .nid = NID_magma_ctr_acpkm,
+ .template = &magma_template_cipher,
+ .block_size = 1,
+ .iv_len = 4,
+ .flags = EVP_CIPH_CTR_MODE |
+ EVP_CIPH_CUSTOM_IV |
+ EVP_CIPH_NO_PADDING,
+ .init = magma_cipher_init,
+};
+
+GOST_cipher magma_ctr_acpkm_omac_cipher = {
+ .nid = NID_magma_ctr_acpkm_omac,
+ .template = &magma_template_cipher,
+ .block_size = 1,
+ .iv_len = 4,
+ .flags = EVP_CIPH_CTR_MODE |
+ EVP_CIPH_CUSTOM_IV |
+ EVP_CIPH_NO_PADDING |
+ EVP_CIPH_CUSTOM_COPY |
+ EVP_CIPH_FLAG_CUSTOM_CIPHER |
+ EVP_CIPH_FLAG_CIPHER_WITH_MAC,
+ .init = magma_cipher_init_ctr_acpkm_omac,
+ .do_cipher = magma_cipher_do_ctr_acpkm_omac,
+ .ctrl = magma_cipher_ctl_acpkm_omac,
+};
+
+GOST_cipher magma_ecb_cipher = {
+ .nid = NID_magma_ecb,
+ .template = &magma_template_cipher,
+ .flags = EVP_CIPH_ECB_MODE,
+ .init = magma_cipher_init,
+ .do_cipher = magma_cipher_do_ecb,
+};
+
+GOST_cipher magma_cbc_cipher = {
+ .nid = NID_magma_cbc,
+ .template = &gost_template_cipher,
+ .iv_len = 8,
+ .flags = EVP_CIPH_CBC_MODE |
+ EVP_CIPH_CUSTOM_IV,
+ .init = magma_cipher_init,
+ .do_cipher = magma_cipher_do_cbc,
+};