commit:     80c468f75c9354c33ac3d739dd5c748ef6ba6070
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 19 19:45:00 2025 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Tue Aug 19 19:45:00 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80c468f7

dev-libs/nss: add updated upstream lto patch to 3.115

Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 ...9-align-sftkdb_known_attributes_size-type.patch | 78 +++++++++++++++-------
 .../nss/{nss-3.115.ebuild => nss-3.115-r1.ebuild}  |  0
 2 files changed, 54 insertions(+), 24 deletions(-)

diff --git 
a/dev-libs/nss/files/nss-3.115-bmo-1983399-align-sftkdb_known_attributes_size-type.patch
 
b/dev-libs/nss/files/nss-3.115-bmo-1983399-align-sftkdb_known_attributes_size-type.patch
index 958599927e91..2254ec095f68 100644
--- 
a/dev-libs/nss/files/nss-3.115-bmo-1983399-align-sftkdb_known_attributes_size-type.patch
+++ 
b/dev-libs/nss/files/nss-3.115-bmo-1983399-align-sftkdb_known_attributes_size-type.patch
@@ -1,28 +1,9 @@
-From 66f55acef3b683134970300ab4c4dfee578a4a3b Mon Sep 17 00:00:00 2001
-From: Nicholas Vinson <[email protected]>
-Date: Sun, 17 Aug 2025 00:26:37 -0400
-Subject: [PATCH] lib/softtoken/{sdb.c,sftkdbti.h}: Align
- sftkdb_known_attributes_size type
-
-sftkdb_known_attributes_size is defined with conflicting types. In
-/lib/softtoken/sdb.c it is defined as a 'const size_t'; whereas in
-lib/softtoken/sftkdbti.h it is defined as an 'unsigned int'. The correct
-type for sftkdb_known_attributes_size is size_t since its value is
-derived from the size of the sftkdb_known_attributes array.
-
-Fixes: 1983399
-
-Signed-off-by: Nicholas Vinson <[email protected]>
----
- lib/softoken/sdb.c      | 2 +-
- lib/softoken/sftkdbti.h | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
 diff --git a/lib/softoken/sdb.c b/lib/softoken/sdb.c
-index 8b5ce70e30..022164a1f4 100644
 --- a/lib/softoken/sdb.c
 +++ b/lib/softoken/sdb.c
-@@ -158,7 +158,7 @@ const CK_ATTRIBUTE_TYPE sftkdb_known_attributes[] = {
+@@ -156,11 +156,11 @@
+     CKA_NSS_TRUST_STEP_UP_APPROVED, CKA_NSS_CERT_SHA1_HASH,
+     CKA_NSS_CERT_MD5_HASH, CKA_NSS_DB,
  };
  // clang-format on
  
@@ -31,11 +12,57 @@ index 8b5ce70e30..022164a1f4 100644
  
  /*
   * Note on use of sqlReadDB: Only one thread at a time may have an actual
+  * operation going on given sqlite3 * database. An operation is defined as
+  * the time from a sqlite3_prepare() until the sqlite3_finalize().
+@@ -2022,12 +2022,12 @@
+         sqlite3_finalize(stmt);
+         return CKR_OK;
+     }
+     /* we have more attributes than in the database, so we know things
+      * are missing, find what was missing */
+-    for (int i = 0; i < sftkdb_known_attributes_size; i++) {
+-        char *typeString = sqlite3_mprintf("a%x", sftkdb_known_attributes[i]);
++    for (size_t i = 0; i < sftkdb_known_attributes_size; i++) {
++        char *typeString = sqlite3_mprintf("a%lx", 
sftkdb_known_attributes[i]);
+         PRBool found = PR_FALSE;
+         /* this one index is important, we skip the first column (id), since
+          * it will never match, starting at zero isn't a bug,
+          * just inefficient */
+         for (int j = 1; j < columnCount; j++) {
+@@ -2070,11 +2070,10 @@
+ 
+ CK_RV
+ sdb_init(char *dbname, char *table, sdbDataType type, int *inUpdate,
+          int *newInit, int inFlags, PRUint32 accessOps, SDB **pSdb)
+ {
+-    int i;
+     char *initStr = NULL;
+     char *newStr;
+     char *queryStr = NULL;
+     int inTransaction = 0;
+     SDB *sdb = NULL;
+@@ -2134,12 +2133,13 @@
+         if (flags != SDB_CREATE) {
+             error = sdb_mapSQLError(type, SQLITE_CANTOPEN);
+             goto loser;
+         }
+         initStr = sqlite3_mprintf("");
+-        for (i = 0; initStr && i < sftkdb_known_attributes_size; i++) {
+-            newStr = sqlite3_mprintf("%s, a%x", initStr, 
sftkdb_known_attributes[i]);
++        for (size_t i = 0; initStr && i < sftkdb_known_attributes_size; i++) {
++            newStr = sqlite3_mprintf("%s, a%lx", initStr,
++                                     sftkdb_known_attributes[i]);
+             sqlite3_free(initStr);
+             initStr = newStr;
+         }
+         if (initStr == NULL) {
+             error = CKR_HOST_MEMORY;
 diff --git a/lib/softoken/sftkdbti.h b/lib/softoken/sftkdbti.h
-index c08334919d..7dfbdabf1c 100644
 --- a/lib/softoken/sftkdbti.h
 +++ b/lib/softoken/sftkdbti.h
-@@ -27,7 +27,7 @@ struct SFTKDBHandleStr {
+@@ -25,11 +25,11 @@
+     PRBool updateDBIsInit;
+     PRBool usesLegacyStorage;
  };
  
  extern const CK_ATTRIBUTE_TYPE sftkdb_known_attributes[];
@@ -44,3 +71,6 @@ index c08334919d..7dfbdabf1c 100644
  
  #define SFTK_KEYDB_TYPE 0x40000000
  #define SFTK_CERTDB_TYPE 0x00000000
+ #define SFTK_OBJ_TYPE_MASK 0xc0000000
+ #define SFTK_OBJ_ID_MASK (~SFTK_OBJ_TYPE_MASK)
+

diff --git a/dev-libs/nss/nss-3.115.ebuild b/dev-libs/nss/nss-3.115-r1.ebuild
similarity index 100%
rename from dev-libs/nss/nss-3.115.ebuild
rename to dev-libs/nss/nss-3.115-r1.ebuild

Reply via email to