mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +00:00
LibTLS: Move the cipher list to the CipherSuite.h header
This commit is contained in:
parent
3d27550ab7
commit
45d55ecacc
2 changed files with 51 additions and 39 deletions
50
Userland/Libraries/LibTLS/CipherSuite.h
Normal file
50
Userland/Libraries/LibTLS/CipherSuite.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace TLS {
|
||||||
|
|
||||||
|
enum class CipherSuite {
|
||||||
|
Invalid = 0,
|
||||||
|
AES_128_GCM_SHA256 = 0x1301,
|
||||||
|
AES_256_GCM_SHA384 = 0x1302,
|
||||||
|
AES_128_CCM_SHA256 = 0x1304,
|
||||||
|
AES_128_CCM_8_SHA256 = 0x1305,
|
||||||
|
|
||||||
|
// We support these
|
||||||
|
RSA_WITH_AES_128_CBC_SHA = 0x002F,
|
||||||
|
RSA_WITH_AES_256_CBC_SHA = 0x0035,
|
||||||
|
RSA_WITH_AES_128_CBC_SHA256 = 0x003C,
|
||||||
|
RSA_WITH_AES_256_CBC_SHA256 = 0x003D,
|
||||||
|
// TODO
|
||||||
|
RSA_WITH_AES_128_GCM_SHA256 = 0x009C,
|
||||||
|
RSA_WITH_AES_256_GCM_SHA384 = 0x009D,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class HashAlgorithm : u8 {
|
||||||
|
None = 0,
|
||||||
|
MD5 = 1,
|
||||||
|
SHA1 = 2,
|
||||||
|
SHA224 = 3,
|
||||||
|
SHA256 = 4,
|
||||||
|
SHA384 = 5,
|
||||||
|
SHA512 = 6,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class SignatureAlgorithm : u8 {
|
||||||
|
Anonymous = 0,
|
||||||
|
RSA = 1,
|
||||||
|
DSA = 2,
|
||||||
|
ECDSA = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SignatureAndHashAlgorithm {
|
||||||
|
HashAlgorithm hash;
|
||||||
|
SignatureAlgorithm signature;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -17,6 +17,7 @@
|
||||||
#include <LibCrypto/Cipher/AES.h>
|
#include <LibCrypto/Cipher/AES.h>
|
||||||
#include <LibCrypto/Hash/HashManager.h>
|
#include <LibCrypto/Hash/HashManager.h>
|
||||||
#include <LibCrypto/PK/RSA.h>
|
#include <LibCrypto/PK/RSA.h>
|
||||||
|
#include <LibTLS/CipherSuite.h>
|
||||||
#include <LibTLS/TLSPacketBuilder.h>
|
#include <LibTLS/TLSPacketBuilder.h>
|
||||||
|
|
||||||
namespace TLS {
|
namespace TLS {
|
||||||
|
@ -41,23 +42,6 @@ inline void print_buffer(const u8* buffer, size_t size)
|
||||||
|
|
||||||
class Socket;
|
class Socket;
|
||||||
|
|
||||||
enum class CipherSuite {
|
|
||||||
Invalid = 0,
|
|
||||||
AES_128_GCM_SHA256 = 0x1301,
|
|
||||||
AES_256_GCM_SHA384 = 0x1302,
|
|
||||||
AES_128_CCM_SHA256 = 0x1304,
|
|
||||||
AES_128_CCM_8_SHA256 = 0x1305,
|
|
||||||
|
|
||||||
// We support these
|
|
||||||
RSA_WITH_AES_128_CBC_SHA = 0x002F,
|
|
||||||
RSA_WITH_AES_256_CBC_SHA = 0x0035,
|
|
||||||
RSA_WITH_AES_128_CBC_SHA256 = 0x003C,
|
|
||||||
RSA_WITH_AES_256_CBC_SHA256 = 0x003D,
|
|
||||||
// TODO
|
|
||||||
RSA_WITH_AES_128_GCM_SHA256 = 0x009C,
|
|
||||||
RSA_WITH_AES_256_GCM_SHA384 = 0x009D,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ENUMERATE_ALERT_DESCRIPTIONS \
|
#define ENUMERATE_ALERT_DESCRIPTIONS \
|
||||||
ENUMERATE_ALERT_DESCRIPTION(CloseNotify, 0) \
|
ENUMERATE_ALERT_DESCRIPTION(CloseNotify, 0) \
|
||||||
ENUMERATE_ALERT_DESCRIPTION(UnexpectedMessage, 10) \
|
ENUMERATE_ALERT_DESCRIPTION(UnexpectedMessage, 10) \
|
||||||
|
@ -179,28 +163,6 @@ enum ClientVerificationStaus {
|
||||||
VerificationNeeded,
|
VerificationNeeded,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HashAlgorithm : u8 {
|
|
||||||
None = 0,
|
|
||||||
MD5 = 1,
|
|
||||||
SHA1 = 2,
|
|
||||||
SHA224 = 3,
|
|
||||||
SHA256 = 4,
|
|
||||||
SHA384 = 5,
|
|
||||||
SHA512 = 6,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SignatureAlgorithm : u8 {
|
|
||||||
Anonymous = 0,
|
|
||||||
RSA = 1,
|
|
||||||
DSA = 2,
|
|
||||||
ECDSA = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SignatureAndHashAlgorithm {
|
|
||||||
HashAlgorithm hash;
|
|
||||||
SignatureAlgorithm signature;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
#define OPTION_WITH_DEFAULTS(typ, name, ...) \
|
#define OPTION_WITH_DEFAULTS(typ, name, ...) \
|
||||||
static typ default_##name() { return typ { __VA_ARGS__ }; } \
|
static typ default_##name() { return typ { __VA_ARGS__ }; } \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue