1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibTLS: Define cipher suite parameters and components in a macro

Instead of sprinkling the definition of the ciper suites all over the
TLS implementation, let's regroup it all once and for all in a single
place, and then add our new implementations there.
This commit is contained in:
DexesTTP 2021-05-17 22:34:03 +02:00 committed by Andreas Kling
parent 17a1f51579
commit 6d190b299e
2 changed files with 84 additions and 56 deletions

View file

@ -42,6 +42,31 @@ enum class SignatureAlgorithm : u8 {
ECDSA = 3,
};
enum class CipherAlgorithm {
AES_128_CBC,
AES_128_GCM,
AES_128_CCM,
AES_128_CCM_8,
AES_256_CBC,
AES_256_GCM,
};
constexpr size_t cipher_key_size(CipherAlgorithm algorithm)
{
switch (algorithm) {
case CipherAlgorithm::AES_128_CBC:
case CipherAlgorithm::AES_128_GCM:
case CipherAlgorithm::AES_128_CCM:
case CipherAlgorithm::AES_128_CCM_8:
return 128;
case CipherAlgorithm::AES_256_CBC:
case CipherAlgorithm::AES_256_GCM:
return 256;
default:
return 128;
}
}
struct SignatureAndHashAlgorithm {
HashAlgorithm hash;
SignatureAlgorithm signature;