1 Based on http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/nss/patches/nss-static.patch
3 --- a/a/nss/lib/certhigh/certvfy.c Tue May 28 23:37:46 2013 +0200
4 +++ a/a/nss/lib/certhigh/certvfy.c Fri May 31 17:44:06 2013 -0700
9 +#ifndef NSS_DISABLE_LIBPKIX
11 /*#include "pkix_sample_modules.h" */
12 #include "pkix_pl_cert.h"
13 +#endif /* NSS_DISABLE_LIBPKIX */
21 +#ifdef NSS_DISABLE_LIBPKIX
23 +cert_VerifyCertChainPkix(
24 + CERTCertificate *cert,
26 + SECCertUsage requiredUsage,
33 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
38 +CERT_SetUsePKIXForValidation(PRBool enable)
40 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
45 +CERT_GetUsePKIXForValidation()
50 +SECStatus CERT_PKIXVerifyCert(
51 + CERTCertificate *cert,
52 + SECCertificateUsage usages,
53 + CERTValInParam *paramsIn,
54 + CERTValOutParam *paramsOut,
57 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
60 +#endif /* NSS_DISABLE_LIBPKIX */
63 * Check the validity times of a certificate
65 --- a/a/nss/lib/ckfw/nssck.api Tue May 28 23:37:46 2013 +0200
66 +++ a/a/nss/lib/ckfw/nssck.api Fri May 31 17:44:06 2013 -0700
69 #endif /* DECLARE_STRICT_CRYPTOKI_NAMES */
71 -static CK_RV CK_ENTRY
73 __ADJOIN(MODULE_NAME,C_GetFunctionList)
75 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
77 __ADJOIN(MODULE_NAME,C_WaitForSlotEvent)
80 -static CK_RV CK_ENTRY
82 __ADJOIN(MODULE_NAME,C_GetFunctionList)
84 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
91 /* This one is always present */
96 return __ADJOIN(MODULE_NAME,C_GetFunctionList)(ppFunctionList);
102 --- a/a/nss/lib/freebl/rsa.c Tue May 28 23:37:46 2013 +0200
103 +++ a/a/nss/lib/freebl/rsa.c Fri May 31 17:44:06 2013 -0700
104 @@ -1559,6 +1559,14 @@
116 PRBool bl_parentForkedAfterC_Initialize;
119 --- a/a/nss/lib/freebl/shvfy.c Tue May 28 23:37:46 2013 +0200
120 +++ a/a/nss/lib/freebl/shvfy.c Fri May 31 17:44:06 2013 -0700
126 + * Define PSEUDO_FIPS if you can't do FIPS software integrity test (e.g.,
127 + * if you're using NSS as static libraries), but want to conform to the
128 + * rest of the FIPS requirements.
136 BLAPI_SHVerify(const char *name, PRFuncPtr addr)
139 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
141 PRBool result = PR_FALSE; /* if anything goes wrong,
142 * the signature does not verify */
143 /* find our shared library name */
144 @@ -291,11 +303,15 @@
148 +#endif /* PSEUDO_FIPS */
152 BLAPI_SHVerifyFile(const char *shName)
155 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
157 char *checkName = NULL;
158 PRFileDesc *checkFD = NULL;
159 PRFileDesc *shFD = NULL;
164 +#endif /* PSEUDO_FIPS */
168 --- a/a/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c Tue May 28 23:37:46 2013 +0200
169 +++ a/a/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c Fri May 31 17:44:06 2013 -0700
172 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen,
173 CERTImportCertificateFunc f, void *arg);
177 +extern SECStatus CERT_DecodeCertPackage(char* certbuf, int certlen,
178 + CERTImportCertificateFunc f, void* arg);
181 struct pkix_DecodeFuncStr {
182 pkix_DecodeCertsFunc func; /* function pointer to the
185 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
188 + pkix_decodeFunc.smimeLib = NULL;
189 + pkix_decodeFunc.func = CERT_DecodeCertPackage;
192 pkix_decodeFunc.smimeLib =
193 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
194 if (pkix_decodeFunc.smimeLib == NULL) {
204 --- a/a/nss/lib/nss/nssinit.c Tue May 28 23:37:46 2013 +0200
205 +++ a/a/nss/lib/nss/nssinit.c Fri May 31 17:44:06 2013 -0700
210 +#ifndef NSS_DISABLE_LIBPKIX
213 #include "pkix_tools.h"
214 +#endif /* NSS_DISABLE_LIBPKIX */
216 #include "pki3hack.h"
219 PRBool dontFinalizeModules)
221 SECStatus rv = SECFailure;
222 +#ifndef NSS_DISABLE_LIBPKIX
223 PKIX_UInt32 actualMinorVersion = 0;
224 PKIX_Error *pkixError = NULL;
226 PRBool isReallyInitted;
227 char *configStrings = NULL;
228 char *configName = NULL;
231 cert_CreateSubjectKeyIDHashTable();
233 +#ifndef NSS_DISABLE_LIBPKIX
234 pkixError = PKIX_Initialize
235 (PKIX_FALSE, PKIX_MAJOR_VERSION, PKIX_MINOR_VERSION,
236 PKIX_MINOR_VERSION, &actualMinorVersion, &plContext);
238 CERT_SetUsePKIXForValidation(PR_TRUE);
241 +#endif /* NSS_DISABLE_LIBPKIX */
245 @@ -1081,7 +1087,9 @@
248 OCSP_ShutdownGlobal();
249 +#ifndef NSS_DISABLE_LIBPKIX
250 PKIX_Shutdown(plContext);
253 status = STAN_Shutdown();
254 cert_DestroySubjectKeyIDHashTable();
255 --- a/a/nss/lib/pk11wrap/pk11load.c Tue May 28 23:37:46 2013 +0200
256 +++ a/a/nss/lib/pk11wrap/pk11load.c Fri May 31 17:44:06 2013 -0700
263 +extern CK_RV NSC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
264 +extern CK_RV FC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
265 +extern char **NSC_ModuleDBFunc(unsigned long function,char *parameters, void *args);
266 +extern CK_RV builtinsC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
268 static const char* my_shlib_name =
269 SHLIB_PREFIX"nss"SHLIB_VERSION"."SHLIB_SUFFIX;
270 static const char* softoken_shlib_name =
271 @@ -326,12 +332,14 @@
272 static PRCallOnceType loadSoftokenOnce;
273 static PRLibrary* softokenLib;
274 static PRInt32 softokenLoadCount;
275 +#endif /* NSS_STATIC */
280 #include "prsystem.h"
283 /* This function must be run only once. */
284 /* determine if hybrid platform, then actually load the DSO. */
290 +#endif /* !NSS_STATIC */
293 * load a new module into our address space and initialize it.
296 /* intenal modules get loaded from their internal list */
297 if (mod->internal && (mod->dllName == NULL)) {
300 + entry = FC_GetFunctionList;
302 + entry = NSC_GetFunctionList;
304 + if (mod->isModuleDB) {
305 + mod->moduleDBFunc = NSC_ModuleDBFunc;
309 * Loads softoken as a dynamic library,
310 * even though the rest of NSS assumes this as the "internal" module.
312 mod->moduleDBFunc = (CK_C_GetFunctionList)
313 PR_FindSymbol(softokenLib, "NSC_ModuleDBFunc");
317 if (mod->moduleDBOnly) {
318 mod->loaded = PR_TRUE;
320 if (mod->dllName == NULL) {
323 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
324 + if (strstr(mod->dllName, "nssckbi") != NULL) {
325 + mod->library = NULL;
326 + PORT_Assert(!mod->moduleDBOnly);
327 + entry = builtinsC_GetFunctionList;
328 + PORT_Assert(!mod->isModuleDB);
329 + goto library_loaded;
333 /* load the library. If this succeeds, then we have to remember to
334 * unload the library if anything goes wrong from here on out...
336 mod->moduleDBFunc = (void *)
337 PR_FindSymbol(library, "NSS_ReturnModuleSpecData");
339 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
342 if (mod->moduleDBFunc == NULL) mod->isModuleDB = PR_FALSE;
344 if (mod->isModuleDB) {
346 * if not, we should change this to SECFailure and move it above the
347 * mod->loaded = PR_FALSE; */
348 if (mod->internal && (mod->dllName == NULL)) {
350 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) {
352 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
353 @@ -573,12 +606,18 @@
355 loadSoftokenOnce = pristineCallOnce;
361 library = (PRLibrary *)mod->library;
363 if (library == NULL) {
364 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
365 + if (strstr(mod->dllName, "nssckbi") != NULL) {
372 --- a/a/nss/lib/softoken/lgglue.c Tue May 28 23:37:46 2013 +0200
373 +++ a/a/nss/lib/softoken/lgglue.c Fri May 31 17:44:06 2013 -0700
375 static LGAddSecmodFunc legacy_glue_addSecmod = NULL;
376 static LGShutdownFunc legacy_glue_shutdown = NULL;
381 * The following 3 functions duplicate the work done by bl_LoadLibrary.
382 * We should make bl_LoadLibrary a global and replace the call to
387 +#endif /* STATIC LIBRARIES */
390 * stub files for legacy db's to be able to encrypt and decrypt
396 +#ifdef NSS_DISABLE_DBM
399 + lib = (PRLibrary *) 0x8;
401 + legacy_glue_open = legacy_Open;
402 + legacy_glue_readSecmod = legacy_ReadSecmodDB;
403 + legacy_glue_releaseSecmod = legacy_ReleaseSecmodDBData;
404 + legacy_glue_deleteSecmod = legacy_DeleteSecmodDB;
405 + legacy_glue_addSecmod = legacy_AddSecmodDB;
406 + legacy_glue_shutdown = legacy_Shutdown;
407 + setCryptFunction = legacy_SetCryptFunctions;
410 lib = sftkdb_LoadLibrary(LEGACY_LIB_NAME);
413 @@ -297,11 +314,14 @@
414 PR_UnloadLibrary(lib);
417 +#endif /* NSS_STATIC */
419 /* verify the loaded library if we are in FIPS mode */
421 if (!BLAPI_SHVerify(LEGACY_LIB_NAME,(PRFuncPtr)legacy_glue_open)) {
423 PR_UnloadLibrary(lib);
427 legacy_glue_libCheckSucceeded = PR_TRUE;
428 @@ -418,10 +438,12 @@
430 crv = (*legacy_glue_shutdown)(parentForkedAfterC_Initialize);
433 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
434 if (!disableUnload) {
435 PR_UnloadLibrary(legacy_glue_lib);
438 legacy_glue_lib = NULL;
439 legacy_glue_open = NULL;
440 legacy_glue_readSecmod = NULL;
441 --- a/a/nss/lib/softoken/lgglue.h Tue May 28 23:37:46 2013 +0200
442 +++ a/a/nss/lib/softoken/lgglue.h Fri May 31 17:44:06 2013 -0700
444 typedef void (*LGSetForkStateFunc)(PRBool);
445 typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc);
447 +extern CK_RV legacy_Open(const char *dir, const char *certPrefix,
448 + const char *keyPrefix,
449 + int certVersion, int keyVersion, int flags,
450 + SDB **certDB, SDB **keyDB);
451 +extern char ** legacy_ReadSecmodDB(const char *appName,
452 + const char *filename,
453 + const char *dbname, char *params, PRBool rw);
454 +extern SECStatus legacy_ReleaseSecmodDBData(const char *appName,
455 + const char *filename,
456 + const char *dbname, char **params, PRBool rw);
457 +extern SECStatus legacy_DeleteSecmodDB(const char *appName,
458 + const char *filename,
459 + const char *dbname, char *params, PRBool rw);
460 +extern SECStatus legacy_AddSecmodDB(const char *appName,
461 + const char *filename,
462 + const char *dbname, char *params, PRBool rw);
463 +extern SECStatus legacy_Shutdown(PRBool forked);
464 +extern void legacy_SetCryptFunctions(LGEncryptFunc, LGDecryptFunc);
467 * Softoken Glue Functions
469 --- a/a/nss/lib/util/secport.h Tue May 28 23:37:46 2013 +0200
470 +++ a/a/nss/lib/util/secport.h Fri May 31 17:44:06 2013 -0700
473 extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n);
478 * Load a shared library called "newShLibName" in the same directory as
479 * a shared library that is already loaded, called existingShLibName.
481 PORT_LoadLibraryFromOrigin(const char* existingShLibName,
482 PRFuncPtr staticShLibFunc,
483 const char *newShLibName);
484 +#endif /* NSS_STATIC */