1 |
commit: 27037007ea09027bcebb488b1e348f192ba115e3 |
2 |
Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com> |
3 |
AuthorDate: Thu Jan 2 06:59:03 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 2 18:33:58 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27037007 |
7 |
|
8 |
dev-libs/nss: remove unused patches |
9 |
|
10 |
Signed-off-by: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail.com> |
11 |
Closes: https://github.com/gentoo/gentoo/pull/14210 |
12 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
13 |
|
14 |
dev-libs/nss/files/nss-3.21-enable-pem.patch | 11 - |
15 |
dev-libs/nss/files/nss-3.32-gentoo-fixups.patch | 274 ------------ |
16 |
dev-libs/nss/files/nss-3.36.7-fix-cms.patch | 531 ------------------------ |
17 |
3 files changed, 816 deletions(-) |
18 |
|
19 |
diff --git a/dev-libs/nss/files/nss-3.21-enable-pem.patch b/dev-libs/nss/files/nss-3.21-enable-pem.patch |
20 |
deleted file mode 100644 |
21 |
index e6de275787d..00000000000 |
22 |
--- a/dev-libs/nss/files/nss-3.21-enable-pem.patch |
23 |
+++ /dev/null |
24 |
@@ -1,11 +0,0 @@ |
25 |
---- nss/lib/ckfw/manifest.mn |
26 |
-+++ nss/lib/ckfw/manifest.mn |
27 |
-@@ -5,7 +5,7 @@ |
28 |
- |
29 |
- CORE_DEPTH = ../.. |
30 |
- |
31 |
--DIRS = builtins |
32 |
-+DIRS = builtins pem |
33 |
- |
34 |
- PRIVATE_EXPORTS = \ |
35 |
- ck.h \ |
36 |
|
37 |
diff --git a/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch b/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch |
38 |
deleted file mode 100644 |
39 |
index 1773da98819..00000000000 |
40 |
--- a/dev-libs/nss/files/nss-3.32-gentoo-fixups.patch |
41 |
+++ /dev/null |
42 |
@@ -1,274 +0,0 @@ |
43 |
-From 8e49e1c92dadc2e7a41cad44637f4a224e4f5b39 Mon Sep 17 00:00:00 2001 |
44 |
-From: "Jory A. Pratt" <anarchy@g.o> |
45 |
-Date: Fri, 28 Jul 2017 14:00:41 -0500 |
46 |
-Subject: [PATCH] add pkg-config file |
47 |
- |
48 |
-Signed-off-by: Jory A. Pratt <anarchy@g.o> |
49 |
---- |
50 |
- Makefile | 11 +--- |
51 |
- config/Makefile | 40 ++++++++++++++ |
52 |
- config/nss-config.in | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++ |
53 |
- config/nss.pc.in | 12 +++++ |
54 |
- manifest.mn | 2 +- |
55 |
- 5 files changed, 199 insertions(+), 11 deletions(-) |
56 |
- create mode 100644 config/Makefile |
57 |
- create mode 100644 config/nss-config.in |
58 |
- create mode 100644 config/nss.pc.in |
59 |
- |
60 |
-diff --git a/Makefile b/Makefile |
61 |
-index 48bae37..9850883 100644 |
62 |
---- a/Makefile |
63 |
-+++ b/Makefile |
64 |
-@@ -47,7 +47,7 @@ include $(CORE_DEPTH)/coreconf/rules.mk |
65 |
- # (7) Execute "local" rules. (OPTIONAL). # |
66 |
- ####################################################################### |
67 |
- |
68 |
--nss_build_all: build_nspr all latest |
69 |
-+nss_build_all: all latest |
70 |
- |
71 |
- nss_clean_all: clobber_nspr clobber |
72 |
- |
73 |
-@@ -135,15 +135,6 @@ $(NSPR_CONFIG_STATUS): $(NSPR_CONFIGURE) |
74 |
- --prefix='$(NSS_GYP_PREFIX)' |
75 |
- endif |
76 |
- |
77 |
--build_nspr: $(NSPR_CONFIG_STATUS) |
78 |
-- $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) |
79 |
-- |
80 |
--install_nspr: build_nspr |
81 |
-- $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) install |
82 |
-- |
83 |
--clobber_nspr: $(NSPR_CONFIG_STATUS) |
84 |
-- $(MAKE) -C $(CORE_DEPTH)/../nspr/$(OBJDIR_NAME) clobber |
85 |
-- |
86 |
- build_docs: |
87 |
- $(MAKE) -C $(CORE_DEPTH)/doc |
88 |
- |
89 |
-diff --git a/config/Makefile b/config/Makefile |
90 |
-new file mode 100644 |
91 |
-index 0000000..600fe48 |
92 |
---- /dev/null |
93 |
-+++ b/config/Makefile |
94 |
-@@ -0,0 +1,40 @@ |
95 |
-+CORE_DEPTH = .. |
96 |
-+DEPTH = .. |
97 |
-+ |
98 |
-+include $(CORE_DEPTH)/coreconf/config.mk |
99 |
-+ |
100 |
-+NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'` |
101 |
-+NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'` |
102 |
-+NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'` |
103 |
-+PREFIX = /usr |
104 |
-+ |
105 |
-+all: export libs |
106 |
-+ |
107 |
-+export: |
108 |
-+ # Create the nss.pc file |
109 |
-+ mkdir -p $(DIST)/lib/pkgconfig |
110 |
-+ sed -e "s,@prefix@,$(PREFIX)," \ |
111 |
-+ -e "s,@exec_prefix@,\$${prefix}," \ |
112 |
-+ -e "s,@libdir@,\$${prefix}/lib64," \ |
113 |
-+ -e "s,@includedir@,\$${prefix}/include/nss," \ |
114 |
-+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \ |
115 |
-+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \ |
116 |
-+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \ |
117 |
-+ nss.pc.in > nss.pc |
118 |
-+ chmod 0644 nss.pc |
119 |
-+ ln -sf ../../../../config/nss.pc $(DIST)/lib/pkgconfig |
120 |
-+ |
121 |
-+ # Create the nss-config script |
122 |
-+ mkdir -p $(DIST)/bin |
123 |
-+ sed -e "s,@prefix@,$(PREFIX)," \ |
124 |
-+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \ |
125 |
-+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \ |
126 |
-+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \ |
127 |
-+ nss-config.in > nss-config |
128 |
-+ chmod 0755 nss-config |
129 |
-+ ln -sf ../../../config/nss-config $(DIST)/bin |
130 |
-+ |
131 |
-+libs: |
132 |
-+ |
133 |
-+dummy: all export libs |
134 |
-+ |
135 |
-diff --git a/config/nss-config.in b/config/nss-config.in |
136 |
-new file mode 100644 |
137 |
-index 0000000..1d7c444 |
138 |
---- /dev/null |
139 |
-+++ b/config/nss-config.in |
140 |
-@@ -0,0 +1,145 @@ |
141 |
-+#!/bin/sh |
142 |
-+ |
143 |
-+prefix=@prefix@ |
144 |
-+ |
145 |
-+major_version=@NSS_MAJOR_VERSION@ |
146 |
-+minor_version=@NSS_MINOR_VERSION@ |
147 |
-+patch_version=@NSS_PATCH_VERSION@ |
148 |
-+ |
149 |
-+usage() |
150 |
-+{ |
151 |
-+ cat <<EOF |
152 |
-+Usage: nss-config [OPTIONS] [LIBRARIES] |
153 |
-+Options: |
154 |
-+ [--prefix[=DIR]] |
155 |
-+ [--exec-prefix[=DIR]] |
156 |
-+ [--includedir[=DIR]] |
157 |
-+ [--libdir[=DIR]] |
158 |
-+ [--version] |
159 |
-+ [--libs] |
160 |
-+ [--cflags] |
161 |
-+Dynamic Libraries: |
162 |
-+ nss |
163 |
-+ ssl |
164 |
-+ smime |
165 |
-+ nssutil |
166 |
-+EOF |
167 |
-+ exit $1 |
168 |
-+} |
169 |
-+ |
170 |
-+if test $# -eq 0; then |
171 |
-+ usage 1 1>&2 |
172 |
-+fi |
173 |
-+ |
174 |
-+lib_ssl=yes |
175 |
-+lib_smime=yes |
176 |
-+lib_nss=yes |
177 |
-+lib_nssutil=yes |
178 |
-+ |
179 |
-+while test $# -gt 0; do |
180 |
-+ case "$1" in |
181 |
-+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
182 |
-+ *) optarg= ;; |
183 |
-+ esac |
184 |
-+ |
185 |
-+ case $1 in |
186 |
-+ --prefix=*) |
187 |
-+ prefix=$optarg |
188 |
-+ ;; |
189 |
-+ --prefix) |
190 |
-+ echo_prefix=yes |
191 |
-+ ;; |
192 |
-+ --exec-prefix=*) |
193 |
-+ exec_prefix=$optarg |
194 |
-+ ;; |
195 |
-+ --exec-prefix) |
196 |
-+ echo_exec_prefix=yes |
197 |
-+ ;; |
198 |
-+ --includedir=*) |
199 |
-+ includedir=$optarg |
200 |
-+ ;; |
201 |
-+ --includedir) |
202 |
-+ echo_includedir=yes |
203 |
-+ ;; |
204 |
-+ --libdir=*) |
205 |
-+ libdir=$optarg |
206 |
-+ ;; |
207 |
-+ --libdir) |
208 |
-+ echo_libdir=yes |
209 |
-+ ;; |
210 |
-+ --version) |
211 |
-+ echo ${major_version}.${minor_version}.${patch_version} |
212 |
-+ ;; |
213 |
-+ --cflags) |
214 |
-+ echo_cflags=yes |
215 |
-+ ;; |
216 |
-+ --libs) |
217 |
-+ echo_libs=yes |
218 |
-+ ;; |
219 |
-+ ssl) |
220 |
-+ lib_ssl=yes |
221 |
-+ ;; |
222 |
-+ smime) |
223 |
-+ lib_smime=yes |
224 |
-+ ;; |
225 |
-+ nss) |
226 |
-+ lib_nss=yes |
227 |
-+ ;; |
228 |
-+ nssutil) |
229 |
-+ lib_nssutil=yes |
230 |
-+ ;; |
231 |
-+ *) |
232 |
-+ usage 1 1>&2 |
233 |
-+ ;; |
234 |
-+ esac |
235 |
-+ shift |
236 |
-+done |
237 |
-+ |
238 |
-+# Set variables that may be dependent upon other variables |
239 |
-+if test -z "$exec_prefix"; then |
240 |
-+ exec_prefix=`pkg-config --variable=exec_prefix nss` |
241 |
-+fi |
242 |
-+if test -z "$includedir"; then |
243 |
-+ includedir=`pkg-config --variable=includedir nss` |
244 |
-+fi |
245 |
-+if test -z "$libdir"; then |
246 |
-+ libdir=`pkg-config --variable=libdir nss` |
247 |
-+fi |
248 |
-+ |
249 |
-+if test "$echo_prefix" = "yes"; then |
250 |
-+ echo $prefix |
251 |
-+fi |
252 |
-+ |
253 |
-+if test "$echo_exec_prefix" = "yes"; then |
254 |
-+ echo $exec_prefix |
255 |
-+fi |
256 |
-+ |
257 |
-+if test "$echo_includedir" = "yes"; then |
258 |
-+ echo $includedir |
259 |
-+fi |
260 |
-+ |
261 |
-+if test "$echo_libdir" = "yes"; then |
262 |
-+ echo $libdir |
263 |
-+fi |
264 |
-+ |
265 |
-+if test "$echo_cflags" = "yes"; then |
266 |
-+ echo -I$includedir |
267 |
-+fi |
268 |
-+ |
269 |
-+if test "$echo_libs" = "yes"; then |
270 |
-+ libdirs="" |
271 |
-+ if test -n "$lib_ssl"; then |
272 |
-+ libdirs="$libdirs -lssl${major_version}" |
273 |
-+ fi |
274 |
-+ if test -n "$lib_smime"; then |
275 |
-+ libdirs="$libdirs -lsmime${major_version}" |
276 |
-+ fi |
277 |
-+ if test -n "$lib_nss"; then |
278 |
-+ libdirs="$libdirs -lnss${major_version}" |
279 |
-+ fi |
280 |
-+ if test -n "$lib_nssutil"; then |
281 |
-+ libdirs="$libdirs -lnssutil${major_version}" |
282 |
-+ fi |
283 |
-+ echo $libdirs |
284 |
-+fi |
285 |
-+ |
286 |
-diff --git a/config/nss.pc.in b/config/nss.pc.in |
287 |
-new file mode 100644 |
288 |
-index 0000000..df9e2cf |
289 |
---- /dev/null |
290 |
-+++ b/config/nss.pc.in |
291 |
-@@ -0,0 +1,12 @@ |
292 |
-+prefix=@prefix@ |
293 |
-+exec_prefix=@exec_prefix@ |
294 |
-+libdir=@libdir@ |
295 |
-+includedir=@includedir@ |
296 |
-+ |
297 |
-+Name: NSS |
298 |
-+Description: Network Security Services |
299 |
-+Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@ |
300 |
-+Requires: nspr >= 4.8 |
301 |
-+Libs: -lssl3 -lsmime3 -lnss3 -lnssutil3 |
302 |
-+Cflags: -I${includedir} |
303 |
-+ |
304 |
-diff --git a/manifest.mn b/manifest.mn |
305 |
-index 500a5ad..87c905e 100644 |
306 |
---- a/manifest.mn |
307 |
-+++ b/manifest.mn |
308 |
-@@ -10,4 +10,4 @@ IMPORTS = nspr20/v4.8 \ |
309 |
- |
310 |
- RELEASE = nss |
311 |
- |
312 |
--DIRS = coreconf lib cmd cpputil gtests |
313 |
-+DIRS = coreconf lib cmd cpputil config |
314 |
--- |
315 |
-2.13.3 |
316 |
- |
317 |
|
318 |
diff --git a/dev-libs/nss/files/nss-3.36.7-fix-cms.patch b/dev-libs/nss/files/nss-3.36.7-fix-cms.patch |
319 |
deleted file mode 100644 |
320 |
index 57b4cdaf5a5..00000000000 |
321 |
--- a/dev-libs/nss/files/nss-3.36.7-fix-cms.patch |
322 |
+++ /dev/null |
323 |
@@ -1,531 +0,0 @@ |
324 |
-From d54a1f812ae23ec11d2af6ed93ba1a11609421a8 Mon Sep 17 00:00:00 2001 |
325 |
-From: "J.C. Jones" <jjones@×××××××.com> |
326 |
-Date: Mon, 14 Jan 2019 10:35:25 -0700 |
327 |
-Subject: [PATCH] Bug 1507135 - Add additional null checks to CMS message |
328 |
- functions r=mt |
329 |
- |
330 |
-Differential review: https://phabricator.services.mozilla.com//D16488 |
331 |
- |
332 |
---HG-- |
333 |
-branch : NSS_3_36_BRANCH |
334 |
-extra : transplant_source : 1%02%80%21%BE%C8B%D5%21%D7%0CR%00%ED%B6%EA%84a%FA%23 |
335 |
---- |
336 |
- lib/smime/cmsmessage.c | 69 ++++++++++++++++++++++++++++++++++++------ |
337 |
- 1 file changed, 59 insertions(+), 10 deletions(-) |
338 |
- |
339 |
-diff --git a/lib/smime/cmsmessage.c b/lib/smime/cmsmessage.c |
340 |
-index 27d1256ec..f41a432b1 100644 |
341 |
---- a/lib/smime/cmsmessage.c |
342 |
-+++ b/lib/smime/cmsmessage.c |
343 |
-@@ -29,8 +29,9 @@ NSS_CMSMessage_Create(PLArenaPool *poolp) |
344 |
- |
345 |
- if (poolp == NULL) { |
346 |
- poolp = PORT_NewArena(1024); /* XXX what is right value? */ |
347 |
-- if (poolp == NULL) |
348 |
-+ if (poolp == NULL) { |
349 |
- return NULL; |
350 |
-+ } |
351 |
- poolp_is_ours = PR_TRUE; |
352 |
- } |
353 |
- |
354 |
-@@ -44,8 +45,9 @@ NSS_CMSMessage_Create(PLArenaPool *poolp) |
355 |
- if (mark) { |
356 |
- PORT_ArenaRelease(poolp, mark); |
357 |
- } |
358 |
-- } else |
359 |
-+ } else { |
360 |
- PORT_FreeArena(poolp, PR_FALSE); |
361 |
-+ } |
362 |
- return NULL; |
363 |
- } |
364 |
- |
365 |
-@@ -53,8 +55,9 @@ NSS_CMSMessage_Create(PLArenaPool *poolp) |
366 |
- cmsg->poolp_is_ours = poolp_is_ours; |
367 |
- cmsg->refCount = 1; |
368 |
- |
369 |
-- if (mark) |
370 |
-+ if (mark) { |
371 |
- PORT_ArenaUnmark(poolp, mark); |
372 |
-+ } |
373 |
- |
374 |
- return cmsg; |
375 |
- } |
376 |
-@@ -73,8 +76,13 @@ NSS_CMSMessage_SetEncodingParams(NSSCMSMessage *cmsg, |
377 |
- NSSCMSGetDecryptKeyCallback decrypt_key_cb, void *decrypt_key_cb_arg, |
378 |
- SECAlgorithmID **detached_digestalgs, SECItem **detached_digests) |
379 |
- { |
380 |
-- if (pwfn) |
381 |
-+ if (cmsg == NULL) { |
382 |
-+ return; |
383 |
-+ } |
384 |
-+ if (pwfn) { |
385 |
- PK11_SetPasswordFunc(pwfn); |
386 |
-+ } |
387 |
-+ |
388 |
- cmsg->pwfn_arg = pwfn_arg; |
389 |
- cmsg->decrypt_key_cb = decrypt_key_cb; |
390 |
- cmsg->decrypt_key_cb_arg = decrypt_key_cb_arg; |
391 |
-@@ -89,18 +97,21 @@ void |
392 |
- NSS_CMSMessage_Destroy(NSSCMSMessage *cmsg) |
393 |
- { |
394 |
- PORT_Assert(cmsg->refCount > 0); |
395 |
-- if (cmsg->refCount <= 0) /* oops */ |
396 |
-+ if (cmsg->refCount <= 0) { /* oops */ |
397 |
- return; |
398 |
-+ } |
399 |
- |
400 |
- cmsg->refCount--; /* thread safety? */ |
401 |
-- if (cmsg->refCount > 0) |
402 |
-+ if (cmsg->refCount > 0) { |
403 |
- return; |
404 |
-+ } |
405 |
- |
406 |
- NSS_CMSContentInfo_Destroy(&(cmsg->contentInfo)); |
407 |
- |
408 |
- /* if poolp is not NULL, cmsg is the owner of its arena */ |
409 |
-- if (cmsg->poolp_is_ours) |
410 |
-+ if (cmsg->poolp_is_ours) { |
411 |
- PORT_FreeArena(cmsg->poolp, PR_FALSE); /* XXX clear it? */ |
412 |
-+ } |
413 |
- } |
414 |
- |
415 |
- /* |
416 |
-@@ -112,8 +123,9 @@ NSS_CMSMessage_Destroy(NSSCMSMessage *cmsg) |
417 |
- NSSCMSMessage * |
418 |
- NSS_CMSMessage_Copy(NSSCMSMessage *cmsg) |
419 |
- { |
420 |
-- if (cmsg == NULL) |
421 |
-+ if (cmsg == NULL) { |
422 |
- return NULL; |
423 |
-+ } |
424 |
- |
425 |
- PORT_Assert(cmsg->refCount > 0); |
426 |
- |
427 |
-@@ -127,6 +139,10 @@ NSS_CMSMessage_Copy(NSSCMSMessage *cmsg) |
428 |
- PLArenaPool * |
429 |
- NSS_CMSMessage_GetArena(NSSCMSMessage *cmsg) |
430 |
- { |
431 |
-+ if (cmsg == NULL) { |
432 |
-+ return NULL; |
433 |
-+ } |
434 |
-+ |
435 |
- return cmsg->poolp; |
436 |
- } |
437 |
- |
438 |
-@@ -136,6 +152,10 @@ NSS_CMSMessage_GetArena(NSSCMSMessage *cmsg) |
439 |
- NSSCMSContentInfo * |
440 |
- NSS_CMSMessage_GetContentInfo(NSSCMSMessage *cmsg) |
441 |
- { |
442 |
-+ if (cmsg == NULL) { |
443 |
-+ return NULL; |
444 |
-+ } |
445 |
-+ |
446 |
- return &(cmsg->contentInfo); |
447 |
- } |
448 |
- |
449 |
-@@ -147,6 +167,10 @@ NSS_CMSMessage_GetContentInfo(NSSCMSMessage *cmsg) |
450 |
- SECItem * |
451 |
- NSS_CMSMessage_GetContent(NSSCMSMessage *cmsg) |
452 |
- { |
453 |
-+ if (cmsg == NULL) { |
454 |
-+ return NULL; |
455 |
-+ } |
456 |
-+ |
457 |
- /* this is a shortcut */ |
458 |
- NSSCMSContentInfo *cinfo = NSS_CMSMessage_GetContentInfo(cmsg); |
459 |
- SECItem *pItem = NSS_CMSContentInfo_GetInnerContent(cinfo); |
460 |
-@@ -164,6 +188,10 @@ NSS_CMSMessage_ContentLevelCount(NSSCMSMessage *cmsg) |
461 |
- int count = 0; |
462 |
- NSSCMSContentInfo *cinfo; |
463 |
- |
464 |
-+ if (cmsg == NULL) { |
465 |
-+ return 0; |
466 |
-+ } |
467 |
-+ |
468 |
- /* walk down the chain of contentinfos */ |
469 |
- for (cinfo = &(cmsg->contentInfo); cinfo != NULL;) { |
470 |
- count++; |
471 |
-@@ -183,6 +211,10 @@ NSS_CMSMessage_ContentLevel(NSSCMSMessage *cmsg, int n) |
472 |
- int count = 0; |
473 |
- NSSCMSContentInfo *cinfo; |
474 |
- |
475 |
-+ if (cmsg == NULL) { |
476 |
-+ return NULL; |
477 |
-+ } |
478 |
-+ |
479 |
- /* walk down the chain of contentinfos */ |
480 |
- for (cinfo = &(cmsg->contentInfo); cinfo != NULL && count < n; |
481 |
- cinfo = NSS_CMSContentInfo_GetChildContentInfo(cinfo)) { |
482 |
-@@ -200,6 +232,10 @@ NSS_CMSMessage_ContainsCertsOrCrls(NSSCMSMessage *cmsg) |
483 |
- { |
484 |
- NSSCMSContentInfo *cinfo; |
485 |
- |
486 |
-+ if (cmsg == NULL) { |
487 |
-+ return PR_FALSE; |
488 |
-+ } |
489 |
-+ |
490 |
- /* descend into CMS message */ |
491 |
- for (cinfo = &(cmsg->contentInfo); cinfo != NULL; |
492 |
- cinfo = NSS_CMSContentInfo_GetChildContentInfo(cinfo)) { |
493 |
-@@ -221,6 +257,10 @@ NSS_CMSMessage_IsEncrypted(NSSCMSMessage *cmsg) |
494 |
- { |
495 |
- NSSCMSContentInfo *cinfo; |
496 |
- |
497 |
-+ if (cmsg == NULL) { |
498 |
-+ return PR_FALSE; |
499 |
-+ } |
500 |
-+ |
501 |
- /* walk down the chain of contentinfos */ |
502 |
- for (cinfo = &(cmsg->contentInfo); cinfo != NULL; |
503 |
- cinfo = NSS_CMSContentInfo_GetChildContentInfo(cinfo)) { |
504 |
-@@ -251,13 +291,21 @@ NSS_CMSMessage_IsSigned(NSSCMSMessage *cmsg) |
505 |
- { |
506 |
- NSSCMSContentInfo *cinfo; |
507 |
- |
508 |
-+ if (cmsg == NULL) { |
509 |
-+ return PR_FALSE; |
510 |
-+ } |
511 |
-+ |
512 |
- /* walk down the chain of contentinfos */ |
513 |
- for (cinfo = &(cmsg->contentInfo); cinfo != NULL; |
514 |
- cinfo = NSS_CMSContentInfo_GetChildContentInfo(cinfo)) { |
515 |
- switch (NSS_CMSContentInfo_GetContentTypeTag(cinfo)) { |
516 |
- case SEC_OID_PKCS7_SIGNED_DATA: |
517 |
-- if (!NSS_CMSArray_IsEmpty((void **)cinfo->content.signedData->signerInfos)) |
518 |
-+ if (cinfo->content.signedData == NULL) { |
519 |
-+ return PR_FALSE; |
520 |
-+ } |
521 |
-+ if (!NSS_CMSArray_IsEmpty((void **)cinfo->content.signedData->signerInfos)) { |
522 |
- return PR_TRUE; |
523 |
-+ } |
524 |
- break; |
525 |
- default: |
526 |
- /* callback here for generic wrappers? */ |
527 |
-@@ -278,8 +326,9 @@ NSS_CMSMessage_IsContentEmpty(NSSCMSMessage *cmsg, unsigned int minLen) |
528 |
- { |
529 |
- SECItem *item = NULL; |
530 |
- |
531 |
-- if (cmsg == NULL) |
532 |
-+ if (cmsg == NULL) { |
533 |
- return PR_TRUE; |
534 |
-+ } |
535 |
- |
536 |
- item = NSS_CMSContentInfo_GetContent(NSS_CMSMessage_GetContentInfo(cmsg)); |
537 |
- |
538 |
-From fa26771e9515cc82c941fcef689dd797a3e308c3 Mon Sep 17 00:00:00 2001 |
539 |
-From: "J.C. Jones" <jjones@×××××××.com> |
540 |
-Date: Fri, 11 Jan 2019 22:33:16 -0700 |
541 |
-Subject: [PATCH] Bug 1507174 - Add additional null checks to other CMS |
542 |
- functions r=mt |
543 |
- |
544 |
-Differential review: https://phabricator.services.mozilla.com//D16383 |
545 |
- |
546 |
---HG-- |
547 |
-branch : NSS_3_36_BRANCH |
548 |
-extra : transplant_source : %B5%A8su%96%5B%BE%F9%CD%93%E0%EE%93a4c%1BYp%09 |
549 |
---- |
550 |
- lib/smime/cmscinfo.c | 92 ++++++++++++++++++++++++++++++++++++------ |
551 |
- lib/smime/cmsdigdata.c | 4 +- |
552 |
- lib/smime/cmsencdata.c | 4 +- |
553 |
- lib/smime/cmsenvdata.c | 5 +++ |
554 |
- lib/smime/cmsmessage.c | 3 ++ |
555 |
- lib/smime/cmsudf.c | 2 +- |
556 |
- 6 files changed, 95 insertions(+), 15 deletions(-) |
557 |
- |
558 |
-diff --git a/lib/smime/cmscinfo.c b/lib/smime/cmscinfo.c |
559 |
-index 08db662f8..453ccaada 100644 |
560 |
---- a/lib/smime/cmscinfo.c |
561 |
-+++ b/lib/smime/cmscinfo.c |
562 |
-@@ -51,6 +51,10 @@ NSS_CMSContentInfo_Destroy(NSSCMSContentInfo *cinfo) |
563 |
- { |
564 |
- SECOidTag kind; |
565 |
- |
566 |
-+ if (cinfo == NULL) { |
567 |
-+ return; |
568 |
-+ } |
569 |
-+ |
570 |
- kind = NSS_CMSContentInfo_GetContentTypeTag(cinfo); |
571 |
- switch (kind) { |
572 |
- case SEC_OID_PKCS7_ENVELOPED_DATA: |
573 |
-@@ -86,6 +90,11 @@ NSSCMSContentInfo * |
574 |
- NSS_CMSContentInfo_GetChildContentInfo(NSSCMSContentInfo *cinfo) |
575 |
- { |
576 |
- NSSCMSContentInfo *ccinfo = NULL; |
577 |
-+ |
578 |
-+ if (cinfo == NULL) { |
579 |
-+ return NULL; |
580 |
-+ } |
581 |
-+ |
582 |
- SECOidTag tag = NSS_CMSContentInfo_GetContentTypeTag(cinfo); |
583 |
- switch (tag) { |
584 |
- case SEC_OID_PKCS7_SIGNED_DATA: |
585 |
-@@ -127,6 +136,9 @@ SECStatus |
586 |
- NSS_CMSContentInfo_SetDontStream(NSSCMSContentInfo *cinfo, PRBool dontStream) |
587 |
- { |
588 |
- SECStatus rv; |
589 |
-+ if (cinfo == NULL) { |
590 |
-+ return SECFailure; |
591 |
-+ } |
592 |
- |
593 |
- rv = NSS_CMSContentInfo_Private_Init(cinfo); |
594 |
- if (rv != SECSuccess) { |
595 |
-@@ -145,15 +157,20 @@ NSS_CMSContentInfo_SetContent(NSSCMSMessage *cmsg, NSSCMSContentInfo *cinfo, |
596 |
- SECOidTag type, void *ptr) |
597 |
- { |
598 |
- SECStatus rv; |
599 |
-+ if (cinfo == NULL || cmsg == NULL) { |
600 |
-+ return SECFailure; |
601 |
-+ } |
602 |
- |
603 |
- cinfo->contentTypeTag = SECOID_FindOIDByTag(type); |
604 |
-- if (cinfo->contentTypeTag == NULL) |
605 |
-+ if (cinfo->contentTypeTag == NULL) { |
606 |
- return SECFailure; |
607 |
-+ } |
608 |
- |
609 |
- /* do not copy the oid, just create a reference */ |
610 |
- rv = SECITEM_CopyItem(cmsg->poolp, &(cinfo->contentType), &(cinfo->contentTypeTag->oid)); |
611 |
-- if (rv != SECSuccess) |
612 |
-+ if (rv != SECSuccess) { |
613 |
- return SECFailure; |
614 |
-+ } |
615 |
- |
616 |
- cinfo->content.pointer = ptr; |
617 |
- |
618 |
-@@ -185,8 +202,9 @@ SECStatus |
619 |
- NSS_CMSContentInfo_SetContent_Data(NSSCMSMessage *cmsg, NSSCMSContentInfo *cinfo, |
620 |
- SECItem *data, PRBool detached) |
621 |
- { |
622 |
-- if (NSS_CMSContentInfo_SetContent(cmsg, cinfo, SEC_OID_PKCS7_DATA, (void *)data) != SECSuccess) |
623 |
-+ if (NSS_CMSContentInfo_SetContent(cmsg, cinfo, SEC_OID_PKCS7_DATA, (void *)data) != SECSuccess) { |
624 |
- return SECFailure; |
625 |
-+ } |
626 |
- if (detached) { |
627 |
- cinfo->rawContent = NULL; |
628 |
- } |
629 |
-@@ -230,6 +248,10 @@ NSS_CMSContentInfo_SetContent_EncryptedData(NSSCMSMessage *cmsg, NSSCMSContentIn |
630 |
- void * |
631 |
- NSS_CMSContentInfo_GetContent(NSSCMSContentInfo *cinfo) |
632 |
- { |
633 |
-+ if (cinfo == NULL) { |
634 |
-+ return NULL; |
635 |
-+ } |
636 |
-+ |
637 |
- SECOidTag tag = cinfo->contentTypeTag |
638 |
- ? cinfo->contentTypeTag->offset |
639 |
- : SEC_OID_UNKNOWN; |
640 |
-@@ -260,6 +282,10 @@ NSS_CMSContentInfo_GetInnerContent(NSSCMSContentInfo *cinfo) |
641 |
- SECOidTag tag; |
642 |
- SECItem *pItem = NULL; |
643 |
- |
644 |
-+ if (cinfo == NULL) { |
645 |
-+ return NULL; |
646 |
-+ } |
647 |
-+ |
648 |
- tag = NSS_CMSContentInfo_GetContentTypeTag(cinfo); |
649 |
- if (NSS_CMSType_IsData(tag)) { |
650 |
- pItem = cinfo->content.data; |
651 |
-@@ -282,6 +308,10 @@ NSS_CMSContentInfo_GetInnerContent(NSSCMSContentInfo *cinfo) |
652 |
- SECOidTag |
653 |
- NSS_CMSContentInfo_GetContentTypeTag(NSSCMSContentInfo *cinfo) |
654 |
- { |
655 |
-+ if (cinfo == NULL) { |
656 |
-+ return SEC_OID_UNKNOWN; |
657 |
-+ } |
658 |
-+ |
659 |
- if (cinfo->contentTypeTag == NULL) |
660 |
- cinfo->contentTypeTag = SECOID_FindOID(&(cinfo->contentType)); |
661 |
- |
662 |
-@@ -294,11 +324,17 @@ NSS_CMSContentInfo_GetContentTypeTag(NSSCMSContentInfo *cinfo) |
663 |
- SECItem * |
664 |
- NSS_CMSContentInfo_GetContentTypeOID(NSSCMSContentInfo *cinfo) |
665 |
- { |
666 |
-- if (cinfo->contentTypeTag == NULL) |
667 |
-+ if (cinfo == NULL) { |
668 |
-+ return NULL; |
669 |
-+ } |
670 |
-+ |
671 |
-+ if (cinfo->contentTypeTag == NULL) { |
672 |
- cinfo->contentTypeTag = SECOID_FindOID(&(cinfo->contentType)); |
673 |
-+ } |
674 |
- |
675 |
-- if (cinfo->contentTypeTag == NULL) |
676 |
-+ if (cinfo->contentTypeTag == NULL) { |
677 |
- return NULL; |
678 |
-+ } |
679 |
- |
680 |
- return &(cinfo->contentTypeTag->oid); |
681 |
- } |
682 |
-@@ -310,8 +346,13 @@ NSS_CMSContentInfo_GetContentTypeOID(NSSCMSContentInfo *cinfo) |
683 |
- SECOidTag |
684 |
- NSS_CMSContentInfo_GetContentEncAlgTag(NSSCMSContentInfo *cinfo) |
685 |
- { |
686 |
-- if (cinfo->contentEncAlgTag == SEC_OID_UNKNOWN) |
687 |
-+ if (cinfo == NULL) { |
688 |
-+ return SEC_OID_UNKNOWN; |
689 |
-+ } |
690 |
-+ |
691 |
-+ if (cinfo->contentEncAlgTag == SEC_OID_UNKNOWN) { |
692 |
- cinfo->contentEncAlgTag = SECOID_GetAlgorithmTag(&(cinfo->contentEncAlg)); |
693 |
-+ } |
694 |
- |
695 |
- return cinfo->contentEncAlgTag; |
696 |
- } |
697 |
-@@ -322,6 +363,10 @@ NSS_CMSContentInfo_GetContentEncAlgTag(NSSCMSContentInfo *cinfo) |
698 |
- SECAlgorithmID * |
699 |
- NSS_CMSContentInfo_GetContentEncAlg(NSSCMSContentInfo *cinfo) |
700 |
- { |
701 |
-+ if (cinfo == NULL) { |
702 |
-+ return NULL; |
703 |
-+ } |
704 |
-+ |
705 |
- return &(cinfo->contentEncAlg); |
706 |
- } |
707 |
- |
708 |
-@@ -330,10 +375,14 @@ NSS_CMSContentInfo_SetContentEncAlg(PLArenaPool *poolp, NSSCMSContentInfo *cinfo |
709 |
- SECOidTag bulkalgtag, SECItem *parameters, int keysize) |
710 |
- { |
711 |
- SECStatus rv; |
712 |
-+ if (cinfo == NULL) { |
713 |
-+ return SECFailure; |
714 |
-+ } |
715 |
- |
716 |
- rv = SECOID_SetAlgorithmID(poolp, &(cinfo->contentEncAlg), bulkalgtag, parameters); |
717 |
-- if (rv != SECSuccess) |
718 |
-+ if (rv != SECSuccess) { |
719 |
- return SECFailure; |
720 |
-+ } |
721 |
- cinfo->keysize = keysize; |
722 |
- return SECSuccess; |
723 |
- } |
724 |
-@@ -343,27 +392,42 @@ NSS_CMSContentInfo_SetContentEncAlgID(PLArenaPool *poolp, NSSCMSContentInfo *cin |
725 |
- SECAlgorithmID *algid, int keysize) |
726 |
- { |
727 |
- SECStatus rv; |
728 |
-+ if (cinfo == NULL) { |
729 |
-+ return SECFailure; |
730 |
-+ } |
731 |
- |
732 |
- rv = SECOID_CopyAlgorithmID(poolp, &(cinfo->contentEncAlg), algid); |
733 |
-- if (rv != SECSuccess) |
734 |
-+ if (rv != SECSuccess) { |
735 |
- return SECFailure; |
736 |
-- if (keysize >= 0) |
737 |
-+ } |
738 |
-+ if (keysize >= 0) { |
739 |
- cinfo->keysize = keysize; |
740 |
-+ } |
741 |
- return SECSuccess; |
742 |
- } |
743 |
- |
744 |
- void |
745 |
- NSS_CMSContentInfo_SetBulkKey(NSSCMSContentInfo *cinfo, PK11SymKey *bulkkey) |
746 |
- { |
747 |
-- cinfo->bulkkey = PK11_ReferenceSymKey(bulkkey); |
748 |
-- cinfo->keysize = PK11_GetKeyStrength(cinfo->bulkkey, &(cinfo->contentEncAlg)); |
749 |
-+ if (cinfo == NULL) { |
750 |
-+ return; |
751 |
-+ } |
752 |
-+ |
753 |
-+ if (bulkkey == NULL) { |
754 |
-+ cinfo->bulkkey = NULL; |
755 |
-+ cinfo->keysize = 0; |
756 |
-+ } else { |
757 |
-+ cinfo->bulkkey = PK11_ReferenceSymKey(bulkkey); |
758 |
-+ cinfo->keysize = PK11_GetKeyStrength(cinfo->bulkkey, &(cinfo->contentEncAlg)); |
759 |
-+ } |
760 |
- } |
761 |
- |
762 |
- PK11SymKey * |
763 |
- NSS_CMSContentInfo_GetBulkKey(NSSCMSContentInfo *cinfo) |
764 |
- { |
765 |
-- if (cinfo->bulkkey == NULL) |
766 |
-+ if (cinfo == NULL || cinfo->bulkkey == NULL) { |
767 |
- return NULL; |
768 |
-+ } |
769 |
- |
770 |
- return PK11_ReferenceSymKey(cinfo->bulkkey); |
771 |
- } |
772 |
-@@ -371,5 +435,9 @@ NSS_CMSContentInfo_GetBulkKey(NSSCMSContentInfo *cinfo) |
773 |
- int |
774 |
- NSS_CMSContentInfo_GetBulkKeySize(NSSCMSContentInfo *cinfo) |
775 |
- { |
776 |
-+ if (cinfo == NULL) { |
777 |
-+ return 0; |
778 |
-+ } |
779 |
-+ |
780 |
- return cinfo->keysize; |
781 |
- } |
782 |
-diff --git a/lib/smime/cmsdigdata.c b/lib/smime/cmsdigdata.c |
783 |
-index 9ea22702e..a249686bb 100644 |
784 |
---- a/lib/smime/cmsdigdata.c |
785 |
-+++ b/lib/smime/cmsdigdata.c |
786 |
-@@ -56,7 +56,9 @@ void |
787 |
- NSS_CMSDigestedData_Destroy(NSSCMSDigestedData *digd) |
788 |
- { |
789 |
- /* everything's in a pool, so don't worry about the storage */ |
790 |
-- NSS_CMSContentInfo_Destroy(&(digd->contentInfo)); |
791 |
-+ if (digd != NULL) { |
792 |
-+ NSS_CMSContentInfo_Destroy(&(digd->contentInfo)); |
793 |
-+ } |
794 |
- return; |
795 |
- } |
796 |
- |
797 |
-diff --git a/lib/smime/cmsencdata.c b/lib/smime/cmsencdata.c |
798 |
-index c3a4549ad..8b520b439 100644 |
799 |
---- a/lib/smime/cmsencdata.c |
800 |
-+++ b/lib/smime/cmsencdata.c |
801 |
-@@ -87,7 +87,9 @@ void |
802 |
- NSS_CMSEncryptedData_Destroy(NSSCMSEncryptedData *encd) |
803 |
- { |
804 |
- /* everything's in a pool, so don't worry about the storage */ |
805 |
-- NSS_CMSContentInfo_Destroy(&(encd->contentInfo)); |
806 |
-+ if (encd != NULL) { |
807 |
-+ NSS_CMSContentInfo_Destroy(&(encd->contentInfo)); |
808 |
-+ } |
809 |
- return; |
810 |
- } |
811 |
- |
812 |
-diff --git a/lib/smime/cmsenvdata.c b/lib/smime/cmsenvdata.c |
813 |
-index f2c8e171d..9bc77be8b 100644 |
814 |
---- a/lib/smime/cmsenvdata.c |
815 |
-+++ b/lib/smime/cmsenvdata.c |
816 |
-@@ -144,6 +144,11 @@ NSS_CMSEnvelopedData_Encode_BeforeStart(NSSCMSEnvelopedData *envd) |
817 |
- poolp = envd->cmsg->poolp; |
818 |
- cinfo = &(envd->contentInfo); |
819 |
- |
820 |
-+ if (cinfo == NULL) { |
821 |
-+ PORT_SetError(SEC_ERROR_BAD_DATA); |
822 |
-+ goto loser; |
823 |
-+ } |
824 |
-+ |
825 |
- recipientinfos = envd->recipientInfos; |
826 |
- if (recipientinfos == NULL) { |
827 |
- PORT_SetError(SEC_ERROR_BAD_DATA); |
828 |
-diff --git a/lib/smime/cmsmessage.c b/lib/smime/cmsmessage.c |
829 |
-index f41a432b1..366b71aba 100644 |
830 |
---- a/lib/smime/cmsmessage.c |
831 |
-+++ b/lib/smime/cmsmessage.c |
832 |
-@@ -96,6 +96,9 @@ NSS_CMSMessage_SetEncodingParams(NSSCMSMessage *cmsg, |
833 |
- void |
834 |
- NSS_CMSMessage_Destroy(NSSCMSMessage *cmsg) |
835 |
- { |
836 |
-+ if (cmsg == NULL) |
837 |
-+ return; |
838 |
-+ |
839 |
- PORT_Assert(cmsg->refCount > 0); |
840 |
- if (cmsg->refCount <= 0) { /* oops */ |
841 |
- return; |
842 |
-diff --git a/lib/smime/cmsudf.c b/lib/smime/cmsudf.c |
843 |
-index 3ef4268d4..5c8a81e6d 100644 |
844 |
---- a/lib/smime/cmsudf.c |
845 |
-+++ b/lib/smime/cmsudf.c |
846 |
-@@ -239,7 +239,7 @@ NSS_CMSGenericWrapperData_Destroy(SECOidTag type, NSSCMSGenericWrapperData *gd) |
847 |
- { |
848 |
- const nsscmstypeInfo *typeInfo = nss_cmstype_lookup(type); |
849 |
- |
850 |
-- if (typeInfo && typeInfo->destroy) { |
851 |
-+ if (typeInfo && (typeInfo->destroy) && (gd != NULL)) { |
852 |
- (*typeInfo->destroy)(gd); |
853 |
- } |
854 |
- } |