diff options
author | DexesTTP <dexes.ttp@gmail.com> | 2021-05-18 23:26:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-19 09:18:45 +0200 |
commit | 9bb823a6ab13586eebf90b763f8f143e06a86bff (patch) | |
tree | b7194e7206c57aa7100ac1c5baa4248450e467a2 /Userland/Libraries/LibTLS/TLSv12.h | |
parent | 2e9a4bb95c8e2e22b56ad52e6ce5dfb62ceed1e1 (diff) | |
download | serenity-9bb823a6ab13586eebf90b763f8f143e06a86bff.zip |
LibTLS: Generate cipher variants based on the cipher
This is better than using the AEAD flag :^)
Diffstat (limited to 'Userland/Libraries/LibTLS/TLSv12.h')
-rw-r--r-- | Userland/Libraries/LibTLS/TLSv12.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibTLS/TLSv12.h b/Userland/Libraries/LibTLS/TLSv12.h index 3328574e82..21a517c6cd 100644 --- a/Userland/Libraries/LibTLS/TLSv12.h +++ b/Userland/Libraries/LibTLS/TLSv12.h @@ -179,6 +179,19 @@ enum ClientVerificationStaus { C(true, CipherSuite::RSA_WITH_AES_128_GCM_SHA256, SignatureAlgorithm::RSA, CipherAlgorithm::AES_128_GCM, Crypto::Hash::SHA256, 8, true) \ C(false, CipherSuite::RSA_WITH_AES_256_GCM_SHA384, SignatureAlgorithm::RSA, CipherAlgorithm::AES_256_GCM, Crypto::Hash::SHA384, 8, true) +constexpr CipherAlgorithm get_cipher_algorithm(CipherSuite suite) +{ + switch (suite) { +#define C(is_supported, suite, signature, cipher, hash, iv_size, is_aead) \ + case suite: \ + return cipher; + ENUMERATE_CIPHERS(C) +#undef C + default: + return CipherAlgorithm::Invalid; + } +} + struct Options { static Vector<CipherSuite> default_usable_cipher_suites() { |