/* Control function, knows how to set MAC key.*/
static int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr);
-EVP_MD imit_gost_cpa = {
- NID_id_Gost28147_89_MAC,
- NID_undef,
- 4,
- 0,
- gost_imit_init_cpa,
- gost_imit_update,
- gost_imit_final,
- gost_imit_copy,
- gost_imit_cleanup,
- NULL,
- NULL,
- {0, 0, 0, 0, 0},
- 8,
- sizeof(struct ossl_gost_imit_ctx),
- gost_imit_ctrl
-};
+static EVP_MD *_hidden_Gost28147_89_MAC_md = NULL;
+static EVP_MD *_hidden_Gost28147_89_12_MAC_md = NULL;
-EVP_MD imit_gost_cp_12 = {
- NID_gost_mac_12,
- NID_undef,
- 4,
- 0,
- gost_imit_init_cp_12,
- gost_imit_update,
- gost_imit_final,
- gost_imit_copy,
- gost_imit_cleanup,
- NULL,
- NULL,
- {0, 0, 0, 0, 0},
- 8,
- sizeof(struct ossl_gost_imit_ctx),
- gost_imit_ctrl
-};
+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, 0)
+ || !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, 0)
+ || !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;
+}
+
+void imit_gost_cp_12_destroy(void)
+{
+ EVP_MD_meth_free(_hidden_Gost28147_89_12_MAC_md);
+ _hidden_Gost28147_89_12_MAC_md = NULL;
+}
/*
* Correspondence between gost parameter OIDs and substitution blocks
static int gost_imit_init(EVP_MD_CTX *ctx, gost_subst_block * block)
{
- struct ossl_gost_imit_ctx *c = ctx->md_data;
+ struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx);
memset(c->buffer, 0, sizeof(c->buffer));
memset(c->partial_block, 0, sizeof(c->partial_block));
c->count = 0;
int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count)
{
- struct ossl_gost_imit_ctx *c = ctx->md_data;
+ struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx);
const unsigned char *p = data;
size_t bytes = count, i;
if (!(c->key_set)) {
int gost_imit_final(EVP_MD_CTX *ctx, unsigned char *md)
{
- struct ossl_gost_imit_ctx *c = ctx->md_data;
+ struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx);
if (!c->key_set) {
GOSTerr(GOST_F_GOST_IMIT_FINAL, GOST_R_MAC_KEY_NOT_SET);
return 0;
return 1;
case EVP_MD_CTRL_SET_KEY:
{
- struct ossl_gost_imit_ctx *gost_imit_ctx = ctx->md_data;
+ struct ossl_gost_imit_ctx *gost_imit_ctx = EVP_MD_CTX_md_data(ctx);
- if (ctx->digest->init(ctx) <= 0) {
+ if (EVP_DigestInit(ctx, EVP_MD_CTX_md(ctx)) <= 0) {
GOSTerr(GOST_F_GOST_IMIT_CTRL, GOST_R_MAC_KEY_NOT_SET);
return 0;
}
- ctx->flags |= EVP_MD_CTX_FLAG_NO_INIT;
+ EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_NO_INIT);
if (arg == 0) {
struct gost_mac_key *key = (struct gost_mac_key *)ptr;
}
case EVP_MD_CTRL_MAC_LEN:
{
- struct ossl_gost_imit_ctx *c = ctx->md_data;
+ struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx);
if (arg < 1 || arg > 8) {
GOSTerr(GOST_F_GOST_IMIT_CTRL, GOST_R_INVALID_MAC_SIZE);
return 0;
int gost_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
{
- memcpy(to->md_data, from->md_data, sizeof(struct ossl_gost_imit_ctx));
+ 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),
+ sizeof(struct ossl_gost_imit_ctx));
+ }
return 1;
}
/* Clean up imit ctx */
int gost_imit_cleanup(EVP_MD_CTX *ctx)
{
- memset(ctx->md_data, 0, sizeof(struct ossl_gost_imit_ctx));
+ memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_imit_ctx));
return 1;
}
EC_POINT *pnt = EC_POINT_new(EC_KEY_get0_group(priv_key));
int i;
BN_CTX *ctx = BN_CTX_new();
- EVP_MD_CTX mdctx;
- const EVP_MD *md;
+ EVP_MD_CTX *mdctx = NULL;
+ const EVP_MD *md = NULL;
int effective_dgst_nid = (dgst_nid == NID_id_GostR3411_2012_512) ?
NID_id_GostR3411_2012_256 : dgst_nid;
int buf_len = (dgst_nid == NID_id_GostR3411_2012_512) ? 128 : 64,
for (i = 0; i < buf_len; i++) {
hashbuf[buf_len - 1 - i] = databuf[i];
}
- EVP_MD_CTX_init(&mdctx);
- EVP_DigestInit_ex(&mdctx, md, NULL);
- EVP_DigestUpdate(&mdctx, hashbuf, buf_len);
- EVP_DigestFinal_ex(&mdctx, shared_key, NULL);
- EVP_MD_CTX_cleanup(&mdctx);
+ EVP_MD_CTX_init(mdctx);
+ EVP_DigestInit_ex(mdctx, md, NULL);
+ EVP_DigestUpdate(mdctx, hashbuf, buf_len);
+ EVP_DigestFinal_ex(mdctx, shared_key, NULL);
+ EVP_MD_CTX_free(mdctx);
err:
BN_free(UKM);
BN_CTX_end(ctx);
0
};
-static int gost_digest_nids[] = {
- NID_id_GostR3411_94,
- NID_id_Gost28147_89_MAC,
- NID_id_GostR3411_2012_256,
- NID_id_GostR3411_2012_512,
- NID_gost_mac_12,
- 0
-};
+static int gost_digest_nids(const int **nids)
+{
+ static int digest_nids[6] = { 0, 0, 0, 0, 0, 0 };
+ static int pos = 0;
+ static int init = 0;
+
+ if (!init) {
+ const EVP_MD *md;
+ if ((md = digest_gost()) != NULL)
+ digest_nids[pos++] = EVP_MD_type(md);
+ if ((md = imit_gost_cpa()) != NULL)
+ digest_nids[pos++] = EVP_MD_type(md);
+ if ((md = digest_gost2012_256()) != NULL)
+ digest_nids[pos++] = EVP_MD_type(md);
+ if ((md = digest_gost2012_512()) != NULL)
+ digest_nids[pos++] = EVP_MD_type(md);
+ if ((md = imit_gost_cp_12()) != NULL)
+ digest_nids[pos++] = EVP_MD_type(md);
+ digest_nids[pos] = 0;
+ init = 1;
+ }
+ *nids = digest_nids;
+ return pos;
+}
static int gost_pkey_meth_nids[] = {
NID_id_GostR3410_2001,
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();
+
gost_param_free();
pmeth_GostR3410_2001 = NULL;
|| !EVP_add_cipher(&cipher_gost_cbc)
|| !EVP_add_cipher(&cipher_gost_cpacnt)
|| !EVP_add_cipher(&cipher_gost_cpcnt_12)
- || !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(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())
) {
goto end;
}
{
int ok = 1;
if (!digest) {
- *nids = gost_digest_nids;
- return sizeof(gost_digest_nids) / sizeof(gost_digest_nids[0]) - 1;
+ return gost_digest_nids(nids);
}
if (nid == NID_id_GostR3411_94) {
- *digest = &digest_gost;
- } else if (nid == NID_id_GostR3411_2012_256) {
- *digest = &digest_gost2012_256;
- } else if (nid == NID_id_GostR3411_2012_512) {
- *digest = &digest_gost2012_512;
+ *digest = digest_gost();
} else if (nid == NID_id_Gost28147_89_MAC) {
- *digest = &imit_gost_cpa;
- } else if (nid == NID_gost_mac_12) {
- *digest = &imit_gost_cp_12;
+ *digest = imit_gost_cpa();
} else {
ok = 0;
*digest = NULL;
gost_ctx cctx;
};
/* EVP_MD structure for GOST R 34.11 */
-extern EVP_MD digest_gost;
+EVP_MD *digest_gost(void);
+void digest_gost_destroy(void);
/* EVP MD structure for GOST R 34.11-2012 algorithms */
-extern EVP_MD digest_gost2012_256;
-extern EVP_MD digest_gost2012_512;
+EVP_MD *digest_gost2012_256(void);
+EVP_MD *digest_gost2012_512(void);
+void digest_gost2012_256_destroy(void);
+void digest_gost2012_512_destroy(void);
/* EVP_MD structure for GOST 28147 in MAC mode */
-extern EVP_MD imit_gost_cpa;
-extern EVP_MD imit_gost_cp_12;
+EVP_MD *imit_gost_cpa(void);
+void imit_gost_cpa_destroy(void);
+EVP_MD *imit_gost_cp_12(void);
+void imit_gost_cp_12_destroy(void);
/* Cipher context used for EVP_CIPHER operation */
struct ossl_gost_cipher_ctx {
int paramNID;
static int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from);
static int gost_digest_cleanup(EVP_MD_CTX *ctx);
-EVP_MD digest_gost = {
- NID_id_GostR3411_94,
- NID_undef,
- 32,
- EVP_MD_FLAG_PKEY_METHOD_SIGNATURE,
- gost_digest_init,
- gost_digest_update,
- gost_digest_final,
- gost_digest_copy,
- gost_digest_cleanup,
- NULL,
- NULL,
- {NID_undef, NID_undef, 0, 0, 0},
- 32,
- sizeof(struct ossl_gost_digest_ctx),
- NULL
-};
+static EVP_MD *_hidden_GostR3411_94_md = NULL;
+
+EVP_MD *digest_gost(void)
+{
+ if (_hidden_GostR3411_94_md == NULL) {
+ EVP_MD *md;
+
+ if ((md = EVP_MD_meth_new(NID_id_GostR3411_94, NID_undef)) == NULL
+ || !EVP_MD_meth_set_result_size(md, 32)
+ || !EVP_MD_meth_set_input_blocksize(md, 32)
+ || !EVP_MD_meth_set_app_datasize(md,
+ sizeof(struct ossl_gost_digest_ctx))
+ || !EVP_MD_meth_set_init(md, gost_digest_init)
+ || !EVP_MD_meth_set_update(md, gost_digest_update)
+ || !EVP_MD_meth_set_final(md, gost_digest_final)
+ || !EVP_MD_meth_set_copy(md, gost_digest_copy)
+ || !EVP_MD_meth_set_cleanup(md, gost_digest_cleanup)) {
+ EVP_MD_meth_free(md);
+ md = NULL;
+ }
+ _hidden_GostR3411_94_md = md;
+ }
+ return _hidden_GostR3411_94_md;
+}
+
+void digest_gost_destroy(void)
+{
+ EVP_MD_meth_free(_hidden_GostR3411_94_md);
+ _hidden_GostR3411_94_md = NULL;
+}
int gost_digest_init(EVP_MD_CTX *ctx)
{
- struct ossl_gost_digest_ctx *c = ctx->md_data;
+ struct ossl_gost_digest_ctx *c = EVP_MD_CTX_md_data(ctx);
memset(&(c->dctx), 0, sizeof(gost_hash_ctx));
gost_init(&(c->cctx), &GostR3411_94_CryptoProParamSet);
c->dctx.cipher_ctx = &(c->cctx);
int gost_digest_update(EVP_MD_CTX *ctx, const void *data, size_t count)
{
- return hash_block((gost_hash_ctx *) ctx->md_data, data, count);
+ return hash_block((gost_hash_ctx *) EVP_MD_CTX_md_data(ctx), data, count);
}
int gost_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
{
- return finish_hash((gost_hash_ctx *) ctx->md_data, md);
+ return finish_hash((gost_hash_ctx *) EVP_MD_CTX_md_data(ctx), md);
}
int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
{
- struct ossl_gost_digest_ctx *md_ctx = to->md_data;
- if (to->md_data && from->md_data) {
- memcpy(to->md_data, from->md_data,
+ struct ossl_gost_digest_ctx *md_ctx = EVP_MD_CTX_md_data(to);
+ 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),
sizeof(struct ossl_gost_digest_ctx));
md_ctx->dctx.cipher_ctx = &(md_ctx->cctx);
}
int gost_digest_cleanup(EVP_MD_CTX *ctx)
{
- if (ctx->md_data)
- memset(ctx->md_data, 0, sizeof(struct ossl_gost_digest_ctx));
+ if (EVP_MD_CTX_md_data(ctx))
+ memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_digest_ctx));
return 1;
}
const char micalg_256[] = "gostr3411-2012-256";
const char micalg_512[] = "gostr3411-2012-512";
-EVP_MD digest_gost2012_512 = {
- NID_id_GostR3411_2012_512,
- NID_undef,
- 64, /* digest size */
- EVP_MD_FLAG_PKEY_METHOD_SIGNATURE,
- gost_digest_init512,
- gost_digest_update,
- gost_digest_final,
- gost_digest_copy,
- gost_digest_cleanup,
- NULL,
- NULL,
- {NID_undef, NID_undef, 0, 0, 0},
- 64, /* block size */
- sizeof(gost2012_hash_ctx),
- gost_digest_ctrl_512,
-};
-
-EVP_MD digest_gost2012_256 = {
- NID_id_GostR3411_2012_256,
- NID_undef,
- 32, /* digest size */
- EVP_MD_FLAG_PKEY_METHOD_SIGNATURE,
- gost_digest_init256,
- gost_digest_update,
- gost_digest_final,
- gost_digest_copy,
- gost_digest_cleanup,
- NULL,
- NULL,
- {NID_undef, NID_undef, 0, 0, 0},
- 64, /* block size */
- sizeof(gost2012_hash_ctx),
- gost_digest_ctrl_256
-};
+static EVP_MD *_hidden_GostR3411_2012_256_md = NULL;
+static EVP_MD *_hidden_GostR3411_2012_512_md = NULL;
+
+EVP_MD *digest_gost2012_256(void)
+{
+ if (_hidden_GostR3411_2012_256_md == NULL) {
+ EVP_MD *md;
+
+ if ((md = EVP_MD_meth_new(NID_id_GostR3411_2012_256, NID_undef)) == NULL
+ || !EVP_MD_meth_set_result_size(md, 32)
+ || !EVP_MD_meth_set_input_blocksize(md, 64)
+ || !EVP_MD_meth_set_app_datasize(md, sizeof(gost2012_hash_ctx))
+ || !EVP_MD_meth_set_init(md, gost_digest_init256)
+ || !EVP_MD_meth_set_update(md, gost_digest_update)
+ || !EVP_MD_meth_set_final(md, gost_digest_final)
+ || !EVP_MD_meth_set_copy(md, gost_digest_copy)
+ || !EVP_MD_meth_set_ctrl(md, gost_digest_ctrl_256)
+ || !EVP_MD_meth_set_cleanup(md, gost_digest_cleanup)) {
+ EVP_MD_meth_free(md);
+ md = NULL;
+ }
+ _hidden_GostR3411_2012_256_md = md;
+ }
+ return _hidden_GostR3411_2012_256_md;
+}
+
+void digest_gost2012_256_destroy(void)
+{
+ EVP_MD_meth_free(_hidden_GostR3411_2012_256_md);
+ _hidden_GostR3411_2012_256_md = NULL;
+}
+
+EVP_MD *digest_gost2012_512(void)
+{
+ if (_hidden_GostR3411_2012_512_md == NULL) {
+ EVP_MD *md;
+
+ if ((md = EVP_MD_meth_new(NID_id_GostR3411_2012_512, NID_undef)) == NULL
+ || !EVP_MD_meth_set_result_size(md, 64)
+ || !EVP_MD_meth_set_input_blocksize(md, 64)
+ || !EVP_MD_meth_set_app_datasize(md, sizeof(gost2012_hash_ctx))
+ || !EVP_MD_meth_set_init(md, gost_digest_init512)
+ || !EVP_MD_meth_set_update(md, gost_digest_update)
+ || !EVP_MD_meth_set_final(md, gost_digest_final)
+ || !EVP_MD_meth_set_copy(md, gost_digest_copy)
+ || !EVP_MD_meth_set_ctrl(md, gost_digest_ctrl_512)
+ || !EVP_MD_meth_set_cleanup(md, gost_digest_cleanup)) {
+ EVP_MD_meth_free(md);
+ md = NULL;
+ }
+ _hidden_GostR3411_2012_512_md = md;
+ }
+ return _hidden_GostR3411_2012_512_md;
+}
+
+void digest_gost2012_512_destroy(void)
+{
+ EVP_MD_meth_free(_hidden_GostR3411_2012_512_md);
+ _hidden_GostR3411_2012_512_md = NULL;
+}
static int gost_digest_init512(EVP_MD_CTX *ctx)
{
- init_gost2012_hash_ctx((gost2012_hash_ctx *) ctx->md_data, 512);
+ init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), 512);
return 1;
}
static int gost_digest_init256(EVP_MD_CTX *ctx)
{
- init_gost2012_hash_ctx((gost2012_hash_ctx *) ctx->md_data, 256);
+ init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), 256);
return 1;
}
static int gost_digest_update(EVP_MD_CTX *ctx, const void *data, size_t count)
{
- gost2012_hash_block((gost2012_hash_ctx *) ctx->md_data, data, count);
+ gost2012_hash_block((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), data, count);
return 1;
}
static int gost_digest_final(EVP_MD_CTX *ctx, unsigned char *md)
{
- gost2012_finish_hash((gost2012_hash_ctx *) ctx->md_data, md);
+ gost2012_finish_hash((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), md);
return 1;
}
static int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
{
- if (to->md_data && from->md_data)
- memcpy(to->md_data, from->md_data, sizeof(gost2012_hash_ctx));
+ 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), sizeof(gost2012_hash_ctx));
return 1;
}
static int gost_digest_cleanup(EVP_MD_CTX *ctx)
{
- if (ctx->md_data)
- memset(ctx->md_data, 0x00, sizeof(gost2012_hash_ctx));
+ if (EVP_MD_CTX_md_data(ctx))
+ memset(EVP_MD_CTX_md_data(ctx), 0x00, sizeof(gost2012_hash_ctx));
return 1;
}
case EVP_PKEY_CTRL_SET_IV:
OPENSSL_assert(p2 != NULL);
pctx->shared_ukm = OPENSSL_malloc((int)p1);
- if (!pctx->shared_ukm)
+ if (pctx->shared_ukm == NULL) {
+ GOSTerr(GOST_F_PKEY_GOST_CTRL, ERR_R_MALLOC_FAILURE);
return 0;
+ }
memcpy(pctx->shared_ukm, p2, (int)p1);
return 1;
case EVP_PKEY_CTRL_PEER_KEY:
GOST_R_MAC_KEY_NOT_SET);
return 0;
}
- return mctx->digest->md_ctrl(mctx, EVP_MD_CTRL_SET_KEY, 0,
- key);
+ return EVP_MD_meth_get_ctrl(EVP_MD_CTX_md(mctx))
+ (mctx, EVP_MD_CTRL_SET_KEY, 0, key);
} else {
- return mctx->digest->md_ctrl(mctx, EVP_MD_CTRL_SET_KEY, 32,
- &(data->key));
+ return EVP_MD_meth_get_ctrl(EVP_MD_CTX_md(mctx))
+ (mctx, EVP_MD_CTRL_SET_KEY, 32, &(data->key));
}
- return mctx->digest->md_ctrl(mctx, EVP_MD_CTRL_SET_KEY, 32, key);
}
case EVP_PKEY_CTRL_MAC_LEN:
{
return 1;
}
- mctx->digest->md_ctrl(mctx, EVP_MD_CTRL_MAC_LEN, data->mac_size, NULL);
+ EVP_MD_meth_get_ctrl(EVP_MD_CTX_md(mctx))
+ (mctx, EVP_MD_CTRL_MAC_LEN, data->mac_size, NULL);
ret = EVP_DigestFinal_ex(mctx, sig, &tmpsiglen);
*siglen = data->mac_size;
return ret;