1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:47:45 +00:00

LibCrypto+LibTLS: Generalize the elliptic curve interface

These changes generalize the interface with an elliptic curve
implementation. This allows LibTLS to support elliptic curves generally
without needing the specifics of elliptic curve implementations.

This should allow for easier addition of other elliptic curves.
This commit is contained in:
Michiel Visser 2022-03-05 18:13:39 +01:00 committed by Ali Mohammad Pur
parent 21bbff0349
commit c1b041e761
10 changed files with 133 additions and 122 deletions

View file

@ -15,6 +15,7 @@
#include <LibCrypto/Authentication/HMAC.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
#include <LibCrypto/Cipher/AES.h>
#include <LibCrypto/Curves/EllipticCurve.h>
#include <LibCrypto/Hash/HashManager.h>
#include <LibCrypto/PK/RSA.h>
#include <LibTLS/CipherSuite.h>
@ -334,7 +335,7 @@ struct Context {
ByteBuffer Ys;
} server_diffie_hellman_params;
NamedCurve server_curve_choice;
OwnPtr<Crypto::Curves::EllipticCurve> server_key_exchange_curve;
};
class TLSv12 final : public Core::Stream::Socket {
@ -465,9 +466,6 @@ private:
void build_dhe_rsa_pre_master_secret(PacketBuilder&);
void build_ecdhe_rsa_pre_master_secret(PacketBuilder&);
static ErrorOr<ByteBuffer> named_curve_multiply(NamedCurve curve, ReadonlyBytes a, ReadonlyBytes b);
static ErrorOr<ByteBuffer> named_curve_generator_point(NamedCurve curve);
ErrorOr<bool> flush();
void write_into_socket();
ErrorOr<void> read_from_socket();