Index: crypto/p224_unittest.cc |
diff --git a/crypto/p224_unittest.cc b/crypto/p224_unittest.cc |
index 1ab2ff763814c0d00c0105d1a5568d5bd01e50a6..0c6f06c2b8d5c8d7028a59f8b1bf276befaba2f0 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_t*>(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)))); |
+} |