Back out 1eb6e4e4060f (bug 1296180) for Windows warning-as-error bustage
authorPhil Ringnalda <philringnalda@gmail.com>
Thu, 08 Sep 2016 23:30:12 -0700
changeset 354671 18f49d6c092dbab239c3db0749ae4dd23bade4f3
parent 354670 1eb6e4e4060f0f28bfe66714bdd1c14081888f71
child 354672 22edc38ba187a99bc0d14430809ad0a14a63edac
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1296180
milestone51.0a1
backs out1eb6e4e4060f0f28bfe66714bdd1c14081888f71
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out 1eb6e4e4060f (bug 1296180) for Windows warning-as-error bustage CLOSED TREE
dom/crypto/CryptoKey.cpp
dom/crypto/WebCryptoCommon.h
media/mtransport/transportlayerdtls.cpp
security/certverifier/ExtendedValidation.cpp
--- a/dom/crypto/CryptoKey.cpp
+++ b/dom/crypto/CryptoKey.cpp
@@ -1,23 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "CryptoKey.h"
-
+#include "pk11pub.h"
+#include "cryptohi.h"
+#include "nsNSSComponent.h"
 #include "ScopedNSSTypes.h"
-#include "cryptohi.h"
-#include "mozilla/ArrayUtils.h"
+#include "mozilla/dom/CryptoKey.h"
 #include "mozilla/dom/SubtleCryptoBinding.h"
 #include "mozilla/dom/ToJSValue.h"
-#include "nsNSSComponent.h"
-#include "pk11pub.h"
 
 // Templates taken from security/nss/lib/cryptohi/seckey.c
 // These would ideally be exported by NSS and until that
 // happens we have to keep our own copies.
 const SEC_ASN1Template SECKEY_DHPublicKeyTemplate[] = {
     { SEC_ASN1_INTEGER, offsetof(SECKEYPublicKey,u.dh.publicValue), },
     { 0, }
 };
@@ -358,17 +356,17 @@ CryptoKey::AddPublicKeyData(SECKEYPublic
     // PrivateKeyFromPrivateKeyTemplate sets the ID.
     { CKA_ID,               nullptr,              0 },
     { CKA_EC_PARAMS,        params->data,         params->len },
     { CKA_EC_POINT,         point->data,          point->len },
     { CKA_VALUE,            value->data,          value->len },
   };
 
   mPrivateKey = PrivateKeyFromPrivateKeyTemplate(keyTemplate,
-                                                 ArrayLength(keyTemplate));
+                                                 PR_ARRAY_SIZE(keyTemplate));
   NS_ENSURE_TRUE(mPrivateKey, NS_ERROR_DOM_OPERATION_ERR);
 
   return NS_OK;
 }
 
 void
 CryptoKey::ClearUsages()
 {
@@ -794,17 +792,17 @@ CryptoKey::PrivateKeyFromJwk(const JsonW
       // PrivateKeyFromPrivateKeyTemplate sets the ID.
       { CKA_ID,               nullptr,              0 },
       { CKA_EC_PARAMS,        params->data,         params->len },
       { CKA_EC_POINT,         ecPoint->data,        ecPoint->len },
       { CKA_VALUE,            (void*) d.Elements(), (CK_ULONG) d.Length() },
     };
 
     return PrivateKeyFromPrivateKeyTemplate(keyTemplate,
-                                            ArrayLength(keyTemplate));
+                                            PR_ARRAY_SIZE(keyTemplate));
   }
 
   if (aJwk.mKty.EqualsLiteral(JWK_TYPE_RSA)) {
     // Verify that all of the required parameters are present
     CryptoBuffer n, e, d, p, q, dp, dq, qi;
     if (!aJwk.mN.WasPassed() || NS_FAILED(n.FromJwkBase64(aJwk.mN.Value())) ||
         !aJwk.mE.WasPassed() || NS_FAILED(e.FromJwkBase64(aJwk.mE.Value())) ||
         !aJwk.mD.WasPassed() || NS_FAILED(d.FromJwkBase64(aJwk.mD.Value())) ||
@@ -837,17 +835,17 @@ CryptoKey::PrivateKeyFromJwk(const JsonW
       { CKA_PRIME_1,          (void*) p.Elements(),  (CK_ULONG) p.Length() },
       { CKA_PRIME_2,          (void*) q.Elements(),  (CK_ULONG) q.Length() },
       { CKA_EXPONENT_1,       (void*) dp.Elements(), (CK_ULONG) dp.Length() },
       { CKA_EXPONENT_2,       (void*) dq.Elements(), (CK_ULONG) dq.Length() },
       { CKA_COEFFICIENT,      (void*) qi.Elements(), (CK_ULONG) qi.Length() },
     };
 
     return PrivateKeyFromPrivateKeyTemplate(keyTemplate,
-                                            ArrayLength(keyTemplate));
+                                            PR_ARRAY_SIZE(keyTemplate));
   }
 
   return nullptr;
 }
 
 bool ReadAndEncodeAttribute(SECKEYPrivateKey* aKey,
                             CK_ATTRIBUTE_TYPE aAttribute,
                             Optional<nsString>& aDst)
