X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_pmeth.c;h=a29e5f08cb5860644811396c83a0010de43fc4b0;hb=14e654cab19089027b00733594480eb03d8c6da5;hp=ce162f55d3a3e2a2e9783107f556ba2d433ad65d;hpb=0d84f62acc3a66a91d846a15824b9d939d54aa79;p=openssl-gost%2Fengine.git diff --git a/gost_pmeth.c b/gost_pmeth.c index ce162f5..a29e5f0 100644 --- a/gost_pmeth.c +++ b/gost_pmeth.c @@ -283,7 +283,7 @@ static int pkey_gost2001_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) EC_KEY *ec = NULL; if (!data || data->sign_param_nid == NID_undef) { - GOSTerr(GOST_F_PKEY_GOST01_PARAMGEN, GOST_R_NO_PARAMETERS_SET); + GOSTerr(GOST_F_PKEY_GOST2001_PARAMGEN, GOST_R_NO_PARAMETERS_SET); return 0; } @@ -303,7 +303,7 @@ static int pkey_gost2012_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) int result = 0; if (!data || data->sign_param_nid == NID_undef) { - GOSTerr(GOST_F_PKEY_GOST12_PARAMGEN, GOST_R_NO_PARAMETERS_SET); + GOSTerr(GOST_F_PKEY_GOST2012_PARAMGEN, GOST_R_NO_PARAMETERS_SET); return 0; } @@ -523,7 +523,8 @@ static int pkey_gost_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) case EVP_PKEY_CTRL_MD: { int nid = EVP_MD_type((const EVP_MD *)p2); - if (nid != NID_id_Gost28147_89_MAC && nid != NID_gost_mac_12) { + if (nid != NID_id_Gost28147_89_MAC && nid != NID_gost_mac_12 + && nid != NID_magma_mac && nid != NID_grasshopper_mac) { GOSTerr(GOST_F_PKEY_GOST_MAC_CTRL, GOST_R_INVALID_DIGEST_TYPE); return 0; @@ -657,7 +658,7 @@ static int pkey_gost_mac_keygen_base(EVP_PKEY_CTX *ctx, struct gost_mac_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx); struct gost_mac_key *keydata; if (!data || !data->key_set) { - GOSTerr(GOST_F_PKEY_GOST_MAC_KEYGEN, GOST_R_MAC_KEY_NOT_SET); + GOSTerr(GOST_F_PKEY_GOST_MAC_KEYGEN_BASE, GOST_R_MAC_KEY_NOT_SET); return 0; } keydata = OPENSSL_malloc(sizeof(struct gost_mac_key)); @@ -802,6 +803,28 @@ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth, int flags) EVP_PKEY_meth_set_cleanup(*pmeth, pkey_gost_mac_cleanup); EVP_PKEY_meth_set_copy(*pmeth, pkey_gost_mac_copy); return 1; +/* TODO + case NID_magma_mac: + EVP_PKEY_meth_set_ctrl(*pmeth, pkey_gost_mac_ctrl, + pkey_gost_mac_ctrl_str); + EVP_PKEY_meth_set_signctx(*pmeth, pkey_gost_mac_signctx_init, + pkey_gost_mac_signctx); + EVP_PKEY_meth_set_keygen(*pmeth, NULL, pkey_gost_mac_keygen_12); + EVP_PKEY_meth_set_init(*pmeth, pkey_gost_mac_init); + EVP_PKEY_meth_set_cleanup(*pmeth, pkey_gost_mac_cleanup); + EVP_PKEY_meth_set_copy(*pmeth, pkey_gost_mac_copy); + return 1; + case NID_grasshopper_mac: + EVP_PKEY_meth_set_ctrl(*pmeth, pkey_gost_mac_ctrl, + pkey_gost_mac_ctrl_str); + EVP_PKEY_meth_set_signctx(*pmeth, pkey_gost_mac_signctx_init, + pkey_gost_mac_signctx); + EVP_PKEY_meth_set_keygen(*pmeth, NULL, pkey_gost_mac_keygen_12); + EVP_PKEY_meth_set_init(*pmeth, pkey_gost_mac_init); + EVP_PKEY_meth_set_cleanup(*pmeth, pkey_gost_mac_cleanup); + EVP_PKEY_meth_set_copy(*pmeth, pkey_gost_mac_copy); + return 1; +*/ default: /* Unsupported method */ return 0; }