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

Side by Side Diff: patches/nss-static.patch

Issue 1017413002: Uprev NSS to 3.18 RTM (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@nspr_uprev
Patch Set: Rebased Created 5 years, 8 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
« no previous file with comments | « patches/nss-chacha20-poly1305.patch ('k') | scripts/nss-checkout.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 diff -r db5b7e3c69a5 lib/certhigh/certvfy.c 1 diff --git a/nss/lib/certhigh/certvfy.c b/nss/lib/certhigh/certvfy.c
2 --- a/lib/certhigh/certvfy.c» Tue May 28 23:37:46 2013 +0200 2 index 3141163..c9d26f0 100644
3 +++ b/lib/certhigh/certvfy.c» Fri May 31 17:44:06 2013 -0700 3 --- a/nss/lib/certhigh/certvfy.c
4 +++ b/nss/lib/certhigh/certvfy.c
4 @@ -13,9 +13,11 @@ 5 @@ -13,9 +13,11 @@
5 #include "certdb.h" 6 #include "certdb.h"
6 #include "certi.h" 7 #include "certi.h"
7 #include "cryptohi.h" 8 #include "cryptohi.h"
8 +#ifndef NSS_DISABLE_LIBPKIX 9 +#ifndef NSS_DISABLE_LIBPKIX
9 #include "pkix.h" 10 #include "pkix.h"
10 /*#include "pkix_sample_modules.h" */ 11 /*#include "pkix_sample_modules.h" */
11 #include "pkix_pl_cert.h" 12 #include "pkix_pl_cert.h"
12 +#endif /* NSS_DISABLE_LIBPKIX */ 13 +#endif /* NSS_DISABLE_LIBPKIX */
13 14
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 + void *wincx) 55 + void *wincx)
55 +{ 56 +{
56 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); 57 + PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
57 + return SECFailure; 58 + return SECFailure;
58 +} 59 +}
59 +#endif /* NSS_DISABLE_LIBPKIX */ 60 +#endif /* NSS_DISABLE_LIBPKIX */
60 + 61 +
61 /* 62 /*
62 * Check the validity times of a certificate 63 * Check the validity times of a certificate
63 */ 64 */
64 diff -r db5b7e3c69a5 lib/ckfw/nssck.api 65 diff --git a/nss/lib/ckfw/nssck.api b/nss/lib/ckfw/nssck.api
65 --- a/lib/ckfw/nssck.api» Tue May 28 23:37:46 2013 +0200 66 index 55b4351..8364258 100644
66 +++ b/lib/ckfw/nssck.api» Fri May 31 17:44:06 2013 -0700 67 --- a/nss/lib/ckfw/nssck.api
67 @@ -1752,7 +1752,7 @@ 68 +++ b/nss/lib/ckfw/nssck.api
69 @@ -1752,7 +1752,7 @@ C_WaitForSlotEvent
68 } 70 }
69 #endif /* DECLARE_STRICT_CRYPTOKI_NAMES */ 71 #endif /* DECLARE_STRICT_CRYPTOKI_NAMES */
70 72
71 -static CK_RV CK_ENTRY 73 -static CK_RV CK_ENTRY
72 +CK_RV CK_ENTRY 74 +CK_RV CK_ENTRY
73 __ADJOIN(MODULE_NAME,C_GetFunctionList) 75 __ADJOIN(MODULE_NAME,C_GetFunctionList)
74 ( 76 (
75 CK_FUNCTION_LIST_PTR_PTR ppFunctionList 77 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
76 @@ -1830,7 +1830,7 @@ 78 @@ -1830,7 +1830,7 @@ __ADJOIN(MODULE_NAME,C_CancelFunction),
77 __ADJOIN(MODULE_NAME,C_WaitForSlotEvent) 79 __ADJOIN(MODULE_NAME,C_WaitForSlotEvent)
78 }; 80 };
79 81
80 -static CK_RV CK_ENTRY 82 -static CK_RV CK_ENTRY
81 +CK_RV CK_ENTRY 83 +CK_RV CK_ENTRY
82 __ADJOIN(MODULE_NAME,C_GetFunctionList) 84 __ADJOIN(MODULE_NAME,C_GetFunctionList)
83 ( 85 (
84 CK_FUNCTION_LIST_PTR_PTR ppFunctionList 86 CK_FUNCTION_LIST_PTR_PTR ppFunctionList
85 @@ -1840,6 +1840,7 @@ 87 @@ -1840,6 +1840,7 @@ __ADJOIN(MODULE_NAME,C_GetFunctionList)
86 return CKR_OK; 88 return CKR_OK;
87 } 89 }
88 90
89 +#ifndef NSS_STATIC 91 +#ifndef NSS_STATIC
90 /* This one is always present */ 92 /* This one is always present */
91 CK_RV CK_ENTRY 93 CK_RV CK_ENTRY
92 C_GetFunctionList 94 C_GetFunctionList
93 @@ -1849,6 +1850,7 @@ 95 @@ -1849,6 +1850,7 @@ C_GetFunctionList
94 { 96 {
95 return __ADJOIN(MODULE_NAME,C_GetFunctionList)(ppFunctionList); 97 return __ADJOIN(MODULE_NAME,C_GetFunctionList)(ppFunctionList);
96 } 98 }
97 +#endif 99 +#endif
98 100
99 #undef __ADJOIN 101 #undef __ADJOIN
100 102
101 diff -r db5b7e3c69a5 lib/freebl/rsa.c 103 diff --git a/nss/lib/freebl/rsa.c b/nss/lib/freebl/rsa.c
102 --- a/lib/freebl/rsa.c» Tue May 28 23:37:46 2013 +0200 104 index 498cc96..780c3c7 100644
103 +++ b/lib/freebl/rsa.c» Fri May 31 17:44:06 2013 -0700 105 --- a/nss/lib/freebl/rsa.c
104 @@ -1559,6 +1559,13 @@ 106 +++ b/nss/lib/freebl/rsa.c
107 @@ -1535,6 +1535,13 @@ void BL_Cleanup(void)
105 RSA_Cleanup(); 108 RSA_Cleanup();
106 } 109 }
107 110
108 +#ifdef NSS_STATIC 111 +#ifdef NSS_STATIC
109 +void 112 +void
110 +BL_Unload(void) 113 +BL_Unload(void)
111 +{ 114 +{
112 +} 115 +}
113 +#endif 116 +#endif
114 + 117 +
115 PRBool bl_parentForkedAfterC_Initialize; 118 PRBool bl_parentForkedAfterC_Initialize;
116 119
117 /* 120 /*
118 diff -r db5b7e3c69a5 lib/freebl/shvfy.c 121 diff --git a/nss/lib/freebl/shvfy.c b/nss/lib/freebl/shvfy.c
119 --- a/lib/freebl/shvfy.c» Tue May 28 23:37:46 2013 +0200 122 index ad64a26..33714b8 100644
120 +++ b/lib/freebl/shvfy.c» Fri May 31 17:44:06 2013 -0700 123 --- a/nss/lib/freebl/shvfy.c
121 @@ -273,9 +273,21 @@ 124 +++ b/nss/lib/freebl/shvfy.c
125 @@ -273,9 +273,21 @@ readItem(PRFileDesc *fd, SECItem *item)
122 return SECSuccess; 126 return SECSuccess;
123 } 127 }
124 128
125 +/* 129 +/*
126 + * Define PSEUDO_FIPS if you can't do FIPS software integrity test (e.g., 130 + * 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 131 + * if you're using NSS as static libraries), but want to conform to the
128 + * rest of the FIPS requirements. 132 + * rest of the FIPS requirements.
129 + */ 133 + */
130 +#ifdef NSS_STATIC 134 +#ifdef NSS_STATIC
131 +#define PSEUDO_FIPS 135 +#define PSEUDO_FIPS
132 +#endif 136 +#endif
133 + 137 +
134 PRBool 138 PRBool
135 BLAPI_SHVerify(const char *name, PRFuncPtr addr) 139 BLAPI_SHVerify(const char *name, PRFuncPtr addr)
136 { 140 {
137 +#ifdef PSEUDO_FIPS 141 +#ifdef PSEUDO_FIPS
138 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */ 142 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
139 +#else 143 +#else
140 PRBool result = PR_FALSE; /* if anything goes wrong, 144 PRBool result = PR_FALSE; /* if anything goes wrong,
141 * the signature does not verify */ 145 * the signature does not verify */
142 /* find our shared library name */ 146 /* find our shared library name */
143 @@ -291,11 +303,15 @@ 147 @@ -291,11 +303,15 @@ loser:
144 } 148 }
145 149
146 return result; 150 return result;
147 +#endif /* PSEUDO_FIPS */ 151 +#endif /* PSEUDO_FIPS */
148 } 152 }
149 153
150 PRBool 154 PRBool
151 BLAPI_SHVerifyFile(const char *shName) 155 BLAPI_SHVerifyFile(const char *shName)
152 { 156 {
153 +#ifdef PSEUDO_FIPS 157 +#ifdef PSEUDO_FIPS
154 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */ 158 + return PR_TRUE; /* a lie, hence *pseudo* FIPS */
155 +#else 159 +#else
156 char *checkName = NULL; 160 char *checkName = NULL;
157 PRFileDesc *checkFD = NULL; 161 PRFileDesc *checkFD = NULL;
158 PRFileDesc *shFD = NULL; 162 PRFileDesc *shFD = NULL;
159 @@ -492,6 +508,7 @@ 163 @@ -492,6 +508,7 @@ loser:
160 } 164 }
161 165
162 return result; 166 return result;
163 +#endif /* PSEUDO_FIPS */ 167 +#endif /* PSEUDO_FIPS */
164 } 168 }
165 169
166 PRBool 170 PRBool
167 diff -r db5b7e3c69a5 lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c 171 diff --git a/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c b/nss/li b/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 172 index 30aefb8..ac814cd 100755
169 +++ b/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c» Fri May 31 17:44 :06 2013 -0700 173 --- a/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
170 @@ -201,7 +201,10 @@ 174 +++ b/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
175 @@ -201,7 +201,10 @@ certCallback(void *arg, SECItem **secitemCerts, int numcert s)
171 176
172 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen, 177 typedef SECStatus (*pkix_DecodeCertsFunc)(char *certbuf, int certlen,
173 CERTImportCertificateFunc f, void *ar g); 178 CERTImportCertificateFunc f, void *ar g);
174 - 179 -
175 +#ifdef NSS_STATIC 180 +#ifdef NSS_STATIC
176 +extern SECStatus CERT_DecodeCertPackage(char* certbuf, int certlen, 181 +extern SECStatus CERT_DecodeCertPackage(char* certbuf, int certlen,
177 + CERTImportCertificateFunc f, void* arg) ; 182 + CERTImportCertificateFunc f, void* arg) ;
178 +#endif 183 +#endif
179 184
180 struct pkix_DecodeFuncStr { 185 struct pkix_DecodeFuncStr {
181 pkix_DecodeCertsFunc func; /* function pointer to the 186 pkix_DecodeCertsFunc func; /* function pointer to the
182 @@ -223,6 +226,11 @@ 187 @@ -223,6 +226,11 @@ static const PRCallOnceType pkix_pristine;
183 */ 188 */
184 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void) 189 static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
185 { 190 {
186 +#ifdef NSS_STATIC 191 +#ifdef NSS_STATIC
187 + pkix_decodeFunc.smimeLib = NULL; 192 + pkix_decodeFunc.smimeLib = NULL;
188 + pkix_decodeFunc.func = CERT_DecodeCertPackage; 193 + pkix_decodeFunc.func = CERT_DecodeCertPackage;
189 + return PR_SUCCESS; 194 + return PR_SUCCESS;
190 +#else 195 +#else
191 pkix_decodeFunc.smimeLib = 196 pkix_decodeFunc.smimeLib =
192 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX); 197 PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
193 if (pkix_decodeFunc.smimeLib == NULL) { 198 if (pkix_decodeFunc.smimeLib == NULL) {
194 @@ -235,7 +243,7 @@ 199 @@ -235,7 +243,7 @@ static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
195 return PR_FAILURE; 200 return PR_FAILURE;
196 } 201 }
197 return PR_SUCCESS; 202 return PR_SUCCESS;
198 - 203 -
199 +#endif 204 +#endif
200 } 205 }
201 206
202 /* 207 /*
203 diff -r db5b7e3c69a5 lib/nss/nssinit.c 208 diff --git a/nss/lib/nss/nssinit.c b/nss/lib/nss/nssinit.c
204 --- a/lib/nss/nssinit.c»Tue May 28 23:37:46 2013 +0200 209 index 6218a7e..208e71d 100644
205 +++ b/lib/nss/nssinit.c»Fri May 31 17:44:06 2013 -0700 210 --- a/nss/lib/nss/nssinit.c
211 +++ b/nss/lib/nss/nssinit.c
206 @@ -20,9 +20,11 @@ 212 @@ -20,9 +20,11 @@
207 #include "secerr.h" 213 #include "secerr.h"
208 #include "nssbase.h" 214 #include "nssbase.h"
209 #include "nssutil.h" 215 #include "nssutil.h"
210 +#ifndef NSS_DISABLE_LIBPKIX 216 +#ifndef NSS_DISABLE_LIBPKIX
211 #include "pkixt.h" 217 #include "pkixt.h"
212 #include "pkix.h" 218 #include "pkix.h"
213 #include "pkix_tools.h" 219 #include "pkix_tools.h"
214 +#endif /* NSS_DISABLE_LIBPKIX */ 220 +#endif /* NSS_DISABLE_LIBPKIX */
215 221
216 #include "pki3hack.h" 222 #include "pki3hack.h"
217 #include "certi.h" 223 #include "certi.h"
218 @@ -530,8 +532,10 @@ 224 @@ -530,8 +532,10 @@ nss_Init(const char *configdir, const char *certPrefix, con st char *keyPrefix,
219 PRBool dontFinalizeModules) 225 PRBool dontFinalizeModules)
220 { 226 {
221 SECStatus rv = SECFailure; 227 SECStatus rv = SECFailure;
222 +#ifndef NSS_DISABLE_LIBPKIX 228 +#ifndef NSS_DISABLE_LIBPKIX
223 PKIX_UInt32 actualMinorVersion = 0; 229 PKIX_UInt32 actualMinorVersion = 0;
224 PKIX_Error *pkixError = NULL; 230 PKIX_Error *pkixError = NULL;
225 +#endif 231 +#endif
226 PRBool isReallyInitted; 232 PRBool isReallyInitted;
227 char *configStrings = NULL; 233 char *configStrings = NULL;
228 char *configName = NULL; 234 char *configName = NULL;
229 @@ -685,6 +689,7 @@ 235 @@ -685,6 +689,7 @@ nss_Init(const char *configdir, const char *certPrefix, cons t char *keyPrefix,
230 pk11sdr_Init(); 236 pk11sdr_Init();
231 cert_CreateSubjectKeyIDHashTable(); 237 cert_CreateSubjectKeyIDHashTable();
232 238
233 +#ifndef NSS_DISABLE_LIBPKIX 239 +#ifndef NSS_DISABLE_LIBPKIX
234 pkixError = PKIX_Initialize 240 pkixError = PKIX_Initialize
235 (PKIX_FALSE, PKIX_MAJOR_VERSION, PKIX_MINOR_VERSION, 241 (PKIX_FALSE, PKIX_MAJOR_VERSION, PKIX_MINOR_VERSION,
236 PKIX_MINOR_VERSION, &actualMinorVersion, &plContext); 242 PKIX_MINOR_VERSION, &actualMinorVersion, &plContext);
237 @@ -697,6 +702,7 @@ 243 @@ -697,6 +702,7 @@ nss_Init(const char *configdir, const char *certPrefix, cons t char *keyPrefix,
238 CERT_SetUsePKIXForValidation(PR_TRUE); 244 CERT_SetUsePKIXForValidation(PR_TRUE);
239 } 245 }
240 } 246 }
241 +#endif /* NSS_DISABLE_LIBPKIX */ 247 +#endif /* NSS_DISABLE_LIBPKIX */
242 248
243 249
244 } 250 }
245 @@ -1081,7 +1087,9 @@ 251 @@ -1081,7 +1087,9 @@ nss_Shutdown(void)
246 cert_DestroyLocks(); 252 cert_DestroyLocks();
247 ShutdownCRLCache(); 253 ShutdownCRLCache();
248 OCSP_ShutdownGlobal(); 254 OCSP_ShutdownGlobal();
249 +#ifndef NSS_DISABLE_LIBPKIX 255 +#ifndef NSS_DISABLE_LIBPKIX
250 PKIX_Shutdown(plContext); 256 PKIX_Shutdown(plContext);
251 +#endif 257 +#endif
252 SECOID_Shutdown(); 258 SECOID_Shutdown();
253 status = STAN_Shutdown(); 259 status = STAN_Shutdown();
254 cert_DestroySubjectKeyIDHashTable(); 260 cert_DestroySubjectKeyIDHashTable();
255 diff -r db5b7e3c69a5 lib/pk11wrap/pk11load.c 261 diff --git a/nss/lib/pk11wrap/pk11load.c b/nss/lib/pk11wrap/pk11load.c
256 --- a/lib/pk11wrap/pk11load.c» Tue May 28 23:37:46 2013 +0200 262 index 6700180..1811a1a 100644
257 +++ b/lib/pk11wrap/pk11load.c» Fri May 31 17:44:06 2013 -0700 263 --- a/nss/lib/pk11wrap/pk11load.c
258 @@ -318,6 +318,12 @@ 264 +++ b/nss/lib/pk11wrap/pk11load.c
265 @@ -341,6 +341,12 @@ SECMOD_SetRootCerts(PK11SlotInfo *slot, SECMODModule *mod) {
259 } 266 }
260 } 267 }
261 268
262 +#ifdef NSS_STATIC 269 +#ifdef NSS_STATIC
263 +extern CK_RV NSC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList); 270 +extern CK_RV NSC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
264 +extern CK_RV FC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList); 271 +extern CK_RV FC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
265 +extern char **NSC_ModuleDBFunc(unsigned long function,char *parameters, void *a rgs); 272 +extern char **NSC_ModuleDBFunc(unsigned long function,char *parameters, void *a rgs);
266 +extern CK_RV builtinsC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList); 273 +extern CK_RV builtinsC_GetFunctionList(CK_FUNCTION_LIST_PTR *pFunctionList);
267 +#else 274 +#else
268 static const char* my_shlib_name = 275 static const char* my_shlib_name =
269 SHLIB_PREFIX"nss"SHLIB_VERSION"."SHLIB_SUFFIX; 276 SHLIB_PREFIX"nss"SHLIB_VERSION"."SHLIB_SUFFIX;
270 static const char* softoken_shlib_name = 277 static const char* softoken_shlib_name =
271 @@ -326,12 +332,14 @@ 278 @@ -349,12 +355,14 @@ static const PRCallOnceType pristineCallOnce;
272 static PRCallOnceType loadSoftokenOnce; 279 static PRCallOnceType loadSoftokenOnce;
273 static PRLibrary* softokenLib; 280 static PRLibrary* softokenLib;
274 static PRInt32 softokenLoadCount; 281 static PRInt32 softokenLoadCount;
275 +#endif /* NSS_STATIC */ 282 +#endif /* NSS_STATIC */
276 283
277 #include "prio.h" 284 #include "prio.h"
278 #include "prprf.h" 285 #include "prprf.h"
279 #include <stdio.h> 286 #include <stdio.h>
280 #include "prsystem.h" 287 #include "prsystem.h"
281 288
282 +#ifndef NSS_STATIC 289 +#ifndef NSS_STATIC
283 /* This function must be run only once. */ 290 /* This function must be run only once. */
284 /* determine if hybrid platform, then actually load the DSO. */ 291 /* determine if hybrid platform, then actually load the DSO. */
285 static PRStatus 292 static PRStatus
286 @@ -348,6 +356,7 @@ 293 @@ -371,6 +379,7 @@ softoken_LoadDSO( void )
287 } 294 }
288 return PR_FAILURE; 295 return PR_FAILURE;
289 } 296 }
290 +#endif /* !NSS_STATIC */ 297 +#endif /* !NSS_STATIC */
291 298
292 /* 299 /*
293 * load a new module into our address space and initialize it. 300 * load a new module into our address space and initialize it.
294 @@ -366,6 +375,16 @@ 301 @@ -389,6 +398,16 @@ secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **o ldModule) {
295 302
296 /* intenal modules get loaded from their internal list */ 303 /* intenal modules get loaded from their internal list */
297 if (mod->internal && (mod->dllName == NULL)) { 304 if (mod->internal && (mod->dllName == NULL)) {
298 +#ifdef NSS_STATIC 305 +#ifdef NSS_STATIC
299 + if (mod->isFIPS) { 306 + if (mod->isFIPS) {
300 + entry = FC_GetFunctionList; 307 + entry = FC_GetFunctionList;
301 + } else { 308 + } else {
302 + entry = NSC_GetFunctionList; 309 + entry = NSC_GetFunctionList;
303 + } 310 + }
304 + if (mod->isModuleDB) { 311 + if (mod->isModuleDB) {
305 + mod->moduleDBFunc = NSC_ModuleDBFunc; 312 + mod->moduleDBFunc = NSC_ModuleDBFunc;
306 + } 313 + }
307 +#else 314 +#else
308 /* 315 /*
309 * Loads softoken as a dynamic library, 316 * Loads softoken as a dynamic library,
310 * even though the rest of NSS assumes this as the "internal" module. 317 * even though the rest of NSS assumes this as the "internal" module.
311 @@ -391,6 +410,7 @@ 318 @@ -414,6 +433,7 @@ secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **ol dModule) {
312 mod->moduleDBFunc = (CK_C_GetFunctionList) 319 mod->moduleDBFunc = (CK_C_GetFunctionList)
313 PR_FindSymbol(softokenLib, "NSC_ModuleDBFunc"); 320 PR_FindSymbol(softokenLib, "NSC_ModuleDBFunc");
314 } 321 }
315 +#endif 322 +#endif
316 323
317 if (mod->moduleDBOnly) { 324 if (mod->moduleDBOnly) {
318 mod->loaded = PR_TRUE; 325 mod->loaded = PR_TRUE;
319 @@ -401,6 +421,15 @@ 326 @@ -424,6 +444,15 @@ secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **o ldModule) {
320 if (mod->dllName == NULL) { 327 if (mod->dllName == NULL) {
321 return SECFailure; 328 return SECFailure;
322 } 329 }
323 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS) 330 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
324 + if (strstr(mod->dllName, "nssckbi") != NULL) { 331 + if (strstr(mod->dllName, "nssckbi") != NULL) {
325 + mod->library = NULL; 332 + mod->library = NULL;
326 + PORT_Assert(!mod->moduleDBOnly); 333 + PORT_Assert(!mod->moduleDBOnly);
327 + entry = builtinsC_GetFunctionList; 334 + entry = builtinsC_GetFunctionList;
328 + PORT_Assert(!mod->isModuleDB); 335 + PORT_Assert(!mod->isModuleDB);
329 + goto library_loaded; 336 + goto library_loaded;
330 + } 337 + }
331 +#endif 338 +#endif
332 339
333 /* load the library. If this succeeds, then we have to remember to 340 /* load the library. If this succeeds, then we have to remember to
334 * unload the library if anything goes wrong from here on out... 341 * unload the library if anything goes wrong from here on out...
335 @@ -423,6 +452,9 @@ 342 @@ -446,6 +475,9 @@ secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **ol dModule) {
336 mod->moduleDBFunc = (void *) 343 mod->moduleDBFunc = (void *)
337 PR_FindSymbol(library, "NSS_ReturnModuleSpecData"); 344 PR_FindSymbol(library, "NSS_ReturnModuleSpecData");
338 } 345 }
339 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS) 346 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
340 +library_loaded: 347 +library_loaded:
341 +#endif 348 +#endif
342 if (mod->moduleDBFunc == NULL) mod->isModuleDB = PR_FALSE; 349 if (mod->moduleDBFunc == NULL) mod->isModuleDB = PR_FALSE;
343 if (entry == NULL) { 350 if (entry == NULL) {
344 if (mod->isModuleDB) { 351 if (mod->isModuleDB) {
345 @@ -562,6 +594,7 @@ 352 @@ -585,6 +617,7 @@ SECMOD_UnloadModule(SECMODModule *mod) {
346 * if not, we should change this to SECFailure and move it above the 353 * if not, we should change this to SECFailure and move it above the
347 * mod->loaded = PR_FALSE; */ 354 * mod->loaded = PR_FALSE; */
348 if (mod->internal && (mod->dllName == NULL)) { 355 if (mod->internal && (mod->dllName == NULL)) {
349 +#ifndef NSS_STATIC 356 +#ifndef NSS_STATIC
350 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) { 357 if (0 == PR_ATOMIC_DECREMENT(&softokenLoadCount)) {
351 if (softokenLib) { 358 if (softokenLib) {
352 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); 359 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
353 @@ -573,12 +606,18 @@ 360 @@ -596,12 +629,18 @@ SECMOD_UnloadModule(SECMODModule *mod) {
354 } 361 }
355 loadSoftokenOnce = pristineCallOnce; 362 loadSoftokenOnce = pristineCallOnce;
356 } 363 }
357 +#endif 364 +#endif
358 return SECSuccess; 365 return SECSuccess;
359 } 366 }
360 367
361 library = (PRLibrary *)mod->library; 368 library = (PRLibrary *)mod->library;
362 /* paranoia */ 369 /* paranoia */
363 if (library == NULL) { 370 if (library == NULL) {
364 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS) 371 +#if defined(NSS_STATIC) && !defined(NSS_DISABLE_ROOT_CERTS)
365 + if (strstr(mod->dllName, "nssckbi") != NULL) { 372 + if (strstr(mod->dllName, "nssckbi") != NULL) {
366 + return SECSuccess; 373 + return SECSuccess;
367 + } 374 + }
368 +#endif 375 +#endif
369 return SECFailure; 376 return SECFailure;
370 } 377 }
371 378
372 diff -r db5b7e3c69a5 lib/softoken/lgglue.c 379 diff --git a/nss/lib/softoken/lgglue.c b/nss/lib/softoken/lgglue.c
373 --- a/lib/softoken/lgglue.c» Tue May 28 23:37:46 2013 +0200 380 index c7b82bd..64e6415 100644
374 +++ b/lib/softoken/lgglue.c» Fri May 31 17:44:06 2013 -0700 381 --- a/nss/lib/softoken/lgglue.c
375 @@ -23,6 +23,7 @@ 382 +++ b/nss/lib/softoken/lgglue.c
383 @@ -23,6 +23,7 @@ static LGDeleteSecmodFunc legacy_glue_deleteSecmod = NULL;
376 static LGAddSecmodFunc legacy_glue_addSecmod = NULL; 384 static LGAddSecmodFunc legacy_glue_addSecmod = NULL;
377 static LGShutdownFunc legacy_glue_shutdown = NULL; 385 static LGShutdownFunc legacy_glue_shutdown = NULL;
378 386
379 +#ifndef NSS_STATIC 387 +#ifndef NSS_STATIC
380 /* 388 /*
381 * The following 3 functions duplicate the work done by bl_LoadLibrary. 389 * The following 3 functions duplicate the work done by bl_LoadLibrary.
382 * We should make bl_LoadLibrary a global and replace the call to 390 * We should make bl_LoadLibrary a global and replace the call to
383 @@ -160,6 +161,7 @@ 391 @@ -160,6 +161,7 @@ done:
384 392
385 return lib; 393 return lib;
386 } 394 }
387 +#endif /* STATIC LIBRARIES */ 395 +#endif /* STATIC LIBRARIES */
388 396
389 /* 397 /*
390 * stub files for legacy db's to be able to encrypt and decrypt 398 * stub files for legacy db's to be able to encrypt and decrypt
391 @@ -272,6 +274,21 @@ 399 @@ -272,6 +274,21 @@ sftkdbLoad_Legacy(PRBool isFIPS)
392 return SECSuccess; 400 return SECSuccess;
393 } 401 }
394 402
395 +#ifdef NSS_STATIC 403 +#ifdef NSS_STATIC
396 +#ifdef NSS_DISABLE_DBM 404 +#ifdef NSS_DISABLE_DBM
397 + return SECFailure; 405 + return SECFailure;
398 +#else 406 +#else
399 + lib = (PRLibrary *) 0x8; 407 + lib = (PRLibrary *) 0x8;
400 + 408 +
401 + legacy_glue_open = legacy_Open; 409 + legacy_glue_open = legacy_Open;
402 + legacy_glue_readSecmod = legacy_ReadSecmodDB; 410 + legacy_glue_readSecmod = legacy_ReadSecmodDB;
403 + legacy_glue_releaseSecmod = legacy_ReleaseSecmodDBData; 411 + legacy_glue_releaseSecmod = legacy_ReleaseSecmodDBData;
404 + legacy_glue_deleteSecmod = legacy_DeleteSecmodDB; 412 + legacy_glue_deleteSecmod = legacy_DeleteSecmodDB;
405 + legacy_glue_addSecmod = legacy_AddSecmodDB; 413 + legacy_glue_addSecmod = legacy_AddSecmodDB;
406 + legacy_glue_shutdown = legacy_Shutdown; 414 + legacy_glue_shutdown = legacy_Shutdown;
407 + setCryptFunction = legacy_SetCryptFunctions; 415 + setCryptFunction = legacy_SetCryptFunctions;
408 +#endif 416 +#endif
409 +#else 417 +#else
410 lib = sftkdb_LoadLibrary(LEGACY_LIB_NAME); 418 lib = sftkdb_LoadLibrary(LEGACY_LIB_NAME);
411 if (lib == NULL) { 419 if (lib == NULL) {
412 return SECFailure; 420 return SECFailure;
413 @@ -297,11 +314,14 @@ 421 @@ -297,11 +314,14 @@ sftkdbLoad_Legacy(PRBool isFIPS)
414 PR_UnloadLibrary(lib); 422 PR_UnloadLibrary(lib);
415 return SECFailure; 423 return SECFailure;
416 } 424 }
417 +#endif /* NSS_STATIC */ 425 +#endif /* NSS_STATIC */
418 426
419 /* verify the loaded library if we are in FIPS mode */ 427 /* verify the loaded library if we are in FIPS mode */
420 if (isFIPS) { 428 if (isFIPS) {
421 if (!BLAPI_SHVerify(LEGACY_LIB_NAME,(PRFuncPtr)legacy_glue_open)) { 429 if (!BLAPI_SHVerify(LEGACY_LIB_NAME,(PRFuncPtr)legacy_glue_open)) {
422 +#ifndef NSS_STATIC 430 +#ifndef NSS_STATIC
423 PR_UnloadLibrary(lib); 431 PR_UnloadLibrary(lib);
424 +#endif 432 +#endif
425 return SECFailure; 433 return SECFailure;
426 } 434 }
427 legacy_glue_libCheckSucceeded = PR_TRUE; 435 legacy_glue_libCheckSucceeded = PR_TRUE;
428 @@ -418,10 +438,12 @@ 436 @@ -418,10 +438,12 @@ sftkdbCall_Shutdown(void)
429 #endif 437 #endif
430 crv = (*legacy_glue_shutdown)(parentForkedAfterC_Initialize); 438 crv = (*legacy_glue_shutdown)(parentForkedAfterC_Initialize);
431 } 439 }
432 +#ifndef NSS_STATIC 440 +#ifndef NSS_STATIC
433 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD"); 441 disableUnload = PR_GetEnv("NSS_DISABLE_UNLOAD");
434 if (!disableUnload) { 442 if (!disableUnload) {
435 PR_UnloadLibrary(legacy_glue_lib); 443 PR_UnloadLibrary(legacy_glue_lib);
436 } 444 }
437 +#endif 445 +#endif
438 legacy_glue_lib = NULL; 446 legacy_glue_lib = NULL;
439 legacy_glue_open = NULL; 447 legacy_glue_open = NULL;
440 legacy_glue_readSecmod = NULL; 448 legacy_glue_readSecmod = NULL;
441 diff -r db5b7e3c69a5 lib/softoken/lgglue.h 449 diff --git a/nss/lib/softoken/lgglue.h b/nss/lib/softoken/lgglue.h
442 --- a/lib/softoken/lgglue.h» Tue May 28 23:37:46 2013 +0200 450 index b87f756..c8c562f 100644
443 +++ b/lib/softoken/lgglue.h» Fri May 31 17:44:06 2013 -0700 451 --- a/nss/lib/softoken/lgglue.h
444 @@ -38,6 +38,25 @@ 452 +++ b/nss/lib/softoken/lgglue.h
453 @@ -38,6 +38,25 @@ typedef SECStatus (*LGShutdownFunc)(PRBool forked);
445 typedef void (*LGSetForkStateFunc)(PRBool); 454 typedef void (*LGSetForkStateFunc)(PRBool);
446 typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc); 455 typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc);
447 456
448 +extern CK_RV legacy_Open(const char *dir, const char *certPrefix, 457 +extern CK_RV legacy_Open(const char *dir, const char *certPrefix,
449 + const char *keyPrefix, 458 + const char *keyPrefix,
450 + int certVersion, int keyVersion, int flags, 459 + int certVersion, int keyVersion, int flags,
451 + SDB **certDB, SDB **keyDB); 460 + SDB **certDB, SDB **keyDB);
452 +extern char ** legacy_ReadSecmodDB(const char *appName, 461 +extern char ** legacy_ReadSecmodDB(const char *appName,
453 + const char *filename, 462 + const char *filename,
454 + const char *dbname, char *params, PRBool rw); 463 + const char *dbname, char *params, PRBool rw);
455 +extern SECStatus legacy_ReleaseSecmodDBData(const char *appName, 464 +extern SECStatus legacy_ReleaseSecmodDBData(const char *appName,
456 + const char *filename, 465 + const char *filename,
457 + const char *dbname, char **params, PRBool rw); 466 + const char *dbname, char **params, PRBool rw);
458 +extern SECStatus legacy_DeleteSecmodDB(const char *appName, 467 +extern SECStatus legacy_DeleteSecmodDB(const char *appName,
459 + const char *filename, 468 + const char *filename,
460 + const char *dbname, char *params, PRBool rw); 469 + const char *dbname, char *params, PRBool rw);
461 +extern SECStatus legacy_AddSecmodDB(const char *appName, 470 +extern SECStatus legacy_AddSecmodDB(const char *appName,
462 + const char *filename, 471 + const char *filename,
463 + const char *dbname, char *params, PRBool rw); 472 + const char *dbname, char *params, PRBool rw);
464 +extern SECStatus legacy_Shutdown(PRBool forked); 473 +extern SECStatus legacy_Shutdown(PRBool forked);
465 +extern void legacy_SetCryptFunctions(LGEncryptFunc, LGDecryptFunc); 474 +extern void legacy_SetCryptFunctions(LGEncryptFunc, LGDecryptFunc);
466 + 475 +
467 /* 476 /*
468 * Softoken Glue Functions 477 * Softoken Glue Functions
469 */ 478 */
470 diff -r db5b7e3c69a5 lib/util/secport.h 479 diff --git a/nss/lib/util/secport.h b/nss/lib/util/secport.h
471 --- a/lib/util/secport.h» Tue May 28 23:37:46 2013 +0200 480 index 5b09b9c..f01eb74 100644
472 +++ b/lib/util/secport.h» Fri May 31 17:44:06 2013 -0700 481 --- a/nss/lib/util/secport.h
473 @@ -210,6 +210,7 @@ 482 +++ b/nss/lib/util/secport.h
483 @@ -210,6 +210,7 @@ extern int NSS_PutEnv(const char * envVarName, const char * envValue);
474 484
475 extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n); 485 extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n);
476 486
477 +#ifndef NSS_STATIC 487 +#ifndef NSS_STATIC
478 /* 488 /*
479 * Load a shared library called "newShLibName" in the same directory as 489 * Load a shared library called "newShLibName" in the same directory as
480 * a shared library that is already loaded, called existingShLibName. 490 * a shared library that is already loaded, called existingShLibName.
481 @@ -244,6 +245,7 @@ 491 @@ -244,6 +245,7 @@ PRLibrary *
482 PORT_LoadLibraryFromOrigin(const char* existingShLibName, 492 PORT_LoadLibraryFromOrigin(const char* existingShLibName,
483 PRFuncPtr staticShLibFunc, 493 PRFuncPtr staticShLibFunc,
484 const char *newShLibName); 494 const char *newShLibName);
485 +#endif /* NSS_STATIC */ 495 +#endif /* NSS_STATIC */
486 496
487 SEC_END_PROTOS 497 SEC_END_PROTOS
488 498
OLDNEW
« no previous file with comments | « patches/nss-chacha20-poly1305.patch ('k') | scripts/nss-checkout.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698