mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:07:46 +00:00
LibCrypto: Add SECP384r1 implementation
This implementation is basically a copy-paste of the SECP256r1 implementation with all "256" replaced with "384". In the future it might be nice to make this generic, instead of having two almost identical copies of code.
This commit is contained in:
parent
be68f747b6
commit
6322d68b1b
3 changed files with 662 additions and 0 deletions
26
Userland/Libraries/LibCrypto/Curves/SECP384r1.h
Normal file
26
Userland/Libraries/LibCrypto/Curves/SECP384r1.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Michiel Visser <opensource@webmichiel.nl>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/UFixedBigInt.h>
|
||||
#include <LibCrypto/Curves/EllipticCurve.h>
|
||||
|
||||
namespace Crypto::Curves {
|
||||
|
||||
class SECP384r1 : public EllipticCurve {
|
||||
public:
|
||||
size_t key_size() override { return 1 + 2 * 48; }
|
||||
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;
|
||||
|
||||
ErrorOr<bool> verify(ReadonlyBytes hash, ReadonlyBytes pubkey, ReadonlyBytes signature);
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue