Index: crypto/p224_unittest.cc |
diff --git a/crypto/p224_unittest.cc b/crypto/p224_unittest.cc |
index 1ab2ff763814c0d00c0105d1a5568d5bd01e50a6..5316d8a17e00f65040da9c72df3a19fbd2219a2b 100644 |
--- a/crypto/p224_unittest.cc |
+++ b/crypto/p224_unittest.cc |
@@ -806,3 +806,16 @@ TEST(P224, Addition) { |
p224::Add(minus_b, sum, &a_again); |
EXPECT_TRUE(a_again.ToString() == a.ToString()); |
} |
+ |
+TEST(P224, Infinity) { |
+ char zeros[56]; |
+ memset(zeros, 0, sizeof(zeros)); |
+ |
+ // Test that x^0 = ∞. |
+ Point a; |
+ p224::ScalarBaseMult(reinterpret_cast<const uint8*>(zeros), &a); |
+ EXPECT_TRUE(memcmp(zeros, a.ToString().data(), sizeof(zeros)) == 0); |
+ |
+ // We shouldn't allow ∞ to be imported. |
+ EXPECT_FALSE(a.SetFromString(std::string(zeros, sizeof(zeros)))); |
+} |