summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorMichiel Visser <opensource@webmichiel.nl>2022-03-18 10:39:34 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-03-20 00:51:50 +0330
commit66d99c83d93252d0bebe51d80d0da8967d18f542 (patch)
treed6492a471b30926d3b223f838edff238dcccdd55 /Tests
parentc1b041e761b99679a3998dbd81821febdecd2df9 (diff)
downloadserenity-66d99c83d93252d0bebe51d80d0da8967d18f542.zip
LibCrypto+LibTLS: Add SECP256r1 support to LibTLS
Add the required methods to SECP256r1 to conform to the EllipticCurve virtual base class. Using this updated version of SECP256r1, support in LibTLS is implemented.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibCrypto/TestCurves.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Tests/LibCrypto/TestCurves.cpp b/Tests/LibCrypto/TestCurves.cpp
index c7a40c351c..8aa007aa71 100644
--- a/Tests/LibCrypto/TestCurves.cpp
+++ b/Tests/LibCrypto/TestCurves.cpp
@@ -195,13 +195,15 @@ TEST_CASE(test_secp256r1)
ReadonlyBytes bob_private_key { bob_private_key_data, 32 };
ReadonlyBytes bob_public_key { bob_public_key_data, 65 };
- auto generated_alice_public = MUST(Crypto::Curves::SECP256r1::generate_public_key(alice_private_key));
+ Crypto::Curves::SECP256r1 curve;
+
+ auto generated_alice_public = MUST(curve.generate_public_key(alice_private_key));
EXPECT_EQ(alice_public_key, generated_alice_public);
- auto generated_bob_public = MUST(Crypto::Curves::SECP256r1::generate_public_key(bob_private_key));
+ auto generated_bob_public = MUST(curve.generate_public_key(bob_private_key));
EXPECT_EQ(bob_public_key, generated_bob_public);
- auto generated_public = MUST(Crypto::Curves::SECP256r1::generate_public_key({ private_key_data, 32 }));
+ auto generated_public = MUST(curve.generate_public_key({ private_key_data, 32 }));
ReadonlyBytes expected_public_key { expected_public_key_data, 65 };
EXPECT_EQ(expected_public_key, generated_public);
}