mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +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:
parent
17a1f51579
commit
6d190b299e
Notes:
sideshowbarker
2024-07-18 17:47:48 +09:00
Author: https://github.com/Dexesttp
Commit: 6d190b299e
Pull-request: https://github.com/SerenityOS/serenity/pull/7270
Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 84 additions and 56 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue