public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Initialize NSS as early as possible (#382091)
Date: Mon, 23 Nov 2026 09:24:45 GMT [thread overview]
Message-ID: <179542588521.1.4605236856962423949.rpms-rpm-271f69d8896c@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 271f69d8896c54bc228d58c993ebbd151aa91e5f
Author : Panu Matilainen <pmatilai@fedoraproject.org>
Date : 2007-11-15T09:09:45+00:00
Stats : +92/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/271f69d8896c54bc228d58c993ebbd151aa91e5f?branch=pmatilai-v6
Log:
- Initialize NSS as early as possible (#382091)
---
diff --git a/rpm-4.4.2.2-cryptoinit.patch b/rpm-4.4.2.2-cryptoinit.patch
new file mode 100644
index 0000000..6cfea60
--- /dev/null
+++ b/rpm-4.4.2.2-cryptoinit.patch
@@ -0,0 +1,86 @@
+diff -up rpm-4.4.2.2/rpmio/digest.c.nss-init rpm-4.4.2.2/rpmio/digest.c
+--- rpm-4.4.2.2/rpmio/digest.c.nss-init 2007-11-15 10:57:04.000000000 +0200
++++ rpm-4.4.2.2/rpmio/digest.c 2007-11-15 10:57:04.000000000 +0200
+@@ -78,9 +78,6 @@ rpmDigestInit(pgpHashAlgo hashalgo, rpmD
+ HASH_HashType type;
+ DIGEST_CTX ctx = xcalloc(1, sizeof(*ctx));
+
+- if (NSS_NoDB_Init(NULL) != SECSuccess)
+- return NULL;
+-
+ ctx->flags = flags;
+
+ type = getHashType(hashalgo);
+diff -up rpm-4.4.2.2/rpmio/rpmpgp.h.nss-init rpm-4.4.2.2/rpmio/rpmpgp.h
+--- rpm-4.4.2.2/rpmio/rpmpgp.h.nss-init 2007-11-15 10:57:04.000000000 +0200
++++ rpm-4.4.2.2/rpmio/rpmpgp.h 2007-11-15 10:57:04.000000000 +0200
+@@ -1380,6 +1380,15 @@ unsigned int pgpCRC(const byte *octets,
+ }
+
+ /** \ingroup rpmio
++ * Perform cryptography initialization.
++ * It must be called before any cryptography can be used within rpm.
++ * It's not normally necessary to call it directly as it's called in
++ * general rpm initialization routines.
++ * @return 0 on success, -1 on failure
++ */
++int rpmInitCrypto(void);
++
++/** \ingroup rpmio
+ * Duplicate a digest context.
+ * @param octx existing digest context
+ * @return duplicated digest context
+diff -up rpm-4.4.2.2/rpmio/rpmpgp.c.nss-init rpm-4.4.2.2/rpmio/rpmpgp.c
+--- rpm-4.4.2.2/rpmio/rpmpgp.c.nss-init 2007-11-15 10:57:04.000000000 +0200
++++ rpm-4.4.2.2/rpmio/rpmpgp.c 2007-11-15 10:58:07.000000000 +0200
+@@ -17,6 +17,8 @@ static int _debug = 0;
+ /*@unchecked@*/
+ static int _print = 0;
+
++static int _crypto_initialized = 0;
++
+ /*@unchecked@*/ /*@null@*/
+ static pgpDig _dig = NULL;
+
+@@ -1094,7 +1096,6 @@ int pgpPrtPkt(const byte *pkt, unsigned
+ pgpDig pgpNewDig(void)
+ {
+ pgpDig dig = xcalloc(1, sizeof(*dig));
+- NSS_NoDB_Init(NULL);
+
+ return dig;
+ }
+@@ -1404,5 +1405,18 @@ char * pgpArmorWrap(int atype, const uns
+
+ return val;
+ }
+-
+ /*@=boundsread@*/
++
++int rpmInitCrypto(void) {
++ int rc = 0;
++
++ if (!_crypto_initialized && NSS_NoDB_Init(NULL) != SECSuccess) {
++ rc = -1;
++ } else {
++ _crypto_initialized = 1;
++ }
++
++ return rc;
++}
++
++
+diff -up rpm-4.4.2.2/lib/rpmrc.c.nss-init rpm-4.4.2.2/lib/rpmrc.c
+--- rpm-4.4.2.2/lib/rpmrc.c.nss-init 2007-09-11 09:28:15.000000000 +0300
++++ rpm-4.4.2.2/lib/rpmrc.c 2007-11-15 10:57:04.000000000 +0200
+@@ -1850,6 +1850,10 @@ static int rpmReadRC(/*@null@*/ const ch
+
+ int rpmReadConfigFiles(const char * file, const char * target)
+ {
++ /* Initialize crypto engine as early as possible */
++ if (rpmInitCrypto() < 0) {
++ return -1;
++ }
+
+ /* Preset target macros */
+ /*@-nullstate@*/ /* FIX: target can be NULL */
diff --git a/rpm.spec b/rpm.spec
index 70163d2..7e86869 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -6,7 +6,7 @@
Summary: The RPM package management system
Name: rpm
Version: 4.4.2.2
-Release: 9%{?dist}
+Release: 10%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source: http://rpm.org/releases/rpm-4.4.x/%{name}-%{version}.tar.gz
@@ -24,6 +24,7 @@ Patch11: rpm-4.4.2.2-pyproblem.patch
Patch12: rpm-4.4.2.2-problem-nevra.patch
Patch13: rpm-4.4.2.2-nss.patch
Patch14: rpm-4.4.2.2-base64-unsigned-char.patch
+Patch15: rpm-4.4.2.2-cryptoinit.patch
# XXX Beware, this is one murky license, partially GPL/LGPL dual-licensed
# and several different components with their own licenses included...
@@ -153,6 +154,7 @@ that will manipulate RPM packages and databases.
%patch12 -p1 -b .problem-nevra
%patch13 -p1 -b .nss
%patch14 -p1 -b .base64
+%patch15 -p1 -b .nss-init
# force external popt
rm -rf popt/
@@ -415,6 +417,9 @@ exit 0
%endif
%changelog
+* Thu Nov 15 2007 Panu Matilainen <pmatilai@redhat.com> 4.4.2.2-10
+- Initialize NSS as early as possible (#382091)
+
* Wed Nov 14 2007 Paul Nasrat <pauln@truemesh.com> 4.4.2.2-9
- Fix base64 assumption of signed char, from Tomas Mraz (#380911)
reply other threads:[~2026-11-23 9:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542588521.1.4605236856962423949.rpms-rpm-271f69d8896c@fedoraproject.org \
--to=pmatilai@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox