mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:07:34 +00:00
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.
This commit is contained in:
parent
c1b041e761
commit
66d99c83d9
5 changed files with 35 additions and 6 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/UFixedBigInt.h>
|
||||
#include <LibCrypto/Curves/EllipticCurve.h>
|
||||
|
||||
namespace Crypto::Curves {
|
||||
|
||||
|
@ -17,10 +18,13 @@ struct JacobianPoint {
|
|||
u256 z { 0u };
|
||||
};
|
||||
|
||||
class SECP256r1 {
|
||||
class SECP256r1 : public EllipticCurve {
|
||||
public:
|
||||
static ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes a);
|
||||
static ErrorOr<ByteBuffer> compute_coordinate(ReadonlyBytes scalar_bytes, ReadonlyBytes point_bytes);
|
||||
size_t key_size() override { return 1 + 2 * 32; }
|
||||
ErrorOr<ByteBuffer> generate_private_key() override;
|
||||
ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes a) override;
|
||||
ErrorOr<ByteBuffer> compute_coordinate(ReadonlyBytes scalar_bytes, ReadonlyBytes point_bytes) override;
|
||||
ErrorOr<ByteBuffer> derive_premaster_key(ReadonlyBytes shared_point) override;
|
||||
|
||||
private:
|
||||
static u256 modular_reduce(u256 const& value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue