OLD | NEW |
---|---|
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * pkix_pl_httpcertstore.c | 5 * pkix_pl_httpcertstore.c |
6 * | 6 * |
7 * HTTPCertStore Function Definitions | 7 * HTTPCertStore Function Definitions |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 } | 194 } |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 return SECSuccess; | 198 return SECSuccess; |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen, | 202 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen, |
203 CERTImportCertificateFunc f, void *arg ); | 203 CERTImportCertificateFunc f, void *arg ); |
204 | 204 #ifdef NSS_STATIC |
205 extern SECStatus CERT_DecodeCertPackage(char*, int, CERTImportCertificateFunc, v oid*); | |
wtc
2013/03/01 00:29:47
This seems to be longer than 80 chars. I would inc
| |
206 #endif | |
205 | 207 |
206 struct pkix_DecodeFuncStr { | 208 struct pkix_DecodeFuncStr { |
207 pkix_DecodeCertsFunc func; /* function pointer to the | 209 pkix_DecodeCertsFunc func; /* function pointer to the |
208 * CERT_DecodeCertPackage function */ | 210 * CERT_DecodeCertPackage function */ |
209 PRLibrary *smimeLib; /* Pointer to the smime shared lib*/ | 211 PRLibrary *smimeLib; /* Pointer to the smime shared lib*/ |
210 PRCallOnceType once; | 212 PRCallOnceType once; |
211 }; | 213 }; |
212 | 214 |
213 static struct pkix_DecodeFuncStr pkix_decodeFunc; | 215 static struct pkix_DecodeFuncStr pkix_decodeFunc; |
214 static const PRCallOnceType pkix_pristine; | 216 static const PRCallOnceType pkix_pristine; |
215 | 217 |
216 #define SMIME_LIB_NAME SHLIB_PREFIX"smime3."SHLIB_SUFFIX | 218 #define SMIME_LIB_NAME SHLIB_PREFIX"smime3."SHLIB_SUFFIX |
217 | 219 |
218 /* | 220 /* |
219 * load the smime library and look up the SEC_ReadPKCS7Certs function. | 221 * load the smime library and look up the SEC_ReadPKCS7Certs function. |
220 * we do this so we don't have a circular depenency on the smime library, | 222 * we do this so we don't have a circular depenency on the smime library, |
221 * and also so we don't have to load the smime library in applications that | 223 * and also so we don't have to load the smime library in applications that |
222 * don't use it. | 224 * don't use it. |
223 */ | 225 */ |
224 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void) | 226 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void) |
225 { | 227 { |
228 #ifdef NSS_STATIC | |
229 pkix_decodeFunc.func = &CERT_DecodeCertPackage; | |
wtc
2013/03/01 00:29:47
The & is not necessary in C89 and later.
| |
230 return PR_SUCCESS; | |
231 #else | |
226 pkix_decodeFunc.smimeLib = | 232 pkix_decodeFunc.smimeLib = |
227 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX); | 233 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX); |
228 if (pkix_decodeFunc.smimeLib == NULL) { | 234 if (pkix_decodeFunc.smimeLib == NULL) { |
229 return PR_FAILURE; | 235 return PR_FAILURE; |
230 } | 236 } |
231 | 237 |
232 pkix_decodeFunc.func = (pkix_DecodeCertsFunc) PR_FindFunctionSymbol( | 238 pkix_decodeFunc.func = (pkix_DecodeCertsFunc) PR_FindFunctionSymbol( |
233 pkix_decodeFunc.smimeLib, "CERT_DecodeCertPackage"); | 239 pkix_decodeFunc.smimeLib, "CERT_DecodeCertPackage"); |
234 if (!pkix_decodeFunc.func) { | 240 if (!pkix_decodeFunc.func) { |
235 return PR_FAILURE; | 241 return PR_FAILURE; |
236 } | 242 } |
237 return PR_SUCCESS; | 243 return PR_SUCCESS; |
238 | 244 #endif |
239 } | 245 } |
240 | 246 |
241 /* | 247 /* |
242 * clears our global state on shutdown. | 248 * clears our global state on shutdown. |
243 */ | 249 */ |
244 void | 250 void |
245 pkix_pl_HttpCertStore_Shutdown(void *plContext) | 251 pkix_pl_HttpCertStore_Shutdown(void *plContext) |
246 { | 252 { |
247 if (pkix_decodeFunc.smimeLib) { | 253 if (pkix_decodeFunc.smimeLib) { |
248 PR_UnloadLibrary(pkix_decodeFunc.smimeLib); | 254 PR_UnloadLibrary(pkix_decodeFunc.smimeLib); |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 cleanup: | 1144 cleanup: |
1139 | 1145 |
1140 PKIX_DECREF(formatString); | 1146 PKIX_DECREF(formatString); |
1141 PKIX_DECREF(hostString); | 1147 PKIX_DECREF(hostString); |
1142 PKIX_DECREF(domainString); | 1148 PKIX_DECREF(domainString); |
1143 PKIX_DECREF(socket); | 1149 PKIX_DECREF(socket); |
1144 | 1150 |
1145 PKIX_RETURN(CERTSTORE); | 1151 PKIX_RETURN(CERTSTORE); |
1146 } | 1152 } |
1147 | 1153 |
OLD | NEW |