aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_ecc.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-10 10:24:25 -0500
committerJack Lloyd <[email protected]>2018-03-10 10:27:12 -0500
commit9141f982c7679a27a265a84ba34d9695017883c9 (patch)
tree2853c6c86ab7ac70dde74692a82ec01c15bbbb20 /src/tests/unit_ecc.cpp
parentea0f46dfcab59938fc863ca8d01552392c3c5a34 (diff)
Add PointGFp::encode as replacement for EC2OSP
Literally every single call to EC2OSP is converting the returned secure_vector to a std::vector. Which makes sense since private points are not really a thing in any protocol I know of.
Diffstat (limited to 'src/tests/unit_ecc.cpp')
-rw-r--r--src/tests/unit_ecc.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/tests/unit_ecc.cpp b/src/tests/unit_ecc.cpp
index cbff3ff4f..f3a163435 100644
--- a/src/tests/unit_ecc.cpp
+++ b/src/tests/unit_ecc.cpp
@@ -429,13 +429,13 @@ Test::Result test_zeropoint_enc_dec()
Botan::PointGFp p = secp160r1.zero_point();
result.confirm("zero point is zero", p.is_zero());
- std::vector<uint8_t> sv_p = unlock(EC2OSP(p, Botan::PointGFp::UNCOMPRESSED));
+ std::vector<uint8_t> sv_p = p.encode(Botan::PointGFp::UNCOMPRESSED);
result.test_eq("encoded/decode rt works", secp160r1.OS2ECP(sv_p), p);
- sv_p = unlock(EC2OSP(p, Botan::PointGFp::COMPRESSED));
+ sv_p = p.encode(Botan::PointGFp::COMPRESSED);
result.test_eq("encoded/decode compressed rt works", secp160r1.OS2ECP(sv_p), p);
- sv_p = unlock(EC2OSP(p, Botan::PointGFp::HYBRID));
+ sv_p = p.encode(Botan::PointGFp::HYBRID);
result.test_eq("encoded/decode hybrid rt works", secp160r1.OS2ECP(sv_p), p);
return result;
}
@@ -572,7 +572,7 @@ Test::Result test_enc_dec_compressed_160()
const Botan::PointGFp p = secp160r1.OS2ECP(G_comp);
- std::vector<uint8_t> sv_result = unlock(Botan::EC2OSP(p, Botan::PointGFp::COMPRESSED));
+ std::vector<uint8_t> sv_result = p.encode(Botan::PointGFp::COMPRESSED);
result.test_eq("result", sv_result, G_comp);
return result;
@@ -588,7 +588,7 @@ Test::Result test_enc_dec_compressed_256()
const std::vector<uint8_t> sv_G_secp_comp = Botan::hex_decode(G_secp_comp);
Botan::PointGFp p_G = group.OS2ECP(sv_G_secp_comp);
- std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::COMPRESSED));
+ std::vector<uint8_t> sv_result = p_G.encode(Botan::PointGFp::COMPRESSED);
result.test_eq("compressed_256", sv_result, sv_G_secp_comp);
return result;
@@ -619,7 +619,7 @@ Test::Result test_enc_dec_uncompressed_112()
const std::vector<uint8_t> sv_G_secp_uncomp = Botan::hex_decode(G_secp_uncomp);
Botan::PointGFp p_G = group.OS2ECP(sv_G_secp_uncomp);
- std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::UNCOMPRESSED));
+ std::vector<uint8_t> sv_result = p_G.encode(Botan::PointGFp::UNCOMPRESSED);
result.test_eq("uncompressed_112", sv_result, sv_G_secp_uncomp);
return result;
@@ -640,7 +640,7 @@ Test::Result test_enc_dec_uncompressed_521()
Botan::PointGFp p_G = group.OS2ECP(sv_G_secp_uncomp);
- std::vector<uint8_t> sv_result = unlock(EC2OSP(p_G, Botan::PointGFp::UNCOMPRESSED));
+ std::vector<uint8_t> sv_result = p_G.encode(Botan::PointGFp::UNCOMPRESSED);
result.test_eq("expected", sv_result, sv_G_secp_uncomp);
return result;
@@ -654,7 +654,7 @@ Test::Result test_gfp_store_restore()
Botan::EC_Group dom_pars("secp160r1");
Botan::PointGFp p = dom_pars.get_base_point();
- std::vector<uint8_t> sv_mes = unlock(EC2OSP(p, Botan::PointGFp::COMPRESSED));
+ std::vector<uint8_t> sv_mes = p.encode(Botan::PointGFp::COMPRESSED);
Botan::PointGFp new_p = dom_pars.OS2ECP(sv_mes);
result.test_eq("original and restored points are same", p, new_p);