Blob Blame History Raw
diff -up ./gtests/softoken_gtest/softoken_gtest.cc.remove_timing_test ./gtests/softoken_gtest/softoken_gtest.cc
--- ./gtests/softoken_gtest/softoken_gtest.cc.remove_timing_test	2020-07-30 08:34:30.404750663 -0700
+++ ./gtests/softoken_gtest/softoken_gtest.cc	2020-07-30 08:43:39.640495618 -0700
@@ -605,11 +605,14 @@ SECStatus test_dh_value(const PQGParams
 class SoftokenDhTest : public SoftokenTest {
  protected:
   SoftokenDhTest() : SoftokenTest("SoftokenDhTest.d-") {}
+#ifdef NSS_USE_REFERENCE_TIME
   time_t reference_time[CLASS_LAST] = {0};
+#endif
 
   virtual void SetUp() {
     SoftokenTest::SetUp();
 
+#ifdef NSS_USE_REFERENCE_TIME
     ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
     ASSERT_TRUE(slot);
 
@@ -625,6 +628,7 @@ class SoftokenDhTest : public SoftokenTe
       ASSERT_EQ(SECSuccess, test_dh_value(&params, nullptr, PR_FALSE, &time));
       reference_time[i] = time + 2 * time;
     }
+#endif
   };
 };
 
@@ -708,12 +712,16 @@ TEST_P(SoftokenDhValidate, DhVectors) {
     case SAFE_PRIME:
     case UNKNOWN_SUBPRIME:
       EXPECT_EQ(SECSuccess, rv) << err;
+#ifdef NSS_USE_REFERENCE_TIME
       EXPECT_LE(time, reference_time[dhTestValues.key_class]) << err;
+#endif
       break;
     case KNOWN_SUBPRIME:
     case SAFE_PRIME_WITH_SUBPRIME:
       EXPECT_EQ(SECSuccess, rv) << err;
+#ifdef NSS_USE_REFERENCE_TIME
       EXPECT_GT(time, reference_time[dhTestValues.key_class]) << err;
+#endif
       break;
     case WRONG_SUBPRIME:
     case BAD_PUB_KEY:
@@ -749,7 +757,9 @@ class SoftokenFipsTest : public Softoken
 class SoftokenFipsDhTest : public SoftokenFipsTest {
  protected:
   SoftokenFipsDhTest() : SoftokenFipsTest("SoftokenFipsDhTest.d-") {}
+#ifdef NSS_USE_REFERENCE_TIME
   time_t reference_time[CLASS_LAST] = {0};
+#endif
 
   virtual void SetUp() {
     SoftokenFipsTest::SetUp();
@@ -760,6 +770,7 @@ class SoftokenFipsDhTest : public Softok
     ASSERT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, ""));
     ASSERT_EQ(SECSuccess, PK11_Authenticate(slot.get(), PR_FALSE, nullptr));
 
+#ifdef NSS_USE_REFERENCE_TIME
     time_t time;
     for (int i = CLASS_FIRST; i < CLASS_LAST; i++) {
       PQGParams params;
@@ -772,6 +783,7 @@ class SoftokenFipsDhTest : public Softok
       ASSERT_EQ(SECSuccess, test_dh_value(&params, nullptr, PR_FALSE, &time));
       reference_time[i] = time + 2 * time;
     }
+#endif
   };
 };
 
@@ -883,7 +895,9 @@ TEST_P(SoftokenFipsDhValidate, DhVectors
     case TLS_APPROVED:
     case IKE_APPROVED:
       EXPECT_EQ(SECSuccess, rv) << err;
+#ifdef NSS_USE_REFERENCE_TIME
       EXPECT_LE(time, reference_time[dhTestValues.key_class]) << err;
+#endif
       break;
     case SAFE_PRIME:
     case SAFE_PRIME_WITH_SUBPRIME: