Backed out changeset 5059d47bd423 (bug 1548398) for GCC 4.8 failures in gcm.h
authorJ.C. Jones <jjones@mozilla.com>
Thu, 02 May 2019 16:47:01 -0700
changeset 15096 b58dacc4dbcc723a2916835c4f070e22d5324884
parent 15095 5059d47bd423e4b7e4dd18af7cbc8c47f218f4ad
child 15097 cde36bed1cc453d4b4c18a5f4baf7bbff5da251b
push id3337
push userjjones@mozilla.com
push dateFri, 03 May 2019 00:00:03 +0000
bugs1548398
backs out5059d47bd423e4b7e4dd18af7cbc8c47f218f4ad
Backed out changeset 5059d47bd423 (bug 1548398) for GCC 4.8 failures in gcm.h
gtests/freebl_gtest/mpi_unittest.cc
gtests/freebl_gtest/rsa_unittest.cc
nss.gyp
--- a/gtests/freebl_gtest/mpi_unittest.cc
+++ b/gtests/freebl_gtest/mpi_unittest.cc
@@ -1,17 +1,16 @@
 // 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 "gtest/gtest.h"
 
 #include <stdint.h>
 #include <string.h>
-#include <memory>
 
 #ifdef __MACH__
 #include <mach/clock.h>
 #include <mach/mach.h>
 #endif
 
 #include "mpi.h"
 namespace nss_test {
@@ -23,17 +22,17 @@ void gettime(struct timespec* tp) {
 
   host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
   clock_get_time(cclock, &mts);
   mach_port_deallocate(mach_task_self(), cclock);
 
   tp->tv_sec = mts.tv_sec;
   tp->tv_nsec = mts.tv_nsec;
 #else
-  ASSERT_NE(0, timespec_get(tp, TIME_UTC));
+  clock_gettime(CLOCK_MONOTONIC, tp);
 #endif
 }
 
 class MPITest : public ::testing::Test {
  protected:
   void TestCmp(const std::string a_string, const std::string b_string,
                int result) {
     mp_int a, b;
@@ -80,32 +79,31 @@ class MPITest : public ::testing::Test {
     }
     std::cerr << std::endl << std::resetiosflags(flags);
   }
 
   void TestToFixedOctets(const std::vector<uint8_t>& ref, size_t len) {
     mp_int a;
     ASSERT_EQ(MP_OKAY, mp_init(&a));
     ASSERT_EQ(MP_OKAY, mp_read_unsigned_octets(&a, ref.data(), ref.size()));
-    std::unique_ptr<uint8_t[]> buf(new uint8_t[len]);
-    ASSERT_NE(buf, nullptr);
-    ASSERT_EQ(MP_OKAY, mp_to_fixlen_octets(&a, buf.get(), len));
+    uint8_t buf[len];
+    ASSERT_EQ(MP_OKAY, mp_to_fixlen_octets(&a, buf, len));
     size_t compare;
     if (len > ref.size()) {
       for (size_t i = 0; i < len - ref.size(); ++i) {
         ASSERT_EQ(0U, buf[i]) << "index " << i << " should be zero";
       }
       compare = ref.size();
     } else {
       compare = len;
     }
     dump("value", ref.data(), ref.size());
-    dump("output", buf.get(), len);
-    ASSERT_EQ(0, memcmp(buf.get() + len - compare,
-                        ref.data() + ref.size() - compare, compare))
+    dump("output", buf, len);
+    ASSERT_EQ(0, memcmp(buf + len - compare, ref.data() + ref.size() - compare,
+                        compare))
         << "comparing " << compare << " octets";
     mp_clear(&a);
   }
 };
 
 TEST_F(MPITest, MpiCmp01Test) { TestCmp("0", "1", -1); }
 TEST_F(MPITest, MpiCmp10Test) { TestCmp("1", "0", 1); }
 TEST_F(MPITest, MpiCmp00Test) { TestCmp("0", "0", 0); }
--- a/gtests/freebl_gtest/rsa_unittest.cc
+++ b/gtests/freebl_gtest/rsa_unittest.cc
@@ -1,16 +1,15 @@
 // 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 "gtest/gtest.h"
 
 #include <stdint.h>
-#include <memory>
 
 #include "blapi.h"
 #include "secitem.h"
 
 template <class T>
 struct ScopedDelete {
   void operator()(T* ptr) {
     if (ptr) {
--- a/nss.gyp
+++ b/nss.gyp
@@ -193,17 +193,16 @@
             'cmd/vfychain/vfychain.gyp:vfychain',
             'cmd/vfyserv/vfyserv.gyp:vfyserv',
             'gtests/certhigh_gtest/certhigh_gtest.gyp:certhigh_gtest',
             'gtests/cryptohi_gtest/cryptohi_gtest.gyp:cryptohi_gtest',
             'gtests/der_gtest/der_gtest.gyp:der_gtest',
             'gtests/certdb_gtest/certdb_gtest.gyp:certdb_gtest',
             'gtests/freebl_gtest/freebl_gtest.gyp:prng_gtest',
             'gtests/freebl_gtest/freebl_gtest.gyp:blake2b_gtest',
-            'gtests/freebl_gtest/freebl_gtest.gyp:freebl_gtest',
             'gtests/mozpkix_gtest/mozpkix_gtest.gyp:mozpkix_gtest',
             'gtests/nss_bogo_shim/nss_bogo_shim.gyp:nss_bogo_shim',
             'gtests/pk11_gtest/pk11_gtest.gyp:pk11_gtest',
             'gtests/smime_gtest/smime_gtest.gyp:smime_gtest',
             'gtests/softoken_gtest/softoken_gtest.gyp:softoken_gtest',
             'gtests/ssl_gtest/ssl_gtest.gyp:ssl_gtest',
             'gtests/util_gtest/util_gtest.gyp:util_gtest',
           ],