Bug 1028764, Remove some useless declarations, r=kaie
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 20 Oct 2014 22:21:55 +0200
changeset 11293 9f358fbaae22d8ca5db38fe3aecf720fac747f4f
parent 11292 34baf87d485dc01fc67ab5a8334cd7b55bce0f6e
child 11294 d63d3b5212becea34d3e58be40d00565638dc1fe
push id504
push userkaie@kuix.de
push dateMon, 20 Oct 2014 20:22:04 +0000
reviewerskaie
bugs1028764
Bug 1028764, Remove some useless declarations, r=kaie
cmd/rsaperf/rsaperf.c
lib/freebl/cts.c
lib/pk11wrap/pk11cert.c
lib/pk11wrap/pk11util.c
lib/softoken/legacydb/pcertdb.c
lib/ssl/ssl3con.c
--- a/cmd/rsaperf/rsaperf.c
+++ b/cmd/rsaperf/rsaperf.c
@@ -396,18 +396,16 @@ main(int argc, char **argv)
 
     if ((doPriv && doPub) || (doIters && doTime) ||
         ((useTokenKey + useSessionKey + useBLKey) != PR_TRUE) ||
         (useTokenKey && keybits) || (useTokenKey && doKeyGen) ||
         (keybits && (keybits<MIN_KEY_BITS || keybits>MAX_KEY_BITS))) {
         Usage(progName);
     }
 
-    if (!doPriv && !doPub) doPriv = PR_TRUE;
-
     if (doIters && doTime) Usage(progName);
 
     if (!doTime) {
         doIters = PR_TRUE;
     }
 
     PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
 
