aboutsummaryrefslogtreecommitdiff
path: root/gost_ctl.c
diff options
context:
space:
mode:
authorboggard <varyanik2@gmail.com>2017-07-12 16:57:50 +0300
committerboggard <varyanik2@gmail.com>2017-07-12 16:57:50 +0300
commitf8a4b31268d06d4deea274a7d3e644cf4f84e386 (patch)
treee00f020ad49e3c955b58f27fb0fe0d8eb2a4250d /gost_ctl.c
parent47f320eef7b307d8308106ebb46d539d200af767 (diff)
downloadgost-engine-f8a4b31268d06d4deea274a7d3e644cf4f84e386.zip
gost-engine-f8a4b31268d06d4deea274a7d3e644cf4f84e386.tar.gz
gost-engine-f8a4b31268d06d4deea274a7d3e644cf4f84e386.tar.bz2
Private key format configure by openssl.cnf file
Diffstat (limited to 'gost_ctl.c')
-rw-r--r--gost_ctl.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gost_ctl.c b/gost_ctl.c
index 8e3c1c6..1387f76 100644
--- a/gost_ctl.c
+++ b/gost_ctl.c
@@ -15,7 +15,7 @@
#include "gost_lcl.h"
static char *gost_params[GOST_PARAM_MAX + 1] = { NULL };
-static const char *gost_envnames[] = { "CRYPT_PARAMS", "GOST_PBE_HMAC" };
+static const char *gost_envnames[] = { "CRYPT_PARAMS", "GOST_PBE_HMAC", "PK_PARAMS" };
const ENGINE_CMD_DEFN gost_cmds[] = {
{GOST_CTRL_CRYPT_PARAMS,
@@ -26,6 +26,10 @@ const ENGINE_CMD_DEFN gost_cmds[] = {
"PBE_PARAMS",
"Shortname of default digest alg for PBE",
ENGINE_CMD_FLAG_STRING},
+ {GOST_CTRL_PK_PARAMS,
+ "PK_PARAMS",
+ "Private key format params",
+ ENGINE_CMD_FLAG_STRING},
{0, NULL, NULL, 0}
};
@@ -44,8 +48,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;
}
@@ -73,11 +78,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);