Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Unified Diff: net/ssl/ssl_platform_key_util_unittest.cc

Issue 2567523003: Fix P-521 client cert mapping and test all curves. (Closed)
Patch Set: reupload with hack to depot_tools Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/ssl_platform_key_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_platform_key_util_unittest.cc
diff --git a/net/ssl/ssl_platform_key_util_unittest.cc b/net/ssl/ssl_platform_key_util_unittest.cc
index 1e7b9d3d5480b7579dbbc0b32dad5cd235dc87e3..8a00034fecb391e0494ceb3db974fce598e713fe 100644
--- a/net/ssl/ssl_platform_key_util_unittest.cc
+++ b/net/ssl/ssl_platform_key_util_unittest.cc
@@ -31,6 +31,10 @@ bool GetClientCertInfoFromFile(const char* filename,
return GetClientCertInfo(cert.get(), out_type, out_max_length);
}
+size_t BitsToBytes(size_t bits) {
+ return (bits + 7) / 8;
+}
+
} // namespace
TEST(SSLPlatformKeyUtil, GetClientCertInfo) {
@@ -43,7 +47,15 @@ TEST(SSLPlatformKeyUtil, GetClientCertInfo) {
ASSERT_TRUE(GetClientCertInfoFromFile("client_4.pem", &type, &max_length));
EXPECT_EQ(SSLPrivateKey::Type::ECDSA_P256, type);
- EXPECT_EQ(ECDSA_SIG_max_len(256u / 8u), max_length);
+ EXPECT_EQ(ECDSA_SIG_max_len(BitsToBytes(256)), max_length);
+
+ ASSERT_TRUE(GetClientCertInfoFromFile("client_5.pem", &type, &max_length));
+ EXPECT_EQ(SSLPrivateKey::Type::ECDSA_P384, type);
+ EXPECT_EQ(ECDSA_SIG_max_len(BitsToBytes(384)), max_length);
+
+ ASSERT_TRUE(GetClientCertInfoFromFile("client_6.pem", &type, &max_length));
+ EXPECT_EQ(SSLPrivateKey::Type::ECDSA_P521, type);
+ EXPECT_EQ(ECDSA_SIG_max_len(BitsToBytes(521)), max_length);
}
} // namespace net
« no previous file with comments | « net/ssl/ssl_platform_key_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698