X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_ec_keyx.c;h=deca4f599896bf79c61cc7fb588fe99a150ba36a;hb=3b31dea89630ecd3f741171ed3e1d4259adabf0e;hp=de52dec2c2a703ebb4dfa50535e8b5c83cf1e154;hpb=d1cf560c742d85ab1986fb0cabe0f9e3a1f0eb23;p=openssl-gost%2Fengine.git diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index de52dec..deca4f5 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -642,7 +642,8 @@ static int pkey_gost2018_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, int pkey_gost_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, size_t *key_len, const unsigned char *in, size_t in_len) { - struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(pctx); + struct gost_pmeth_data *gctx = EVP_PKEY_CTX_get_data(pctx); +#if 0 if (data->shared_ukm == NULL || data->shared_ukm_size == 8) return pkey_GOST_ECcp_decrypt(pctx, key, key_len, in, in_len); else if (data->shared_ukm_size == 32) @@ -651,4 +652,18 @@ int pkey_gost_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, GOSTerr(GOST_F_PKEY_GOST_DECRYPT, ERR_R_INTERNAL_ERROR); return -1; } +#else + switch (gctx->cipher_nid) + { + case NID_id_Gost28147_89: + case NID_undef: /* FIXME */ + return pkey_GOST_ECcp_decrypt(pctx, key, key_len, in, in_len); + case NID_kuznyechik_ctr: + case NID_magma_ctr: + return pkey_gost2018_decrypt(pctx, key, key_len, in, in_len); + default: + GOSTerr(GOST_F_PKEY_GOST_DECRYPT, ERR_R_INTERNAL_ERROR); + return -1; + } +#endif }