--- a/dom/crypto/WebCryptoCommon.h
+++ b/dom/crypto/WebCryptoCommon.h
@@ -2,22 +2,21 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_WebCryptoCommon_h
 #define mozilla_dom_WebCryptoCommon_h
 
-#include "js/StructuredClone.h"
-#include "mozilla/ArrayUtils.h"
+#include "pk11pub.h"
+#include "nsString.h"
+#include "nsContentUtils.h"
 #include "mozilla/dom/CryptoBuffer.h"
-#include "nsContentUtils.h"
-#include "nsString.h"
-#include "pk11pub.h"
+#include "js/StructuredClone.h"
 
 // WebCrypto algorithm names
 #define WEBCRYPTO_ALG_AES_CBC       "AES-CBC"
 #define WEBCRYPTO_ALG_AES_CTR       "AES-CTR"
 #define WEBCRYPTO_ALG_AES_GCM       "AES-GCM"
 #define WEBCRYPTO_ALG_AES_KW        "AES-KW"
 #define WEBCRYPTO_ALG_SHA1          "SHA-1"
 #define WEBCRYPTO_ALG_SHA256        "SHA-256"
@@ -102,25 +101,25 @@
 #define JWK_USE_SIG                 "sig"
 
 // Define an unknown mechanism type
 #define UNKNOWN_CK_MECHANISM        CKM_VENDOR_DEFINED+1
 
 // python security/pkix/tools/DottedOIDToCode.py id-ecDH 1.3.132.112
 static const uint8_t id_ecDH[] = { 0x2b, 0x81, 0x04, 0x70 };
 const SECItem SEC_OID_DATA_EC_DH = { siBuffer, (unsigned char*)id_ecDH,
-                                     mozilla::ArrayLength(id_ecDH) };
+                                     PR_ARRAY_SIZE(id_ecDH) };
 
 // python security/pkix/tools/DottedOIDToCode.py dhKeyAgreement 1.2.840.113549.1.3.1
 static const uint8_t dhKeyAgreement[] = {
   0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x03, 0x01
 };
 const SECItem SEC_OID_DATA_DH_KEY_AGREEMENT = { siBuffer,
                                                 (unsigned char*)dhKeyAgreement,
-                                                mozilla::ArrayLength(dhKeyAgreement) };
+                                                PR_ARRAY_SIZE(dhKeyAgreement) };
 
 namespace mozilla {
 namespace dom {
 
 // Helper functions for structured cloning
 inline bool
 ReadString(JSStructuredCloneReader* aReader, nsString& aString)
 {
--- a/media/mtransport/transportlayerdtls.cpp
+++ b/media/mtransport/transportlayerdtls.cpp
@@ -1,37 +1,38 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Original author: ekr@rtfm.com
 
-#include "transportlayerdtls.h"
-
+#include <queue>
 #include <algorithm>
-#include <queue>
 #include <sstream>
 
-#include "dtlsidentity.h"
-#include "keyhi.h"
+#include "mozilla/UniquePtr.h"
+
 #include "logging.h"
-#include "mozilla/UniquePtr.h"
+#include "ssl.h"
+#include "sslerr.h"
+#include "sslproto.h"
+#include "keyhi.h"
+
 #include "nsCOMPtr.h"
 #include "nsComponentManagerUtils.h"
-#include "nsComponentManagerUtils.h"
 #include "nsIEventTarget.h"
 #include "nsNetCID.h"
+#include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
-#include "ssl.h"
-#include "sslerr.h"
-#include "sslproto.h"
+
+#include "dtlsidentity.h"
 #include "transportflow.h"
-
+#include "transportlayerdtls.h"
 
 namespace mozilla {
 
 MOZ_MTLOG_MODULE("mtransport")
 
 static PRDescIdentity transport_layer_identity = PR_INVALID_IO_LAYER;
 
 // TODO: Implement a mode for this where
@@ -733,41 +734,41 @@ bool TransportLayerDtls::SetupCipherSuit
     rv = SSL_SetSRTPCiphers(ssl_fd, &srtp_ciphers_[0], srtp_ciphers_.size());
 
     if (rv != SECSuccess) {
       MOZ_MTLOG(ML_ERROR, "Couldn't set SRTP cipher suite");
       return false;
     }
   }
 
-  for (const auto& cipher : EnabledCiphers) {
-    MOZ_MTLOG(ML_DEBUG, LAYER_INFO << "Enabling: " << cipher);
-    rv = SSL_CipherPrefSet(ssl_fd, cipher, PR_TRUE);
+  for (size_t i = 0; i < PR_ARRAY_SIZE(EnabledCiphers); ++i) {
+    MOZ_MTLOG(ML_DEBUG, LAYER_INFO << "Enabling: " << EnabledCiphers[i]);
+    rv = SSL_CipherPrefSet(ssl_fd, EnabledCiphers[i], PR_TRUE);
     if (rv != SECSuccess) {
       MOZ_MTLOG(ML_ERROR, LAYER_INFO <<
-                "Unable to enable suite: " << cipher);
+                "Unable to enable suite: " << EnabledCiphers[i]);
       return false;
     }
   }
 
-  for (const auto& cipher : DisabledCiphers) {
-    MOZ_MTLOG(ML_DEBUG, LAYER_INFO << "Disabling: " << cipher);
+  for (size_t i = 0; i < PR_ARRAY_SIZE(DisabledCiphers); ++i) {
+    MOZ_MTLOG(ML_DEBUG, LAYER_INFO << "Disabling: " << DisabledCiphers[i]);
 
     PRBool enabled = false;
-    rv = SSL_CipherPrefGet(ssl_fd, cipher, &enabled);
+    rv = SSL_CipherPrefGet(ssl_fd, DisabledCiphers[i], &enabled);
     if (rv != SECSuccess) {
       MOZ_MTLOG(ML_NOTICE, LAYER_INFO <<
-                "Unable to check if suite is enabled: " << cipher);
+                "Unable to check if suite is enabled: " << DisabledCiphers[i]);
       return false;
     }
     if (enabled) {
-      rv = SSL_CipherPrefSet(ssl_fd, cipher, PR_FALSE);
+      rv = SSL_CipherPrefSet(ssl_fd, DisabledCiphers[i], PR_FALSE);
       if (rv != SECSuccess) {
         MOZ_MTLOG(ML_NOTICE, LAYER_INFO <<
-                  "Unable to disable suite: " << cipher);
+                  "Unable to disable suite: " << DisabledCiphers[i]);
         return false;
       }
     }
   }
 
   return true;
 }
 
--- a/security/certverifier/ExtendedValidation.cpp
+++ b/security/certverifier/ExtendedValidation.cpp
@@ -1,26 +1,25 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ExtendedValidation.h"
 
-#include "base64.h"
 #include "cert.h"
 #include "certdb.h"
+#include "base64.h"
 #include "hasht.h"
-#include "mozilla/ArrayUtils.h"
+#include "pkix/pkixtypes.h"
 #include "pk11pub.h"
-#include "pkix/pkixtypes.h"
+#include "secerr.h"
 #include "prerror.h"
 #include "prinit.h"
-#include "secerr.h"
 
 extern mozilla::LazyLogModule gPIPNSSLog;
 
 #define CONST_OID static const unsigned char
 #define OI(x) { siDEROID, (unsigned char*) x, sizeof x }
 
 struct nsMyTrustedEVInfo
 {
@@ -1269,17 +1268,18 @@ RegisterOID(const SECItem& oidItem, cons
   od.mechanism = CKM_INVALID_MECHANISM;
   od.supportedExtension = INVALID_CERT_EXTENSION;
   return SECOID_AddEntry(&od);
 }
 
 static bool
 isEVPolicy(SECOidTag policyOIDTag)
 {
-  for (const nsMyTrustedEVInfo& entry : myTrustedEVInfos) {
+  for (size_t iEV = 0; iEV < PR_ARRAY_SIZE(myTrustedEVInfos); ++iEV) {
+    nsMyTrustedEVInfo& entry = myTrustedEVInfos[iEV];
     if (policyOIDTag == entry.oid_tag) {
       return true;
     }
   }
 
   return false;
 }
 
@@ -1289,33 +1289,34 @@ bool
 CertIsAuthoritativeForEVPolicy(const UniqueCERTCertificate& cert,
                                const mozilla::pkix::CertPolicyId& policy)
 {
   PR_ASSERT(cert);
   if (!cert) {
     return false;
   }
 
-  for (const nsMyTrustedEVInfo& entry : myTrustedEVInfos) {
+  for (size_t iEV = 0; iEV < PR_ARRAY_SIZE(myTrustedEVInfos); ++iEV) {
+    nsMyTrustedEVInfo& entry = myTrustedEVInfos[iEV];
     if (entry.cert && CERT_CompareCerts(cert.get(), entry.cert.get())) {
       const SECOidData* oidData = SECOID_FindOIDByTag(entry.oid_tag);
       if (oidData && oidData->oid.len == policy.numBytes &&
           !memcmp(oidData->oid.data, policy.bytes, policy.numBytes)) {
         return true;
       }
     }
   }
 
   return false;
 }
 
 static PRStatus
 IdentityInfoInit()
 {
-  for (size_t iEV = 0; iEV < mozilla::ArrayLength(myTrustedEVInfos); ++iEV) {
+  for (size_t iEV = 0; iEV < PR_ARRAY_SIZE(myTrustedEVInfos); ++iEV) {
     nsMyTrustedEVInfo& entry = myTrustedEVInfos[iEV];
 
     mozilla::ScopedAutoSECItem derIssuer;
     SECStatus rv = ATOB_ConvertAsciiToItem(&derIssuer, entry.issuer_base64);
     PR_ASSERT(rv == SECSuccess);
     if (rv != SECSuccess) {
       return PR_FAILURE;
     }
@@ -1394,17 +1395,18 @@ void
 EnsureIdentityInfoLoaded()
 {
   (void) PR_CallOnce(&sIdentityInfoCallOnce, IdentityInfoInit);
 }
 
 void
 CleanupIdentityInfo()
 {
-  for (nsMyTrustedEVInfo& entry : myTrustedEVInfos) {
+  for (size_t iEV = 0; iEV < PR_ARRAY_SIZE(myTrustedEVInfos); ++iEV) {
+    nsMyTrustedEVInfo &entry = myTrustedEVInfos[iEV];
     entry.cert = nullptr;
   }
 
   memset(&sIdentityInfoCallOnce, 0, sizeof(PRCallOnceType));
 }
 
 // Find the first policy OID that is known to be an EV policy OID.
 SECStatus