aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-04 22:17:38 -0500
committerJack Lloyd <[email protected]>2018-03-04 22:17:38 -0500
commita7d664192a7dce877225e6fbe35c3ad4a1d3cceb (patch)
treeb09c2db1d6dd1ffa6791c4120baea034607f0248 /src/tests
parent8fe96b9384017b6d0f496c02c367e66ae6617a17 (diff)
Support decoding of ECC groups with seed parameter
Closes GH #874
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/x509/ecc/secp384r1_seed.pem10
-rw-r--r--src/tests/unit_ecc.cpp17
2 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/data/x509/ecc/secp384r1_seed.pem b/src/tests/data/x509/ecc/secp384r1_seed.pem
new file mode 100644
index 000000000..8f5598ed0
--- /dev/null
+++ b/src/tests/data/x509/ecc/secp384r1_seed.pem
@@ -0,0 +1,10 @@
+-----BEGIN EC PARAMETERS-----
+MIIBVwIBATA8BgcqhkjOPQEBAjEA////////////////////////////////////
+//////7/////AAAAAAAAAAD/////MHsEMP//////////////////////////////
+///////////+/////wAAAAAAAAAA/////AQwszEvp+I+5+SYjgVr4/gtGRgdnG7+
+gUESAxQIj1ATh1rGVjmNii7RnSqFyO3T7CrvAxUAozWSaqMZonodAIlqZ3OkgnrN
+rHMEYQSqh8oivosFN46xxx7zIK10bh07Younm5hZ90HgglQqOFUC8l2/VSlsOlRe
+OHJ2Crc2F95KliYsb12emL+Sktwp+PQdvSiaFHzp2jETtfC4wApgsc4dfoGdekMd
+fJDqDl8CMQD////////////////////////////////HY02B9Dct31gaDbJIsKd6
+7OwZaszFKXMCAQE=
+-----END EC PARAMETERS-----
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index aecf6e5d4..6f0d1a243 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -293,6 +293,22 @@ Test::Result test_groups()
return result;
}
+Test::Result test_decoding_with_seed()
+ {
+ Test::Result result("ECC Unit");
+
+ Botan::EC_Group secp384r1_with_seed(
+ Test::read_data_file("x509/ecc/secp384r1_seed.pem"));
+
+ result.confirm("decoding worked", secp384r1_with_seed.initialized());
+
+ Botan::EC_Group secp384r1("secp384r1");
+
+ result.test_eq("P-384 prime", secp384r1_with_seed.get_p(), secp384r1.get_p());
+
+ return result;
+ }
+
Test::Result test_coordinates()
{
Test::Result result("ECC Unit");
@@ -765,6 +781,7 @@ class ECC_Unit_Tests final : public Test
results.push_back(test_groups());
results.push_back(test_coordinates());
+ results.push_back(test_decoding_with_seed());
results.push_back(test_point_transformation());
results.push_back(test_point_mult());
results.push_back(test_point_negative());