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

Side by Side Diff: openssl/crypto/conf/conf_lib.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/crypto/conf/conf_err.c ('k') | openssl/crypto/conf/conf_mall.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* conf_lib.c */ 1 /* conf_lib.c */
2 /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2 /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
5 /* ==================================================================== 5 /* ====================================================================
6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 6 * Copyright (c) 2000 The OpenSSL Project. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include <openssl/conf.h> 62 #include <openssl/conf.h>
63 #include <openssl/conf_api.h> 63 #include <openssl/conf_api.h>
64 #include <openssl/lhash.h> 64 #include <openssl/lhash.h>
65 65
66 const char CONF_version[]="CONF" OPENSSL_VERSION_PTEXT; 66 const char CONF_version[]="CONF" OPENSSL_VERSION_PTEXT;
67 67
68 static CONF_METHOD *default_CONF_method=NULL; 68 static CONF_METHOD *default_CONF_method=NULL;
69 69
70 /* Init a 'CONF' structure from an old LHASH */ 70 /* Init a 'CONF' structure from an old LHASH */
71 71
72 void CONF_set_nconf(CONF *conf, LHASH *hash) 72 void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash)
73 { 73 {
74 if (default_CONF_method == NULL) 74 if (default_CONF_method == NULL)
75 default_CONF_method = NCONF_default(); 75 default_CONF_method = NCONF_default();
76 76
77 default_CONF_method->init(conf); 77 default_CONF_method->init(conf);
78 conf->data = hash; 78 conf->data = hash;
79 } 79 }
80 80
81 /* The following section contains the "CONF classic" functions, 81 /* The following section contains the "CONF classic" functions,
82 rewritten in terms of the new CONF interface. */ 82 rewritten in terms of the new CONF interface. */
83 83
84 int CONF_set_default_method(CONF_METHOD *meth) 84 int CONF_set_default_method(CONF_METHOD *meth)
85 { 85 {
86 default_CONF_method = meth; 86 default_CONF_method = meth;
87 return 1; 87 return 1;
88 } 88 }
89 89
90 LHASH *CONF_load(LHASH *conf, const char *file, long *eline) 90 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
91 » » » » long *eline)
91 { 92 {
92 » LHASH *ltmp; 93 » LHASH_OF(CONF_VALUE) *ltmp;
93 BIO *in=NULL; 94 BIO *in=NULL;
94 95
95 #ifdef OPENSSL_SYS_VMS 96 #ifdef OPENSSL_SYS_VMS
96 in=BIO_new_file(file, "r"); 97 in=BIO_new_file(file, "r");
97 #else 98 #else
98 in=BIO_new_file(file, "rb"); 99 in=BIO_new_file(file, "rb");
99 #endif 100 #endif
100 if (in == NULL) 101 if (in == NULL)
101 { 102 {
102 CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); 103 CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB);
103 return NULL; 104 return NULL;
104 } 105 }
105 106
106 ltmp = CONF_load_bio(conf, in, eline); 107 ltmp = CONF_load_bio(conf, in, eline);
107 BIO_free(in); 108 BIO_free(in);
108 109
109 return ltmp; 110 return ltmp;
110 } 111 }
111 112
112 #ifndef OPENSSL_NO_FP_API 113 #ifndef OPENSSL_NO_FP_API
113 LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) 114 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
115 » » » » long *eline)
114 { 116 {
115 BIO *btmp; 117 BIO *btmp;
116 » LHASH *ltmp; 118 » LHASH_OF(CONF_VALUE) *ltmp;
117 if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { 119 if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) {
118 CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); 120 CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB);
119 return NULL; 121 return NULL;
120 } 122 }
121 ltmp = CONF_load_bio(conf, btmp, eline); 123 ltmp = CONF_load_bio(conf, btmp, eline);
122 BIO_free(btmp); 124 BIO_free(btmp);
123 return ltmp; 125 return ltmp;
124 } 126 }
125 #endif 127 #endif
126 128
127 LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) 129 LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
130 » » » » long *eline)
128 { 131 {
129 CONF ctmp; 132 CONF ctmp;
130 int ret; 133 int ret;
131 134
132 CONF_set_nconf(&ctmp, conf); 135 CONF_set_nconf(&ctmp, conf);
133 136
134 ret = NCONF_load_bio(&ctmp, bp, eline); 137 ret = NCONF_load_bio(&ctmp, bp, eline);
135 if (ret) 138 if (ret)
136 return ctmp.data; 139 return ctmp.data;
137 return NULL; 140 return NULL;
138 } 141 }
139 142
140 STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section) 143 STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
144 » » » » const char *section)
141 { 145 {
142 if (conf == NULL) 146 if (conf == NULL)
143 { 147 {
144 return NULL; 148 return NULL;
145 } 149 }
146 else 150 else
147 { 151 {
148 CONF ctmp; 152 CONF ctmp;
149 CONF_set_nconf(&ctmp, conf); 153 CONF_set_nconf(&ctmp, conf);
150 return NCONF_get_section(&ctmp, section); 154 return NCONF_get_section(&ctmp, section);
151 } 155 }
152 } 156 }
153 157
154 char *CONF_get_string(LHASH *conf,const char *group,const char *name) 158 char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group,
159 » » const char *name)
155 { 160 {
156 if (conf == NULL) 161 if (conf == NULL)
157 { 162 {
158 return NCONF_get_string(NULL, group, name); 163 return NCONF_get_string(NULL, group, name);
159 } 164 }
160 else 165 else
161 { 166 {
162 CONF ctmp; 167 CONF ctmp;
163 CONF_set_nconf(&ctmp, conf); 168 CONF_set_nconf(&ctmp, conf);
164 return NCONF_get_string(&ctmp, group, name); 169 return NCONF_get_string(&ctmp, group, name);
165 } 170 }
166 } 171 }
167 172
168 long CONF_get_number(LHASH *conf,const char *group,const char *name) 173 long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group,
174 » » const char *name)
169 { 175 {
170 int status; 176 int status;
171 long result = 0; 177 long result = 0;
172 178
173 if (conf == NULL) 179 if (conf == NULL)
174 { 180 {
175 status = NCONF_get_number_e(NULL, group, name, &result); 181 status = NCONF_get_number_e(NULL, group, name, &result);
176 } 182 }
177 else 183 else
178 { 184 {
179 CONF ctmp; 185 CONF ctmp;
180 CONF_set_nconf(&ctmp, conf); 186 CONF_set_nconf(&ctmp, conf);
181 status = NCONF_get_number_e(&ctmp, group, name, &result); 187 status = NCONF_get_number_e(&ctmp, group, name, &result);
182 } 188 }
183 189
184 if (status == 0) 190 if (status == 0)
185 { 191 {
186 /* This function does not believe in errors... */ 192 /* This function does not believe in errors... */
187 ERR_clear_error(); 193 ERR_clear_error();
188 } 194 }
189 return result; 195 return result;
190 } 196 }
191 197
192 void CONF_free(LHASH *conf) 198 void CONF_free(LHASH_OF(CONF_VALUE) *conf)
193 { 199 {
194 CONF ctmp; 200 CONF ctmp;
195 CONF_set_nconf(&ctmp, conf); 201 CONF_set_nconf(&ctmp, conf);
196 NCONF_free_data(&ctmp); 202 NCONF_free_data(&ctmp);
197 } 203 }
198 204
199 #ifndef OPENSSL_NO_FP_API 205 #ifndef OPENSSL_NO_FP_API
200 int CONF_dump_fp(LHASH *conf, FILE *out) 206 int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out)
201 { 207 {
202 BIO *btmp; 208 BIO *btmp;
203 int ret; 209 int ret;
204 210
205 if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { 211 if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) {
206 CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); 212 CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB);
207 return 0; 213 return 0;
208 } 214 }
209 ret = CONF_dump_bio(conf, btmp); 215 ret = CONF_dump_bio(conf, btmp);
210 BIO_free(btmp); 216 BIO_free(btmp);
211 return ret; 217 return ret;
212 } 218 }
213 #endif 219 #endif
214 220
215 int CONF_dump_bio(LHASH *conf, BIO *out) 221 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
216 { 222 {
217 CONF ctmp; 223 CONF ctmp;
218 CONF_set_nconf(&ctmp, conf); 224 CONF_set_nconf(&ctmp, conf);
219 return NCONF_dump_bio(&ctmp, out); 225 return NCONF_dump_bio(&ctmp, out);
220 } 226 }
221 227
222 /* The following section contains the "New CONF" functions. They are 228 /* The following section contains the "New CONF" functions. They are
223 completely centralised around a new CONF structure that may contain 229 completely centralised around a new CONF structure that may contain
224 basically anything, but at least a method pointer and a table of data. 230 basically anything, but at least a method pointer and a table of data.
225 These functions are also written in terms of the bridge functions used 231 These functions are also written in terms of the bridge functions used
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 398
393 status = NCONF_get_number_e(conf, group, name, &ret); 399 status = NCONF_get_number_e(conf, group, name, &ret);
394 if (status == 0) 400 if (status == 0)
395 { 401 {
396 /* This function does not believe in errors... */ 402 /* This function does not believe in errors... */
397 ERR_get_error(); 403 ERR_get_error();
398 } 404 }
399 return ret; 405 return ret;
400 } 406 }
401 #endif 407 #endif
OLDNEW
« no previous file with comments | « openssl/crypto/conf/conf_err.c ('k') | openssl/crypto/conf/conf_mall.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698