comparison patches/nss-static.patch @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 diff -r db5b7e3c69a5 lib/certhigh/certvfy.c
2 --- a/lib/certhigh/certvfy.c Tue May 28 23:37:46 2013 +0200
3 +++ b/lib/certhigh/certvfy.c Fri May 31 17:44:06 2013 -0700
4 @@ -13,9 +13,11 @@
5 #include "certdb.h"
6 #include "certi.h"
7 #include "cryptohi.h"
8 +#ifndef NSS_DISABLE_LIBPKIX
9 #include "pkix.h"
10 /*#include "pkix_sample_modules.h" */
11 #include "pkix_pl_cert.h"
12 +#endif /* NSS_DISABLE_LIBPKIX */
13
14
15 #include "nsspki.h"
16 @@ -24,6 +26,47 @@
17 #include "pki3hack.h"
18 #include "base.h"
19
20 +#ifdef NSS_DISABLE_LIBPKIX
21 +SECStatus
22 +cert_VerifyCertChainPkix(
23 + CERTCertificate *cert,
24 + PRBool checkSig,
25 + SECCertUsage requiredUsage,
26 + PRTime time,
27 + void *wincx,
28 + CERTVerifyLog *log,
29 + PRBool *pSigerror,
30 + PRBool *pRevoked)
31 +{
32 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
33 + return SECFailure;
34 +}
35 +
36 +SECStatus
37 +CERT_SetUsePKIXForValidation(PRBool enable)
38 +{
39 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
40 + return SECFailure;
41 +}
42 +
43 +PRBool
44 +CERT_GetUsePKIXForValidation()
45 +{
46 + return PR_FALSE;
47 +}
48 +
49 +SECStatus CERT_PKIXVerifyCert(
50 + CERTCertificate *cert,
51 + SECCertificateUsage usages,
52 + CERTValInParam *paramsIn,
53 + CERTValOutParam *paramsOut,
54 + void *wincx)
55 +{
56 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
57 + return SECFailure;
58 +}
59 +#endif /* NSS_DISABLE_LIBPKIX */
60 +
61 /*
62 * Check the validity times of a certificate
63 */
64 diff -r db5b7e3c69a5 lib/ckfw/nssck.api
65 --- a/lib/ckfw/nssck.api Tue May 28 23:37:46 2013 +0200
66 +++ b/lib/ckfw/nssck.api Fri May 31 17:44:06 2013 -0700
67 @@ -1752,7 +1752,7 @@
68 }
69 #endif /* DECLARE_STRICT_CRYPTOKI_NAMES */
70
71 -static CK_RV CK_ENTRY
72 +CK_RV CK_ENTRY
73 __ADJOIN(MODULE_NAME,C_GetFunctionList)
74 (
75 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
76 @@ -1830,7 +1830,7 @@
77 __ADJOIN(MODULE_NAME,C_WaitForSlotEvent)
78 };
79
80 -static CK_RV CK_ENTRY
81 +CK_RV CK_ENTRY
82 __ADJOIN(MODULE_NAME,C_GetFunctionList)
83 (
84 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
85 @@ -1840,6 +1840,7 @@
86 return CKR_OK;
87 }
88
89 +#ifndef NSS_STATIC
90 /* This one is always present */
91 CK_RV CK_ENTRY
92 C_GetFunctionList
93 @@ -1849,6 +1850,7 @@
94 {
95 return __ADJOIN(MODULE_NAME,C_GetFunctionList)(ppFunctionList);
96 }
97 +#endif
98
99 #undef __ADJOIN
100
101 diff -r db5b7e3c69a5 lib/freebl/rsa.c
102 --- a/lib/freebl/rsa.c Tue May 28 23:37:46 2013 +0200
103 +++ b/lib/freebl/rsa.c Fri May 31 17:44:06 2013 -0700
104 @@ -1559,6 +1559,13 @@
105 RSA_Cleanup();
106 }
107
108 +#ifdef NSS_STATIC
109 +void
110 +BL_Unload(void)
111 +{
112 +}
113 +#endif
114 +
115 PRBool bl_parentForkedAfterC_Initialize;
116
117 /*
118 diff -r db5b7e3c69a5 lib/freebl/shvfy.c
119 --- a/lib/freebl/shvfy.c Tue May 28 23:37:46 2013 +0200
120 +++ b/lib/freebl/shvfy.c Fri May 31 17:44:06 2013 -0700
121 @@ -273,9 +273,21 @@
122 return SECSuccess;
123 }
124
125 +/*
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.
129 + */
130 +#ifdef NSS_STATIC
131 +#define PSEUDO_FIPS
132 +#endif
133 +
134 PRBool
135 BLAPI_SHVerify(const char *name, PRFuncPtr addr)
136 {
137 +#ifdef PSEUDO_FIPS
138 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
139 +#else
140 PRBool result = PR_FALSE; /* if anything goes wrong,
141 * the signature does not verify */
142 /* find our shared library name */
143 @@ -291,11 +303,15 @@
144 }
145
146 return result;
147 +#endif /* PSEUDO_FIPS */
148 }
149
150 PRBool
151 BLAPI_SHVerifyFile(const char *shName)
152 {
153 +#ifdef PSEUDO_FIPS
154 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
155 +#else
156 char *checkName = NULL;
157 PRFileDesc *checkFD = NULL;
158 PRFileDesc *shFD = NULL;
159 @@ -492,6 +508,7 @@
160 }
161
162 return result;
163 +#endif /* PSEUDO_FIPS */
164 }
165
166 PRBool
167 diff -r db5b7e3c69a5 lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
168 --- a/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c Tue May 28 23:37:46 2013 +0200
169 +++ b/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c Fri May 31 17:44:06 2013 -0700
170 @@ -201,7 +201,10 @@
171
172 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen,
173 CERTImportCertificateFunc f, void *arg);
174 -
175 +#ifdef NSS_STATIC
176 +extern SECStatus CERT_DecodeCertPackage(char* certbuf, int certlen,
177 + CERTImportCertificateFunc f, void* arg);
178 +#endif
179
180 struct pkix_DecodeFuncStr {
181 pkix_DecodeCertsFunc func; /* function pointer to the
182 @@ -223,6 +226,11 @@
183 */
184 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
185 {
186 +#ifdef NSS_STATIC
187 + pkix_decodeFunc.smimeLib = NULL;
188 + pkix_decodeFunc.func = CERT_DecodeCertPackage;
189 + return PR_SUCCESS;
190 +#else
191 pkix_decodeFunc.smimeLib =
192 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
193 if (pkix_decodeFunc.smimeLib == NULL) {
194 @@ -235,7 +243,7 @@
195 return PR_FAILURE;
196 }
197 return PR_SUCCESS;
198 -
199 +#endif
200 }
201
202 /*
203 diff -r db5b7e3c69a5 lib/nss/nssinit.c
204 --- a/lib/nss/nssinit.c Tue May 28 23:37:46 2013 +0200
205 +++ b/lib/nss/nssinit.c Fri May 31 17:44:06 2013 -0700
206 @@ -20,9 +20,11 @@
207 #include "secerr.h"
208 #include "nssbase.h"
209 #include "nssutil.h"
210 +#ifndef NSS_DISABLE_LIBPKIX
211 #include "pkixt.h"
212 #include "pkix.h"
213 #include "pkix_tools.h"
214 +#endif /* NSS_DISABLE_LIBPKIX */
215
216 #include "pki3hack.h"
217 #include "certi.h"
218 @@ -530,8 +532,10 @@
219 PRBool dontFinalizeModules)
220 {
221 SECStatus rv = SECFailure;
222 +#ifndef NSS_DISABLE_LIBPKIX
223 PKIX_UInt32 actualMinorVersion = 0;
224 PKIX_Error *pkixError = NULL;
225 +#endif
226 PRBool isReallyInitted;
227 char *configStrings = NULL;
228 char *configName = NULL;
229 @@ -685,6 +689,7 @@
230 pk11sdr_Init();
231 cert_CreateSubjectKeyIDHashTable();
232
233 +#ifndef NSS_DISABLE_LIBPKIX
234 pkixError = PKIX_Initialize
235 (PKIX_FALSE, PKIX_MAJOR_VERSION, PKIX_MINOR_VERSION,
236 PKIX_MINOR_VERSION, &actualMinorVersion, &plContext);
237 @@ -697,6 +702,7 @@
238 CERT_SetUsePKIXForValidation(PR_TRUE);
239 }
240 }
241 +#endif /* NSS_DISABLE_LIBPKIX */
242
243
244 }
245 @@ -1081,7 +1087,9 @@
246 cert_DestroyLocks();
247 ShutdownCRLCache();
248 OCSP_ShutdownGlobal();
249 +#ifndef NSS_DISABLE_LIBPKIX
250 PKIX_Shutdown(plContext);
251 +#endif
252 SECOID_Shutdown();
253 status = STAN_Shutdown();
254 cert_DestroySubjectKeyIDHashTable();
255 diff -r db5b7e3c69a5 lib/pk11wrap/pk11load.c
256 --- a/lib/pk11wrap/pk11load.c Tue May 28 23:37:46 2013 +0200
257 +++ b/lib/pk11wrap/pk11load.c Fri May 31 17:44:06 2013 -0700
258 @@ -318,6 +318,12 @@
259 }
260 }
261
262 +#ifdef NSS_STATIC
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);
267 +#else
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 */
276
277 #include "prio.h"
278 #include "prprf.h"
279 #include <stdio.h>
280 #include "prsystem.h"
281
282 +#ifndef NSS_STATIC
283 /* This function must be run only once. */
284 /* determine if hybrid platform, then actually load the DSO. */
285 static PRStatus
286 @@ -348,6 +356,7 @@
287 }
288 return PR_FAILURE;
289 }
290 +#endif /* !NSS_STATIC */
291
292 /*
293 * load a new module into our address space and initialize it.
294 @@ -366,6 +375,16 @@
295
296 /* intenal modules get loaded from their internal list */
297 if (mod->internal && (mod->dllName == NULL)) {
298 +#ifdef NSS_STATIC
299 + if (mod->isFIPS) {
300 + entry = FC_GetFunctionList;
301 + } else {
302 + entry = NSC_GetFunctionList;
303 + }
304 + if (mod->isModuleDB) {
305 + mod->moduleDBFunc = NSC_ModuleDBFunc;
306 + }
307 +#else
308 /*
309 * Loads softoken as a dynamic library,
310 * even though the rest of NSS assumes this as the "internal" module.
311 @@ -391,6 +410,7 @@
312 mod->moduleDBFunc = (CK_C_GetFunctionList)
313 PR_FindSymbol(softokenLib, "NSC_ModuleDBFunc");
314 }
315 +#endif
316
317 if (mod->moduleDBOnly) {
318 mod->loaded = PR_TRUE;
319 @@ -401,6 +421,15 @@
320 if (mod->dllName == NULL) {
321 return SECFailure;
322 }
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;
330 + }
331 +#endif
332
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...
335 @@ -423,6 +452,9 @@
336 mod->moduleDBFunc = (void *)
337 PR_FindSymbol(library, "NSS_ReturnModuleSpecData");
338 }
339 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
340 +library_loaded:
341 +#endif
342 if (mod->moduleDBFunc == NULL) mod->isModuleDB = PR_FALSE;
343 if (entry == NULL) {
344 if (mod->isModuleDB) {
345 @@ -562,6 +594,7 @@
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)) {
349 +#ifndef NSS_STATIC
350 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) {
351 if (softokenLib) {
352 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
353 @@ -573,12 +606,18 @@
354 }
355 loadSoftokenOnce = pristineCallOnce;
356 }
357 +#endif
358 return SECSuccess;
359 }
360
361 library = (PRLibrary *)mod->library;
362 /* paranoia */
363 if (library == NULL) {
364 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
365 + if (strstr(mod->dllName, "nssckbi") != NULL) {
366 + return SECSuccess;
367 + }
368 +#endif
369 return SECFailure;
370 }
371
372 diff -r db5b7e3c69a5 lib/softoken/lgglue.c
373 --- a/lib/softoken/lgglue.c Tue May 28 23:37:46 2013 +0200
374 +++ b/lib/softoken/lgglue.c Fri May 31 17:44:06 2013 -0700
375 @@ -23,6 +23,7 @@
376 static LGAddSecmodFunc legacy_glue_addSecmod = NULL;
377 static LGShutdownFunc legacy_glue_shutdown = NULL;
378
379 +#ifndef NSS_STATIC
380 /*
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
383 @@ -160,6 +161,7 @@
384
385 return lib;
386 }
387 +#endif /* STATIC LIBRARIES */
388
389 /*
390 * stub files for legacy db's to be able to encrypt and decrypt
391 @@ -272,6 +274,21 @@
392 return SECSuccess;
393 }
394
395 +#ifdef NSS_STATIC
396 +#ifdef NSS_DISABLE_DBM
397 + return SECFailure;
398 +#else
399 + lib = (PRLibrary *) 0x8;
400 +
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;
408 +#endif
409 +#else
410 lib = sftkdb_LoadLibrary(LEGACY_LIB_NAME);
411 if (lib == NULL) {
412 return SECFailure;
413 @@ -297,11 +314,14 @@
414 PR_UnloadLibrary(lib);
415 return SECFailure;
416 }
417 +#endif /* NSS_STATIC */
418
419 /* verify the loaded library if we are in FIPS mode */
420 if (isFIPS) {
421 if (!BLAPI_SHVerify(LEGACY_LIB_NAME,(PRFuncPtr)legacy_glue_open)) {
422 +#ifndef NSS_STATIC
423 PR_UnloadLibrary(lib);
424 +#endif
425 return SECFailure;
426 }
427 legacy_glue_libCheckSucceeded = PR_TRUE;
428 @@ -418,10 +438,12 @@
429 #endif
430 crv = (*legacy_glue_shutdown)(parentForkedAfterC_Initialize);
431 }
432 +#ifndef NSS_STATIC
433 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
434 if (!disableUnload) {
435 PR_UnloadLibrary(legacy_glue_lib);
436 }
437 +#endif
438 legacy_glue_lib = NULL;
439 legacy_glue_open = NULL;
440 legacy_glue_readSecmod = NULL;
441 diff -r db5b7e3c69a5 lib/softoken/lgglue.h
442 --- a/lib/softoken/lgglue.h Tue May 28 23:37:46 2013 +0200
443 +++ b/lib/softoken/lgglue.h Fri May 31 17:44:06 2013 -0700
444 @@ -38,6 +38,25 @@
445 typedef void (*LGSetForkStateFunc)(PRBool);
446 typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc);
447
448 +extern CK_RV legacy_Open(const char *dir, const char *certPrefix,
449 + const char *keyPrefix,
450 + int certVersion, int keyVersion, int flags,
451 + SDB **certDB, SDB **keyDB);
452 +extern char ** legacy_ReadSecmodDB(const char *appName,
453 + const char *filename,
454 + const char *dbname, char *params, PRBool rw);
455 +extern SECStatus legacy_ReleaseSecmodDBData(const char *appName,
456 + const char *filename,
457 + const char *dbname, char **params, PRBool rw);
458 +extern SECStatus legacy_DeleteSecmodDB(const char *appName,
459 + const char *filename,
460 + const char *dbname, char *params, PRBool rw);
461 +extern SECStatus legacy_AddSecmodDB(const char *appName,
462 + const char *filename,
463 + const char *dbname, char *params, PRBool rw);
464 +extern SECStatus legacy_Shutdown(PRBool forked);
465 +extern void legacy_SetCryptFunctions(LGEncryptFunc, LGDecryptFunc);
466 +
467 /*
468 * Softoken Glue Functions
469 */
470 diff -r db5b7e3c69a5 lib/util/secport.h
471 --- a/lib/util/secport.h Tue May 28 23:37:46 2013 +0200
472 +++ b/lib/util/secport.h Fri May 31 17:44:06 2013 -0700
473 @@ -210,6 +210,7 @@
474
475 extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n);
476
477 +#ifndef NSS_STATIC
478 /*
479 * Load a shared library called "newShLibName" in the same directory as
480 * a shared library that is already loaded, called existingShLibName.
481 @@ -244,6 +245,7 @@
482 PORT_LoadLibraryFromOrigin(const char* existingShLibName,
483 PRFuncPtr staticShLibFunc,
484 const char *newShLibName);
485 +#endif /* NSS_STATIC */
486
487 SEC_END_PROTOS
488
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)