diff options
author | Jack Lloyd <[email protected]> | 2018-02-19 11:43:40 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-02-19 11:48:04 -0500 |
commit | 6d4affbbc27f021c6e87f74c5db420b75ca96581 (patch) | |
tree | a5685a6b05a49ffe55e798a90bcf6c75ca05d886 /src/tests/test_dl_group.cpp | |
parent | 0c730407a73d26eb5a5c9cb2a5fdb6b6042081ed (diff) |
Add shared_ptr for DL_Group state
Add precomputations for mod-p math and g^x%p calcualations.
Diffstat (limited to 'src/tests/test_dl_group.cpp')
-rw-r--r-- | src/tests/test_dl_group.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/tests/test_dl_group.cpp b/src/tests/test_dl_group.cpp index d402931c5..70aa526ef 100644 --- a/src/tests/test_dl_group.cpp +++ b/src/tests/test_dl_group.cpp @@ -43,25 +43,23 @@ class DL_Group_Tests final : public Test const std::string pem2 = orig.PEM_encode(Botan::DL_Group::ANSI_X9_57); const std::string pem3 = orig.PEM_encode(Botan::DL_Group::PKCS_3); - Botan::DL_Group group; + Botan::DL_Group group1(pem1); - group.PEM_decode(pem1); + result.test_eq("Same p in X9.42 decoding", group1.get_p(), orig.get_p()); + result.test_eq("Same q in X9.42 decoding", group1.get_q(), orig.get_q()); + result.test_eq("Same g in X9.42 decoding", group1.get_g(), orig.get_g()); - result.test_eq("Same p in X9.42 decoding", group.get_p(), orig.get_p()); - result.test_eq("Same q in X9.42 decoding", group.get_q(), orig.get_q()); - result.test_eq("Same g in X9.42 decoding", group.get_g(), orig.get_g()); + Botan::DL_Group group2(pem2); - group.PEM_decode(pem2); + result.test_eq("Same p in X9.57 decoding", group2.get_p(), orig.get_p()); + result.test_eq("Same q in X9.57 decoding", group2.get_q(), orig.get_q()); + result.test_eq("Same g in X9.57 decoding", group2.get_g(), orig.get_g()); - result.test_eq("Same p in X9.57 decoding", group.get_p(), orig.get_p()); - result.test_eq("Same q in X9.57 decoding", group.get_q(), orig.get_q()); - result.test_eq("Same g in X9.57 decoding", group.get_g(), orig.get_g()); + Botan::DL_Group group3(pem3); - group.PEM_decode(pem3); - - result.test_eq("Same p in X9.57 decoding", group.get_p(), orig.get_p()); + result.test_eq("Same p in X9.57 decoding", group3.get_p(), orig.get_p()); // no q in PKCS #3 format - result.test_eq("Same g in X9.57 decoding", group.get_g(), orig.get_g()); + result.test_eq("Same g in X9.57 decoding", group3.get_g(), orig.get_g()); return result; } |