[nss-softokn] Remove duplicate function definitions and a defined but unused static function

Elio Maldonado emaldonado at fedoraproject.org
Thu Mar 1 22:01:13 UTC 2012


commit 7af990c75b38e3bce0de9684c3427072b7af61d9
Author: Elio Maldonado Batiz <emaldona at redhat.com>
Date:   Thu Mar 1 14:00:19 2012 -0800

    Remove duplicate function definitions and a defined but unused static function

 softoken-minimal-test-dependencies.patch |  130 ++++++++++++++----------------
 1 files changed, 61 insertions(+), 69 deletions(-)
---
diff --git a/softoken-minimal-test-dependencies.patch b/softoken-minimal-test-dependencies.patch
index b03cadf..01c439b 100644
--- a/softoken-minimal-test-dependencies.patch
+++ b/softoken-minimal-test-dependencies.patch
@@ -1,6 +1,6 @@
 diff -up ./mozilla/security/nss/cmd/lib/manifest.mn.crypto ./mozilla/security/nss/cmd/lib/manifest.mn
 --- ./mozilla/security/nss/cmd/lib/manifest.mn.crypto	2011-09-16 12:16:50.000000000 -0700
-+++ ./mozilla/security/nss/cmd/lib/manifest.mn	2012-03-01 13:22:52.801116867 -0800
++++ ./mozilla/security/nss/cmd/lib/manifest.mn	2012-03-01 13:52:51.826116574 -0800
 @@ -48,11 +48,6 @@ PRIVATE_EXPORTS	= secutil.h \
  		  $(NULL)
  
@@ -15,7 +15,7 @@ diff -up ./mozilla/security/nss/cmd/lib/manifest.mn.crypto ./mozilla/security/ns
  
 diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/cmd/lib/secutil.c
 --- ./mozilla/security/nss/cmd/lib/secutil.c.crypto	2011-11-16 11:12:30.000000000 -0800
-+++ ./mozilla/security/nss/cmd/lib/secutil.c	2012-03-01 13:39:07.618241181 -0800
++++ ./mozilla/security/nss/cmd/lib/secutil.c	2012-03-01 13:58:46.550116160 -0800
 @@ -48,10 +48,7 @@
  #include "prenv.h"
  #include "prnetdb.h"
@@ -76,10 +76,19 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  
      va_start(args, msg);
  
-@@ -151,437 +127,6 @@ secu_ClearPassword(char *p)
-     }
+@@ -142,446 +118,6 @@ SECU_PrintSystemError(char *progName, ch
+     va_end(args);
  }
  
+-static void
+-secu_ClearPassword(char *p)
+-{
+-    if (p) {
+-	PORT_Memset(p, 0, PORT_Strlen(p));
+-	PORT_Free(p);
+-    }
+-}
+-
 -char *
 -SECU_GetPasswordString(void *arg, char *prompt)
 -{
@@ -514,7 +523,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  SECStatus
  secu_StdinToItem(SECItem *dst)
  {
-@@ -703,65 +248,6 @@ loser:
+@@ -703,65 +239,6 @@ loser:
      return SECFailure;
  }
  
@@ -580,7 +589,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  #define INDENT_MULT	4
  void
  SECU_Indent(FILE *out, int level)
-@@ -914,23 +400,6 @@ SECU_PrintBuf(FILE *out, const char *msg
+@@ -914,23 +391,6 @@ SECU_PrintBuf(FILE *out, const char *msg
      }
  }
  
@@ -604,7 +613,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  
  /* This expents i->data[0] to be the MSB of the integer.
  ** if you want to print a DER-encoded integer (with the tag and length)
-@@ -975,2427 +444,126 @@ SECU_PrintInteger(FILE *out, SECItem *i,
+@@ -975,2427 +435,100 @@ SECU_PrintInteger(FILE *out, SECItem *i,
  }
  
  static void
@@ -714,62 +723,53 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -    timeString = PORT_Alloc(256);
 -    if (timeString == NULL)
 -	return;
-+	char target = a[i].flag;
-+	int j;
- 
+-
 -    if (m != NULL) {
 -	SECU_Indent(out, level);
 -	fprintf(out, "%s: ", m);
 -    }
-+	/* duplicate '\0' flags are okay, they are used with long forms */
-+	for (j = i+1; j < count; j++) {
-+		if (a[j].flag && a[j].flag == target) {
-+			return PR_TRUE;
-+		}
-+	}
-+	return PR_FALSE;
-+}
-+#endif /* defined(DEBUG) || defined(FORCE_PR_ASSERT) */
- 
+-
 -    if (PR_FormatTime(timeString, 256, "%a %b %d %H:%M:%S %Y", &printableTime)) {
 -        fputs(timeString, out);
 -    }
