X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_crypt.c;h=213b285bad436544431ac62207083306a4a630d0;hb=4dc691d1177ad328f34bee01128b3a8aa23b2547;hp=5f7e029c389b830743e62105c6bb1685f5ff1e7b;hpb=02eb87cc43d7ef6cb7f49b3f023a185d3549bfef;p=openssl-gost%2Fengine.git diff --git a/gost_crypt.c b/gost_crypt.c index 5f7e029..213b285 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -69,22 +69,54 @@ static int magma_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params); static int magma_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); static int magma_cipher_ctl_acpkm_omac(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); +/* + * Single level template accessor. + * Note: that you cannot template 0 value. + */ +#define TPL(st,field) ( \ + ((st)->field) ?: TPL_VAL(st,field) \ +) + +#define TPL_VAL(st,field) ( \ + ((st)->template ? (st)->template->field : 0) \ +) + EVP_CIPHER *GOST_init_cipher(GOST_cipher *c) { if (c->cipher) return c->cipher; + /* Some sanity checking. */ + int flags = c->flags | TPL_VAL(c, flags); + int block_size = TPL(c, block_size); + switch (flags & EVP_CIPH_MODE) { + case EVP_CIPH_CTR_MODE: + case EVP_CIPH_CFB_MODE: + case EVP_CIPH_OFB_MODE: + OPENSSL_assert(block_size == 1); + OPENSSL_assert(flags & EVP_CIPH_NO_PADDING); + break; + default: + OPENSSL_assert(block_size != 1); + OPENSSL_assert(!(flags & EVP_CIPH_NO_PADDING)); + } + + if (TPL(c, iv_len)) + OPENSSL_assert(flags & EVP_CIPH_CUSTOM_IV); + else + OPENSSL_assert(!(flags & EVP_CIPH_CUSTOM_IV)); + EVP_CIPHER *cipher; - if (!(cipher = EVP_CIPHER_meth_new(c->nid, c->block_size, c->key_len)) - || !EVP_CIPHER_meth_set_iv_length(cipher, c->iv_len) - || !EVP_CIPHER_meth_set_flags(cipher, c->flags) - || !EVP_CIPHER_meth_set_init(cipher, c->init) - || !EVP_CIPHER_meth_set_do_cipher(cipher, c->do_cipher) - || !EVP_CIPHER_meth_set_cleanup(cipher, c->cleanup) - || !EVP_CIPHER_meth_set_impl_ctx_size(cipher, c->ctx_size) - || !EVP_CIPHER_meth_set_set_asn1_params(cipher, c->set_asn1_parameters) - || !EVP_CIPHER_meth_set_get_asn1_params(cipher, c->get_asn1_parameters) - || !EVP_CIPHER_meth_set_ctrl(cipher, c->ctrl)) { + if (!(cipher = EVP_CIPHER_meth_new(c->nid, block_size, TPL(c, key_len))) + || !EVP_CIPHER_meth_set_iv_length(cipher, TPL(c, iv_len)) + || !EVP_CIPHER_meth_set_flags(cipher, flags) + || !EVP_CIPHER_meth_set_init(cipher, TPL(c, init)) + || !EVP_CIPHER_meth_set_do_cipher(cipher, TPL(c, do_cipher)) + || !EVP_CIPHER_meth_set_cleanup(cipher, TPL(c, cleanup)) + || !EVP_CIPHER_meth_set_impl_ctx_size(cipher, TPL(c, ctx_size)) + || !EVP_CIPHER_meth_set_set_asn1_params(cipher, TPL(c, set_asn1_parameters)) + || !EVP_CIPHER_meth_set_get_asn1_params(cipher, TPL(c, get_asn1_parameters)) + || !EVP_CIPHER_meth_set_ctrl(cipher, TPL(c, ctrl))) { EVP_CIPHER_meth_free(cipher); cipher = NULL; } @@ -100,18 +132,13 @@ void GOST_deinit_cipher(GOST_cipher *c) } } -GOST_cipher Gost28147_89_cipher = { - .nid = NID_id_Gost28147_89, - .block_size = 1, +static GOST_cipher gost_template_cipher = { + .block_size = 8, .key_len = 32, .iv_len = 8, - .flags = EVP_CIPH_CFB_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | + .flags = EVP_CIPH_CUSTOM_IV | EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT, - .init = gost_cipher_init, - .do_cipher = gost_cipher_do_cfb, .cleanup = gost_cipher_cleanup, .ctx_size = sizeof(struct ossl_gost_cipher_ctx), .set_asn1_parameters = gost89_set_asn1_parameters, @@ -119,139 +146,100 @@ GOST_cipher Gost28147_89_cipher = { .ctrl = gost_cipher_ctl, }; +GOST_cipher Gost28147_89_cipher = { + .nid = NID_id_Gost28147_89, + .template = &gost_template_cipher, + .block_size = 1, + .flags = EVP_CIPH_CFB_MODE | + EVP_CIPH_NO_PADDING, + .init = gost_cipher_init, + .do_cipher = gost_cipher_do_cfb, +}; + GOST_cipher Gost28147_89_cbc_cipher = { .nid = NID_gost89_cbc, - .block_size = 8, - .key_len = 32, - .iv_len = 8, - .flags = EVP_CIPH_CBC_MODE | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT, + .template = &gost_template_cipher, + .flags = EVP_CIPH_CBC_MODE, .init = gost_cipher_init_cbc, .do_cipher = gost_cipher_do_cbc, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = gost_cipher_ctl, }; GOST_cipher Gost28147_89_cnt_cipher = { .nid = NID_gost89_cnt, + .template = &gost_template_cipher, .block_size = 1, - .key_len = 32, - .iv_len = 8, .flags = EVP_CIPH_OFB_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT, + EVP_CIPH_NO_PADDING, .init = gost_cipher_init_cpa, .do_cipher = gost_cipher_do_cnt, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = gost_cipher_ctl, }; 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, .iv_len = 8, - .flags = EVP_CIPH_OFB_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | + .flags = EVP_CIPH_CUSTOM_IV | EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT, - .init = gost_cipher_init_cp_12, - .do_cipher = gost_cipher_do_cnt, .cleanup = gost_cipher_cleanup, .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = gost_cipher_ctl, + .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, - .key_len = 32, .iv_len = 4, .flags = EVP_CIPH_CTR_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT, + EVP_CIPH_NO_PADDING, .init = magma_cipher_init, - .do_cipher = magma_cipher_do_ctr, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = magma_cipher_ctl, }; GOST_cipher magma_ctr_acpkm_cipher = { .nid = NID_magma_ctr_acpkm, + .template = &magma_template_cipher, .block_size = 1, - .key_len = 32, .iv_len = 4, .flags = EVP_CIPH_CTR_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT, + EVP_CIPH_NO_PADDING, .init = magma_cipher_init, - .do_cipher = magma_cipher_do_ctr, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = magma_cipher_ctl, }; GOST_cipher magma_ctr_acpkm_omac_cipher = { .nid = NID_magma_ctr_acpkm_omac, + .template = &magma_template_cipher, .block_size = 1, - .key_len = 32, .iv_len = 4, .flags = EVP_CIPH_CTR_MODE | EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT | 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, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, .ctrl = magma_cipher_ctl_acpkm_omac, }; GOST_cipher magma_cbc_cipher = { .nid = NID_magma_cbc, - .block_size = 8, - .key_len = 32, - .iv_len = 8, - .flags = EVP_CIPH_CBC_MODE | - EVP_CIPH_NO_PADDING | - EVP_CIPH_CUSTOM_IV | - EVP_CIPH_RAND_KEY | - EVP_CIPH_ALWAYS_CALL_INIT, + .template = &gost_template_cipher, + .flags = EVP_CIPH_CBC_MODE, .init = magma_cipher_init, .do_cipher = magma_cipher_do_cbc, - .cleanup = gost_cipher_cleanup, - .ctx_size = sizeof(struct ossl_gost_cipher_ctx), - .set_asn1_parameters = gost89_set_asn1_parameters, - .get_asn1_parameters = gost89_get_asn1_parameters, - .ctrl = magma_cipher_ctl, }; /* Implementation of GOST 28147-89 in MAC (imitovstavka) mode */ @@ -268,70 +256,33 @@ static int gost_imit_cleanup(EVP_MD_CTX *ctx); /* Control function, knows how to set MAC key.*/ static int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr); -static EVP_MD *_hidden_Gost28147_89_MAC_md = NULL; -static EVP_MD *_hidden_Gost28147_89_12_MAC_md = NULL; - -EVP_MD *imit_gost_cpa(void) -{ - if (_hidden_Gost28147_89_MAC_md == NULL) { - EVP_MD *md; - - if ((md = EVP_MD_meth_new(NID_id_Gost28147_89_MAC, NID_undef)) == NULL - || !EVP_MD_meth_set_result_size(md, 4) - || !EVP_MD_meth_set_input_blocksize(md, 8) - || !EVP_MD_meth_set_app_datasize(md, - sizeof(struct ossl_gost_imit_ctx)) - || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_XOF) - || !EVP_MD_meth_set_init(md, gost_imit_init_cpa) - || !EVP_MD_meth_set_update(md, gost_imit_update) - || !EVP_MD_meth_set_final(md, gost_imit_final) - || !EVP_MD_meth_set_copy(md, gost_imit_copy) - || !EVP_MD_meth_set_cleanup(md, gost_imit_cleanup) - || !EVP_MD_meth_set_ctrl(md, gost_imit_ctrl)) { - EVP_MD_meth_free(md); - md = NULL; - } - _hidden_Gost28147_89_MAC_md = md; - } - return _hidden_Gost28147_89_MAC_md; -} - -void imit_gost_cpa_destroy(void) -{ - EVP_MD_meth_free(_hidden_Gost28147_89_MAC_md); - _hidden_Gost28147_89_MAC_md = NULL; -} - -EVP_MD *imit_gost_cp_12(void) -{ - if (_hidden_Gost28147_89_12_MAC_md == NULL) { - EVP_MD *md; - - if ((md = EVP_MD_meth_new(NID_gost_mac_12, NID_undef)) == NULL - || !EVP_MD_meth_set_result_size(md, 4) - || !EVP_MD_meth_set_input_blocksize(md, 8) - || !EVP_MD_meth_set_app_datasize(md, - sizeof(struct ossl_gost_imit_ctx)) - || !EVP_MD_meth_set_flags(md, EVP_MD_FLAG_XOF) - || !EVP_MD_meth_set_init(md, gost_imit_init_cp_12) - || !EVP_MD_meth_set_update(md, gost_imit_update) - || !EVP_MD_meth_set_final(md, gost_imit_final) - || !EVP_MD_meth_set_copy(md, gost_imit_copy) - || !EVP_MD_meth_set_cleanup(md, gost_imit_cleanup) - || !EVP_MD_meth_set_ctrl(md, gost_imit_ctrl)) { - EVP_MD_meth_free(md); - md = NULL; - } - _hidden_Gost28147_89_12_MAC_md = md; - } - return _hidden_Gost28147_89_12_MAC_md; -} +GOST_digest Gost28147_89_MAC_digest = { + .nid = NID_id_Gost28147_89_MAC, + .result_size = 4, + .input_blocksize = 8, + .app_datasize = sizeof(struct ossl_gost_imit_ctx), + .flags = EVP_MD_FLAG_XOF, + .init = gost_imit_init_cpa, + .update = gost_imit_update, + .final = gost_imit_final, + .copy = gost_imit_copy, + .cleanup = gost_imit_cleanup, + .ctrl = gost_imit_ctrl, +}; -void imit_gost_cp_12_destroy(void) -{ - EVP_MD_meth_free(_hidden_Gost28147_89_12_MAC_md); - _hidden_Gost28147_89_12_MAC_md = NULL; -} +GOST_digest Gost28147_89_mac_12_digest = { + .nid = NID_gost_mac_12, + .result_size = 4, + .input_blocksize = 8, + .app_datasize = sizeof(struct ossl_gost_imit_ctx), + .flags = EVP_MD_FLAG_XOF, + .init = gost_imit_init_cp_12, + .update = gost_imit_update, + .final = gost_imit_final, + .copy = gost_imit_copy, + .cleanup = gost_imit_cleanup, + .ctrl = gost_imit_ctrl, +}; /* * Correspondence between gost parameter OIDs and substitution blocks @@ -339,7 +290,7 @@ void imit_gost_cp_12_destroy(void) * upon engine initialization */ -struct gost_cipher_info gost_cipher_list[] = { +static struct gost_cipher_info gost_cipher_list[] = { /*- NID *//* * Subst block *//* @@ -473,7 +424,7 @@ static int gost_cipher_init_cp_12(EVP_CIPHER_CTX *ctx, } /* Initializes EVP_CIPHER_CTX with default values */ -int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, +static int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { return gost_cipher_init_param(ctx, key, iv, enc, NID_undef, @@ -481,7 +432,7 @@ int gost_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, } /* Initializes EVP_CIPHER_CTX with default values */ -int gost_cipher_init_cbc(EVP_CIPHER_CTX *ctx, const unsigned char *key, +static int gost_cipher_init_cbc(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { return gost_cipher_init_param(ctx, key, iv, enc, NID_undef, @@ -489,7 +440,7 @@ int gost_cipher_init_cbc(EVP_CIPHER_CTX *ctx, const unsigned char *key, } /* Initializes EVP_CIPHER_CTX with default values */ -int magma_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, +static int magma_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { struct ossl_gost_cipher_ctx *c = EVP_CIPHER_CTX_get_cipher_data(ctx); @@ -525,7 +476,7 @@ int magma_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, } /* Initializes EVP_CIPHER_CTX with default values */ -int magma_cipher_init_ctr_acpkm_omac(EVP_CIPHER_CTX *ctx, const unsigned char *key, +static int magma_cipher_init_ctr_acpkm_omac(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { if (key) { @@ -601,7 +552,7 @@ static void gost_cnt_next(void *ctx, unsigned char *iv, unsigned char *buf) } /* GOST encryption in CBC mode */ -int gost_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int gost_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { unsigned char b[8]; @@ -624,11 +575,13 @@ int gost_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, } } else { while (inl > 0) { + unsigned char tmpiv[8]; gostdecrypt(&(c->cctx), in_ptr, b); + memcpy(tmpiv, in_ptr, 8); for (i = 0; i < 8; i++) { out_ptr[i] = iv[i] ^ b[i]; } - memcpy(iv, in_ptr, 8); + memcpy(iv, tmpiv, 8); out_ptr += 8; in_ptr += 8; inl -= 8; @@ -638,7 +591,7 @@ int gost_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, } /* MAGMA encryption in CBC mode */ -int magma_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int magma_cipher_do_cbc(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { unsigned char b[8]; @@ -780,7 +733,7 @@ static int magma_cipher_do_ctr_acpkm_omac(EVP_CIPHER_CTX *ctx, unsigned char *ou return inl; } /* GOST encryption in CFB mode */ -int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, +static int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { const unsigned char *in_ptr = in; @@ -899,7 +852,7 @@ static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out, } /* Cleaning up of EVP_CIPHER_CTX */ -int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx) +static int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx) { struct ossl_gost_cipher_ctx *c = EVP_CIPHER_CTX_get_cipher_data(ctx); EVP_MD_CTX_free(c->omac_ctx); @@ -909,7 +862,7 @@ int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx) } /* Control function for gost cipher */ -int gost_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) +static int gost_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { switch (type) { case EVP_CTRL_RAND_KEY: @@ -992,7 +945,7 @@ int gost_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) } /* Control function for gost cipher */ -int magma_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) +static int magma_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { switch (type) { case EVP_CTRL_RAND_KEY: @@ -1056,7 +1009,7 @@ static int magma_cipher_ctl_acpkm_omac(EVP_CIPHER_CTX *ctx, int type, int arg, v } /* Set cipher parameters from ASN1 structure */ -int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) +static int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) { int len = 0; unsigned char *buf = NULL; @@ -1101,7 +1054,7 @@ int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) } /* Store parameters into ASN1 structure */ -int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) +static int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) { int len; GOST_CIPHER_PARAMS *gcp = NULL; @@ -1213,7 +1166,7 @@ static void mac_block_mesh(struct ossl_gost_imit_ctx *c, c->count = c->count % 1024 + 8; } -int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) +static int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) { struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx); const unsigned char *p = data; @@ -1246,7 +1199,7 @@ int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) return 1; } -int gost_imit_final(EVP_MD_CTX *ctx, unsigned char *md) +static int gost_imit_final(EVP_MD_CTX *ctx, unsigned char *md) { struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx); if (!c->key_set) { @@ -1269,7 +1222,7 @@ int gost_imit_final(EVP_MD_CTX *ctx, unsigned char *md) return 1; } -int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) +static int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) { switch (type) { case EVP_MD_CTRL_KEY_LEN: @@ -1325,7 +1278,7 @@ int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) } } -int gost_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) +static int gost_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { if (EVP_MD_CTX_md_data(to) && EVP_MD_CTX_md_data(from)) { memcpy(EVP_MD_CTX_md_data(to), EVP_MD_CTX_md_data(from), @@ -1335,7 +1288,7 @@ int gost_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) } /* Clean up imit ctx */ -int gost_imit_cleanup(EVP_MD_CTX *ctx) +static int gost_imit_cleanup(EVP_MD_CTX *ctx) { memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_imit_ctx)); return 1;