@@ -425,19 +423,17 @@ main(int argc, char **argv)
 	if (rv != SECSuccess) {
 	    fprintf(stderr, "NSS_NoDB_Init failed.\n");
 	    exit(1);
 	}
     }
 
     if (useTokenKey) {
         CK_OBJECT_HANDLE kh = CK_INVALID_HANDLE;
-        CERTCertDBHandle* certdb = NULL;
-	certdb = CERT_GetDefaultCertDB();
-        
+
         cert = PK11_FindCertFromNickname(nickname, &pwData);
         if (cert == NULL) {
             fprintf(stderr,
                     "Can't find certificate by name \"%s\"\n", nickname);
             exit(1);
         }
         pubHighKey = CERT_ExtractPublicKey(cert);
         if (pubHighKey == NULL) {
@@ -485,19 +481,17 @@ main(int argc, char **argv)
         void             * params;
 
         slot = PK11_FindSlotByName(slotname); /* locate target slot */
         if (!slot) {
             fprintf(stderr, "Can't find slot \"%s\"\n", slotname);
             exit(1);
         }
 
-        doKeyGen = PR_TRUE; /* Always do a keygen for session keys.
-                               Import of hardcoded key is not supported */
-        /* do a temporary keygen in selected slot */        
+        /* do a temporary keygen in selected slot */
         if (!keybits) {
             keybits = DEFAULT_KEY_BITS;
         }
 
         printf("Using PKCS#11 with %ld bits session key in token %s.\n",
                keybits, PK11_GetTokenName(slot));
 
         rsaparams.keySizeInBits = keybits;
--- a/lib/freebl/cts.c
+++ b/lib/freebl/cts.c
@@ -234,17 +234,16 @@ CTS_DecryptUpdate(CTSContext *cts, unsig
     }
     *outlen = fullblocks; /* AES low level doesn't set outlen */
     inbuf += fullblocks;
     inlen -= fullblocks;
     if (inlen == 0) {
 	return SECSuccess;
     }
     outbuf += fullblocks;
-    maxout -= fullblocks;
 
     /* recover the stolen text */
     PORT_Memset(lastBlock, 0, blocksize);
     PORT_Memcpy(lastBlock, inbuf, inlen);
     PORT_Memcpy(Cn_1, inbuf, inlen);
     Pn = outbuf-blocksize;
     /* inbuf points to Cn-1* in the input buffer */
     /* NOTE: below there are 2 sections marked "make up for the out of order
--- a/lib/pk11wrap/pk11cert.c
+++ b/lib/pk11wrap/pk11cert.c
@@ -2148,17 +2148,16 @@ PK11_FindCertFromDERCert(PK11SlotInfo *s
 
 CERTCertificate *
 PK11_FindCertFromDERCertItem(PK11SlotInfo *slot, const SECItem *inDerCert,
 								 void *wincx)
 
 {
     NSSDER derCert;
     NSSToken *tok;
-    NSSTrustDomain *td = STAN_GetDefaultTrustDomain();
     nssCryptokiObject *co = NULL;
     SECStatus rv;
 
     tok = PK11Slot_GetNSSToken(slot);
     NSSITEM_FROM_SECITEM(&derCert, inDerCert);
     rv = pk11_AuthenticateUnfriendly(slot, PR_TRUE, wincx);
     if (rv != SECSuccess) {
 	PK11_FreeSlot(slot);
--- a/lib/pk11wrap/pk11util.c
+++ b/lib/pk11wrap/pk11util.c
@@ -1180,17 +1180,17 @@ end_wait:
  * This function "wakes up" WaitForAnyTokenEvent. It's a pretty drastic
  * function, possibly bringing down the pkcs #11 module in question. This
  * should be OK because 1) it does reinitialize, and 2) it should only be
  * called when we are on our way to tear the whole system down anyway.
  */
 SECStatus
 SECMOD_CancelWait(SECMODModule *mod)
 {
-    unsigned long controlMask = mod->evControlMask;
+    unsigned long controlMask;
     SECStatus rv = SECSuccess;
     CK_RV crv;
 
     PZ_Lock(mod->refLock);
     mod->evControlMask |= SECMOD_END_WAIT;
     controlMask = mod->evControlMask;
     if (controlMask & SECMOD_WAIT_PKCS11_EVENT) {
         if (!pk11_getFinalizeModulesOption()) {
--- a/lib/softoken/legacydb/pcertdb.c
+++ b/lib/softoken/legacydb/pcertdb.c
@@ -4728,27 +4728,26 @@ nsslowcert_FindTrustByKey(NSSLOWCERTCert
  */
 NSSLOWCERTCertificate *
 nsslowcert_FindCertByIssuerAndSN(NSSLOWCERTCertDBHandle *handle, NSSLOWCERTIssuerAndSN *issuerAndSN)
 {
     SECItem certKey;
     SECItem *sn = &issuerAndSN->serialNumber;
     SECItem *issuer = &issuerAndSN->derIssuer;
     NSSLOWCERTCertificate *cert;
-    int data_left = sn->len-1;
     int data_len = sn->len;
     int index = 0;
 
     /* automatically detect DER encoded serial numbers and remove the der
      * encoding since the database expects unencoded data. 
      * if it's DER encoded, there must be at least 3 bytes, tag, len, data */
     if ((sn->len >= 3) && (sn->data[0] == 0x2)) {
 	/* remove the der encoding of the serial number before generating the
 	 * key.. */
-	data_left = sn->len-2;
+	int data_left = sn->len-2;
 	data_len = sn->data[1];
 	index = 2;
 
 	/* extended length ? (not very likely for a serial number) */
 	if (data_len & 0x80) {
 	    int len_count = data_len & 0x7f;
 
 	    data_len = 0;
@@ -4813,28 +4812,27 @@ NSSLOWCERTTrust *
 nsslowcert_FindTrustByIssuerAndSN(NSSLOWCERTCertDBHandle *handle, 
 					NSSLOWCERTIssuerAndSN *issuerAndSN)
 {
     SECItem certKey;
     SECItem *sn = &issuerAndSN->serialNumber;
     SECItem *issuer = &issuerAndSN->derIssuer;
     NSSLOWCERTTrust *trust;
     unsigned char keyBuf[512];
-    int data_left = sn->len-1;
     int data_len = sn->len;
     int index = 0;
     int len;
 
     /* automatically detect DER encoded serial numbers and remove the der
      * encoding since the database expects unencoded data. 
      * if it's DER encoded, there must be at least 3 bytes, tag, len, data */
     if ((sn->len >= 3) && (sn->data[0] == 0x2)) {
 	/* remove the der encoding of the serial number before generating the
 	 * key.. */
-	data_left = sn->len-2;
+	int data_left = sn->len-2;
 	data_len = sn->data[1];
 	index = 2;
 
 	/* extended length ? (not very likely for a serial number) */
 	if (data_len & 0x80) {
 	    int len_count = data_len & 0x7f;
 
 	    data_len = 0;
--- a/lib/ssl/ssl3con.c
+++ b/lib/ssl/ssl3con.c
@@ -5111,17 +5111,16 @@ ssl3_SendClientHello(sslSocket *ss, PRBo
 	PRUint32 maxBytes = 65535; /* 2^16 - 1 */
 	PRInt32  extLen;
 
 	extLen = ssl3_CallHelloExtensionSenders(ss, PR_FALSE, maxBytes, NULL);
 	if (extLen < 0) {
 	    if (sid->u.ssl3.lock) { PR_RWLock_Unlock(sid->u.ssl3.lock); }
 	    return SECFailure;
 	}
-	maxBytes        -= extLen;
 	total_exten_len += extLen;
 
 	if (total_exten_len > 0)
 	    total_exten_len += 2;
     }
 
 #ifndef NSS_DISABLE_ECC
     if (!total_exten_len || !isTLS) {