-+/* Returns true iff a[i].longform has a duplicate in a[i+1 : count-1] */
-+static PRBool HasLongDuplicate(int i, secuCommandFlag *a, int count)
-+{
-+	int j;
-+	char *target = a[i].longform;
- 
+-
 -    if (m != NULL)
 -	fprintf(out, "\n");
-+	if (!target)
-+		return PR_FALSE;
++	char target = a[i].flag;
++	int j;
  
 -    PORT_Free(timeString);
++	/* duplicate '\0' flags are okay, they are used with long forms */
 +	for (j = i+1; j < count; j++) {
-+		if (a[j].longform && strcmp(a[j].longform, target) == 0) {
++		if (a[j].flag && a[j].flag == target) {
 +			return PR_TRUE;
 +		}
 +	}
 +	return PR_FALSE;
  }
++#endif /* defined(DEBUG) || defined(FORCE_PR_ASSERT) */
  
 -/*
 - * Format and print the UTC Time "t".  If the tag message "m" is not NULL,
 - * do indent formatting based on "level" and add a newline afterward;
 - * otherwise just print the formatted time string only.
-+/* Returns true iff a has no short or long form duplicates
-  */
+- */
 -void
 -SECU_PrintUTCTime(FILE *out, SECItem *t, char *m, int level)
--{
++/* Returns true iff a[i].longform has a duplicate in a[i+1 : count-1] */
++static PRBool HasLongDuplicate(int i, secuCommandFlag *a, int count)
+ {
 -    int64 time;
 -    SECStatus rv;
++	int j;
++	char *target = a[i].longform;
  
 -    rv = DER_UTCTimeToTime(&time, t);
 -    if (rv != SECSuccess)
 -	return;
--
++	if (!target)
++		return PR_FALSE;
+ 
 -    secu_PrintTime(out, time, m, level);
 -}
 -
@@ -2801,7 +2801,11 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -	while ((sigInfo = src->signerInfos[iv++]) != NULL) {
 -	    sprintf(om, "Signer Information (%x)", iv);
 -	    secu_PrintSignerInfo(out, sigInfo, om, level + 2);
--	}
++	for (j = i+1; j < count; j++) {
++		if (a[j].longform && strcmp(a[j].longform, target) == 0) {
++			return PR_TRUE;
++		}
+ 	}
 -    }  
 -
 -    return 0;
@@ -2836,27 +2840,28 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -** secu_PrintPKCS7Encrypted
 -**   Pretty print a PKCS7 encrypted data type (up to version 1).
 -*/
- static void
+-static void
 -secu_PrintPKCS7Encrypted(FILE *out, SEC_PKCS7EncryptedData *src,
 -			 const char *m, int level)
-+secu_PrintRSAPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
- {
+-{
 -    SECU_Indent(out, level); fprintf(out, "%s:\n", m);
 -    SECU_PrintInteger(out, &(src->version), "Version", level + 1);
- 
+-
 -    secu_PrintPKCS7EncContent(out, &src->encContentInfo, 
 -			      "Encrypted Content Information", level + 1);
--}
--
++	return PR_FALSE;
+ }
+ 
 -/*
 -** secu_PrintPKCS7Digested
 -**   Pretty print a PKCS7 digested data type (up to version 1).
 -*/
--static void
++#ifdef NSS_ENABLE_ECC
+ static void
 -secu_PrintPKCS7Digested(FILE *out, SEC_PKCS7DigestedData *src,
 -			const char *m, int level)
 -{
-     SECU_Indent(out, level); fprintf(out, "%s:\n", m);
+-    SECU_Indent(out, level); fprintf(out, "%s:\n", m);
 -    SECU_PrintInteger(out, &(src->version), "Version", level + 1);
 -    
 -    SECU_PrintAlgorithmID(out, &src->digestAlg, "Digest Algorithm",
@@ -2987,20 +2992,13 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -    }
 -    if ( flags & CERTDB_GOVT_APPROVED_CA ) {
 -	SECU_Indent(out, level); fprintf(out, "Step-up\n");
-+    SECU_PrintInteger(out, &pk->u.rsa.modulus, "Modulus", level+1);
-+    SECU_PrintInteger(out, &pk->u.rsa.publicExponent, "Exponent", level+1);
-+    if (pk->u.rsa.publicExponent.len == 1 &&
-+        pk->u.rsa.publicExponent.data[0] == 1) {
-+	SECU_Indent(out, level +1); fprintf(out, "Error: INVALID RSA KEY!\n");
-     }
- }
- 
+-    }
+-}
+-
 -void
 -SECU_PrintTrustFlags(FILE *out, CERTCertTrust *trust, char *m, int level)
-+static void
-+secu_PrintDSAPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
- {
-     SECU_Indent(out, level); fprintf(out, "%s:\n", m);
+-{
+-    SECU_Indent(out, level); fprintf(out, "%s:\n", m);
 -    SECU_Indent(out, level+1); fprintf(out, "SSL Flags:\n");
 -    printFlags(out, trust->sslFlags, level+2);
 -    SECU_Indent(out, level+1); fprintf(out, "Email Flags:\n");
@@ -3030,16 +3028,10 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -loser:
 -    PORT_FreeArena(arena, PR_FALSE);
 -    return rv;
-+    SECU_PrintInteger(out, &pk->u.dsa.params.prime, "Prime", level+1);
-+    SECU_PrintInteger(out, &pk->u.dsa.params.subPrime, "Subprime", level+1);
-+    SECU_PrintInteger(out, &pk->u.dsa.params.base, "Base", level+1);
-+    SECU_PrintInteger(out, &pk->u.dsa.publicValue, "PublicValue", level+1);
- }
- 
+-}
+-
 -int SECU_PrintSignedData(FILE *out, SECItem *der, const char *m,
 -			   int level, SECU_PPFunc inner)
