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* certbuf, int certlen, |
| 206 CERTImportCertificateFunc f, void* arg); |
| 207 #endif |
205 | 208 |
206 struct pkix_DecodeFuncStr { | 209 struct pkix_DecodeFuncStr { |
207 pkix_DecodeCertsFunc func; /* function pointer to the | 210 pkix_DecodeCertsFunc func; /* function pointer to the |
208 * CERT_DecodeCertPackage function */ | 211 * CERT_DecodeCertPackage function */ |
209 PRLibrary *smimeLib; /* Pointer to the smime shared lib*/ | 212 PRLibrary *smimeLib; /* Pointer to the smime shared lib*/ |
210 PRCallOnceType once; | 213 PRCallOnceType once; |
211 }; | 214 }; |
212 | 215 |
213 static struct pkix_DecodeFuncStr pkix_decodeFunc; | 216 static struct pkix_DecodeFuncStr pkix_decodeFunc; |
214 static const PRCallOnceType pkix_pristine; | 217 static const PRCallOnceType pkix_pristine; |
215 | 218 |
216 #define SMIME_LIB_NAME SHLIB_PREFIX"smime3."SHLIB_SUFFIX | 219 #define SMIME_LIB_NAME SHLIB_PREFIX"smime3."SHLIB_SUFFIX |
217 | 220 |
218 /* | 221 /* |
219 * load the smime library and look up the SEC_ReadPKCS7Certs function. | 222 * 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, | 223 * 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 | 224 * and also so we don't have to load the smime library in applications that |
222 * don't use it. | 225 * don't use it. |
223 */ | 226 */ |
224 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void) | 227 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void) |
225 { | 228 { |
| 229 #ifdef NSS_STATIC |
| 230 pkix_decodeFunc.smimeLib = NULL; |
| 231 pkix_decodeFunc.func = CERT_DecodeCertPackage; |
| 232 return PR_SUCCESS; |
| 233 #else |
226 pkix_decodeFunc.smimeLib = | 234 pkix_decodeFunc.smimeLib = |
227 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX); | 235 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX); |
228 if (pkix_decodeFunc.smimeLib == NULL) { | 236 if (pkix_decodeFunc.smimeLib == NULL) { |
229 return PR_FAILURE; | 237 return PR_FAILURE; |
230 } | 238 } |
231 | 239 |
232 pkix_decodeFunc.func = (pkix_DecodeCertsFunc) PR_FindFunctionSymbol( | 240 pkix_decodeFunc.func = (pkix_DecodeCertsFunc) PR_FindFunctionSymbol( |
233 pkix_decodeFunc.smimeLib, "CERT_DecodeCertPackage"); | 241 pkix_decodeFunc.smimeLib, "CERT_DecodeCertPackage"); |
234 if (!pkix_decodeFunc.func) { | 242 if (!pkix_decodeFunc.func) { |
235 return PR_FAILURE; | 243 return PR_FAILURE; |
236 } | 244 } |
237 return PR_SUCCESS; | 245 return PR_SUCCESS; |
238 | 246 #endif |
239 } | 247 } |
240 | 248 |
241 /* | 249 /* |
242 * clears our global state on shutdown. | 250 * clears our global state on shutdown. |
243 */ | 251 */ |
244 void | 252 void |
245 pkix_pl_HttpCertStore_Shutdown(void *plContext) | 253 pkix_pl_HttpCertStore_Shutdown(void *plContext) |
246 { | 254 { |
247 if (pkix_decodeFunc.smimeLib) { | 255 if (pkix_decodeFunc.smimeLib) { |
248 PR_UnloadLibrary(pkix_decodeFunc.smimeLib); | 256 PR_UnloadLibrary(pkix_decodeFunc.smimeLib); |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 cleanup: | 1146 cleanup: |
1139 | 1147 |
1140 PKIX_DECREF(formatString); | 1148 PKIX_DECREF(formatString); |
1141 PKIX_DECREF(hostString); | 1149 PKIX_DECREF(hostString); |
1142 PKIX_DECREF(domainString); | 1150 PKIX_DECREF(domainString); |
1143 PKIX_DECREF(socket); | 1151 PKIX_DECREF(socket); |
1144 | 1152 |
1145 PKIX_RETURN(CERTSTORE); | 1153 PKIX_RETURN(CERTSTORE); |
1146 } | 1154 } |
1147 | 1155 |
OLD | NEW |