X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_ctl.c;h=889df6d25882b488bd84acad9078a47b8ea9b59d;hb=refs%2Fheads%2Fmgm_impl;hp=31b95a0d21bd8479dd531b07f34f0466201c4ef8;hpb=02f99b2e3b46f4ff44fd5420487551d5a447c2ad;p=openssl-gost%2Fengine.git diff --git a/gost_ctl.c b/gost_ctl.c index 31b95a0..889df6d 100644 --- a/gost_ctl.c +++ b/gost_ctl.c @@ -15,23 +15,22 @@ #include "gost_lcl.h" static char *gost_params[GOST_PARAM_MAX + 1] = { NULL }; -static const char *gost_envnames[] = { "CRYPT_PARAMS" }; +static const char *gost_envnames[] = + { "CRYPT_PARAMS", "GOST_PBE_HMAC", "GOST_PK_FORMAT" }; const ENGINE_CMD_DEFN gost_cmds[] = { -/*- { GOST_CTRL_RNG, - "RNG", - "Type of random number generator to use", - ENGINE_CMD_FLAG_STRING - }, - { GOST_CTRL_RNG_PARAMS, - "RNG_PARAMS", - "Parameter for random number generator", - ENGINE_CMD_FLAG_STRING - }, -*/ {GOST_CTRL_CRYPT_PARAMS, - "CRYPT_PARAMS", - "OID of default GOST 28147-89 parameters", - ENGINE_CMD_FLAG_STRING}, + {GOST_CTRL_CRYPT_PARAMS, + "CRYPT_PARAMS", + "OID of default GOST 28147-89 parameters", + ENGINE_CMD_FLAG_STRING}, + {GOST_CTRL_PBE_PARAMS, + "PBE_PARAMS", + "Shortname of default digest alg for PBE", + ENGINE_CMD_FLAG_STRING}, + {GOST_CTRL_PK_FORMAT, + "GOST_PK_FORMAT", + "Private key format params", + ENGINE_CMD_FLAG_STRING}, {0, NULL, NULL, 0} }; @@ -50,8 +49,9 @@ int gost_control_func(ENGINE *e, int cmd, long i, void *p, void (*f) (void)) { int param = cmd - ENGINE_CMD_BASE; int ret = 0; - if (param < 0 || param > GOST_PARAM_MAX) + if (param < 0 || param > GOST_PARAM_MAX) { return -1; + } ret = gost_set_default_param(param, p); return ret; } @@ -79,11 +79,13 @@ int gost_set_default_param(int param, const char *value) if (param < 0 || param > GOST_PARAM_MAX) return 0; tmp = getenv(gost_envnames[param]); + /* * if there is value in the environment, use it, else -passed string * */ - if (!tmp) + if (!tmp) { tmp = value; + } OPENSSL_free(gost_params[param]); gost_params[param] = BUF_strdup(tmp);