-+#ifdef NSS_ENABLE_ECC
-+static void
 +secu_PrintECPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
  {
 -    PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
@@ -3114,7 +3106,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  
  #if defined(DEBUG) || defined(FORCE_PR_ASSERT)
  /* Returns true iff a[i].flag has a duplicate in a[i+1 : count-1]  */
-@@ -3610,145 +778,6 @@ SECU_PrintPRandOSError(char *progName) 
+@@ -3610,145 +743,6 @@ SECU_PrintPRandOSError(char *progName) 
      }
  }
  
@@ -3260,7 +3252,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  SECOidTag 
  SECU_StringToSignatureAlgTag(const char *alg)
  {
-@@ -3776,299 +805,6 @@ SECU_StringToSignatureAlgTag(const char 
+@@ -3776,299 +770,6 @@ SECU_StringToSignatureAlgTag(const char 
      return hashAlgTag;
  }
  
@@ -3560,7 +3552,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
  /* Caller ensures that dst is at least item->len*2+1 bytes long */
  void
  SECU_SECItemToHex(const SECItem * item, char * dst)
-@@ -4131,40 +867,3 @@ SECU_SECItemHexStringToBinary(SECItem* s
+@@ -4131,40 +832,3 @@ SECU_SECItemHexStringToBinary(SECItem* s
      srcdest->len /= 2;
      return SECSuccess;
  }
@@ -3603,7 +3595,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.c.crypto ./mozilla/security/nss/
 -
 diff -up ./mozilla/security/nss/cmd/lib/secutil.h.crypto ./mozilla/security/nss/cmd/lib/secutil.h
 --- ./mozilla/security/nss/cmd/lib/secutil.h.crypto	2011-11-16 11:12:30.000000000 -0800
-+++ ./mozilla/security/nss/cmd/lib/secutil.h	2012-03-01 13:43:17.979116817 -0800
++++ ./mozilla/security/nss/cmd/lib/secutil.h	2012-03-01 13:52:51.842116753 -0800
 @@ -38,7 +38,10 @@
  
  #include "seccomon.h"
@@ -3971,7 +3963,7 @@ diff -up ./mozilla/security/nss/cmd/lib/secutil.h.crypto ./mozilla/security/nss/
  SECU_SECItemToHex(const SECItem * item, char * dst);
 diff -up ./mozilla/security/nss/cmd/manifest.mn.crypto ./mozilla/security/nss/cmd/manifest.mn
 --- ./mozilla/security/nss/cmd/manifest.mn.crypto	2010-12-06 09:22:48.000000000 -0800
-+++ ./mozilla/security/nss/cmd/manifest.mn	2012-03-01 13:22:52.805116456 -0800
++++ ./mozilla/security/nss/cmd/manifest.mn	2012-03-01 13:52:51.842116753 -0800
 @@ -41,46 +41,9 @@ DEPTH	= ../..
  REQUIRES = nss nspr libdbm
  
@@ -4021,7 +4013,7 @@ diff -up ./mozilla/security/nss/cmd/manifest.mn.crypto ./mozilla/security/nss/cm
  TEMPORARILY_DONT_BUILD = \
 diff -up ./mozilla/security/nss/cmd/platlibs.mk.crypto ./mozilla/security/nss/cmd/platlibs.mk
 --- ./mozilla/security/nss/cmd/platlibs.mk.crypto	2010-06-11 17:58:33.000000000 -0700
-+++ ./mozilla/security/nss/cmd/platlibs.mk	2012-03-01 13:22:52.806116691 -0800
++++ ./mozilla/security/nss/cmd/platlibs.mk	2012-03-01 13:52:51.846127126 -0800
 @@ -92,43 +92,13 @@ DEFINES += -DNSS_USE_STATIC_LIBS
  # $(PROGRAM) has explicit dependencies on $(EXTRA_LIBS)
  CRYPTOLIB=$(SOFTOKEN_LIB_DIR)/$(LIB_PREFIX)freebl.$(LIB_SUFFIX)
@@ -4117,7 +4109,7 @@ diff -up ./mozilla/security/nss/cmd/platlibs.mk.crypto ./mozilla/security/nss/cm
  	-lnssutil3 \
 diff -up ./mozilla/security/nss/tests/all.sh.crypto ./mozilla/security/nss/tests/all.sh
 --- ./mozilla/security/nss/tests/all.sh.crypto	2010-01-29 11:58:40.000000000 -0800
-+++ ./mozilla/security/nss/tests/all.sh	2012-03-01 13:22:52.807116712 -0800
++++ ./mozilla/security/nss/tests/all.sh	2012-03-01 13:52:51.849115992 -0800
 @@ -303,10 +303,10 @@ run_cycles()
  
  ############################## main code ###############################


More information about the scm-commits mailing list