/* * Copyright (c) 2022, Michiel Visser * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Crypto::Curves { struct JacobianPoint { u256 x { 0u }; u256 y { 0u }; u256 z { 0u }; }; class SECP256r1 : public EllipticCurve { public: size_t key_size() override { return 1 + 2 * 32; } ErrorOr generate_private_key() override; ErrorOr generate_public_key(ReadonlyBytes a) override; ErrorOr compute_coordinate(ReadonlyBytes scalar_bytes, ReadonlyBytes point_bytes) override; ErrorOr derive_premaster_key(ReadonlyBytes shared_point) override; }; }