forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
577 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2024, Altomani Gianluca <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#include <AK/Random.h> | ||
#include <LibCrypto/Curves/Ed448.h> | ||
|
||
namespace Crypto::Curves { | ||
|
||
// https://datatracker.ietf.org/doc/html/rfc8032#section-5.2.5 | ||
ErrorOr<ByteBuffer> Ed448::generate_private_key() | ||
{ | ||
// The private key is 57 octets (456 bits, corresponding to b) of | ||
// cryptographically secure random data. See [RFC4086] for a discussion | ||
// about randomness. | ||
|
||
auto buffer = TRY(ByteBuffer::create_uninitialized(key_size())); | ||
fill_with_random(buffer); | ||
return buffer; | ||
} | ||
|
||
// https://datatracker.ietf.org/doc/html/rfc8032#section-5.2.5 | ||
ErrorOr<ByteBuffer> Ed448::generate_public_key(ReadonlyBytes private_key) | ||
{ | ||
// The 57-byte public key is generated by the following steps: | ||
|
||
return TRY(ByteBuffer::copy(private_key)); // FIXME | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024, Altomani Gianluca <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <AK/ByteBuffer.h> | ||
|
||
namespace Crypto::Curves { | ||
|
||
class Ed448 { | ||
public: | ||
|
||
size_t key_size() { return 57; } | ||
size_t signature_size() { return 0; } | ||
ErrorOr<ByteBuffer> generate_private_key(); | ||
ErrorOr<ByteBuffer> generate_public_key(ReadonlyBytes private_key); | ||
}; | ||
|
||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters