Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: openssl/engines/ccgost/gost_ctl.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/engines/ccgost/gost_crypt.c ('k') | openssl/engines/ccgost/gost_eng.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /**********************************************************************
2 * gost_ctl.c *
3 * Copyright (c) 2005-2006 Cryptocom LTD *
4 * This file is distributed under the same license as OpenSSL *
5 * *
6 * Implementation of control commands for GOST engine *
7 * OpenSSL 0.9.9 libraries required *
8 **********************************************************************/
9 #include <stdlib.h>
10 #include <string.h>
11 #include <openssl/crypto.h>
12 #include <openssl/err.h>
13 #include <openssl/engine.h>
14 #include <openssl/buffer.h>
15 #include "gost_lcl.h"
16
17 static char *gost_params[GOST_PARAM_MAX+1]={NULL};
18 static const char *gost_envnames[]={"CRYPT_PARAMS"};
19 const ENGINE_CMD_DEFN gost_cmds[]=
20 {
21 /* { GOST_CTRL_RNG,
22 "RNG",
23 "Type of random number generator to use",
24 ENGINE_CMD_FLAG_STRING
25 },
26 { GOST_CTRL_RNG_PARAMS,
27 "RNG_PARAMS",
28 "Parameter for random number generator",
29 ENGINE_CMD_FLAG_STRING
30 },
31 */ { GOST_CTRL_CRYPT_PARAMS,
32 "CRYPT_PARAMS",
33 "OID of default GOST 28147-89 parameters",
34 ENGINE_CMD_FLAG_STRING
35 },
36 {0,NULL,NULL,0}
37 };
38
39 void gost_param_free()
40 {
41 int i;
42 for (i=0;i<=GOST_PARAM_MAX;i++)
43 if (gost_params[i]!=NULL)
44 {
45 OPENSSL_free(gost_params[i]);
46 gost_params[i]=NULL;
47 }
48
49 }
50
51 int gost_control_func(ENGINE *e,int cmd,long i, void *p, void (*f)(void))
52 {
53 int param = cmd-ENGINE_CMD_BASE;
54 int ret=0;
55 if (param <0 || param >GOST_PARAM_MAX) return -1;
56 ret=gost_set_default_param(param,p);
57 return ret;
58 }
59
60 const char *get_gost_engine_param(int param)
61 {
62 char *tmp;
63 if (param <0 || param >GOST_PARAM_MAX) return NULL;
64 if (gost_params[param]!=NULL)
65 {
66 return gost_params[param];
67 }
68 tmp = getenv(gost_envnames[param]);
69 if (tmp)
70 {
71 if (gost_params[param]) OPENSSL_free(gost_params[param]);
72 gost_params[param] = BUF_strdup(tmp);
73 return gost_params[param];
74 }
75 return NULL;
76 }
77
78 int gost_set_default_param(int param, const char *value)
79 {
80 const char *tmp;
81 if (param <0 || param >GOST_PARAM_MAX) return 0;
82 tmp = getenv(gost_envnames[param]);
83 /* if there is value in the environment, use it, else -passed string * * /
84 if (!tmp) tmp=value;
85 if (gost_params[param]) OPENSSL_free(gost_params[param]);
86 gost_params[param] = BUF_strdup(tmp);
87
88 return 1;
89 }
OLDNEW
« no previous file with comments | « openssl/engines/ccgost/gost_crypt.c ('k') | openssl/engines/ccgost/gost_eng.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698