diff options
author | Mike DePaulo <mikedep333@gmail.com> | 2015-03-28 09:50:31 -0400 |
---|---|---|
committer | Mike DePaulo <mikedep333@gmail.com> | 2015-03-28 13:13:13 -0400 |
commit | 91e3957fb0e38a5d5649f82e5d9f89dd0e85666f (patch) | |
tree | fe0992fb4cf6f3c2a5d597557552ae69caccbe70 /openssl/engines/ccgost/gost_ctl.c | |
parent | 9073d97eff3f6d3b33450ef3532a826674c7e1e8 (diff) | |
download | vcxsrv-91e3957fb0e38a5d5649f82e5d9f89dd0e85666f.tar.gz vcxsrv-91e3957fb0e38a5d5649f82e5d9f89dd0e85666f.tar.bz2 vcxsrv-91e3957fb0e38a5d5649f82e5d9f89dd0e85666f.zip |
Update openssl to version openssl-1.0.1m
Conflicts:
openssl/Makefile
openssl/Makefile.bak
openssl/crypto/cryptlib.c
Diffstat (limited to 'openssl/engines/ccgost/gost_ctl.c')
-rw-r--r-- | openssl/engines/ccgost/gost_ctl.c | 138 |
1 files changed, 71 insertions, 67 deletions
diff --git a/openssl/engines/ccgost/gost_ctl.c b/openssl/engines/ccgost/gost_ctl.c index d3cd17181..6c93c4584 100644 --- a/openssl/engines/ccgost/gost_ctl.c +++ b/openssl/engines/ccgost/gost_ctl.c @@ -5,7 +5,7 @@ * * * Implementation of control commands for GOST engine * * OpenSSL 0.9.9 libraries required * - **********************************************************************/ + **********************************************************************/ #include <stdlib.h> #include <string.h> #include <openssl/crypto.h> @@ -14,76 +14,80 @@ #include <openssl/buffer.h> #include "gost_lcl.h" -static char *gost_params[GOST_PARAM_MAX+1]={NULL}; -static const char *gost_envnames[]={"CRYPT_PARAMS"}; -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 - }, -{0,NULL,NULL,0} - }; +static char *gost_params[GOST_PARAM_MAX + 1] = { NULL }; +static const char *gost_envnames[] = { "CRYPT_PARAMS" }; -void gost_param_free() +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}, + {0, NULL, NULL, 0} +}; + +void gost_param_free() { - int i; - for (i=0;i<=GOST_PARAM_MAX;i++) - if (gost_params[i]!=NULL) - { - OPENSSL_free(gost_params[i]); - gost_params[i]=NULL; - } - + int i; + for (i = 0; i <= GOST_PARAM_MAX; i++) + if (gost_params[i] != NULL) { + OPENSSL_free(gost_params[i]); + gost_params[i] = NULL; + } + } -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) return -1; - ret=gost_set_default_param(param,p); - return ret; - } +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) + return -1; + ret = gost_set_default_param(param, p); + return ret; +} -const char *get_gost_engine_param(int param) - { - char *tmp; - if (param <0 || param >GOST_PARAM_MAX) return NULL; - if (gost_params[param]!=NULL) - { - return gost_params[param]; - } - tmp = getenv(gost_envnames[param]); - if (tmp) - { - if (gost_params[param]) OPENSSL_free(gost_params[param]); - gost_params[param] = BUF_strdup(tmp); - return gost_params[param]; - } - return NULL; - } +const char *get_gost_engine_param(int param) +{ + char *tmp; + if (param < 0 || param > GOST_PARAM_MAX) + return NULL; + if (gost_params[param] != NULL) { + return gost_params[param]; + } + tmp = getenv(gost_envnames[param]); + if (tmp) { + if (gost_params[param]) + OPENSSL_free(gost_params[param]); + gost_params[param] = BUF_strdup(tmp); + return gost_params[param]; + } + return NULL; +} -int gost_set_default_param(int param, const char *value) - { - const char *tmp; - 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) tmp=value; - if (gost_params[param]) OPENSSL_free(gost_params[param]); - gost_params[param] = BUF_strdup(tmp); +int gost_set_default_param(int param, const char *value) +{ + const char *tmp; + 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) + tmp = value; + if (gost_params[param]) + OPENSSL_free(gost_params[param]); + gost_params[param] = BUF_strdup(tmp); - return 1; - } + return 1; +} |