LibTLS: Move HashAlgorithm to Extensions.h

Also add missing values from the IANA registry
This commit is contained in:
stelar7 2023-04-14 00:20:19 +02:00 committed by Sam Atkins
parent fba7695dcc
commit da8edece29
Notes: sideshowbarker 2024-07-16 21:26:30 +09:00
2 changed files with 15 additions and 11 deletions

View file

@ -95,17 +95,6 @@ enum class CipherSuite {
AES_128_CCM_8_SHA256 = 0x1305,
};
// Defined in RFC 5246 section 7.4.1.4.1
enum class HashAlgorithm : u8 {
None = 0,
MD5 = 1,
SHA1 = 2,
SHA224 = 3,
SHA256 = 4,
SHA384 = 5,
SHA512 = 6,
};
// Defined in RFC 5246 section 7.4.1.4.1
struct SignatureAndHashAlgorithm {
HashAlgorithm hash;

View file

@ -272,6 +272,21 @@ enum class SignatureAlgorithm : u8 {
__ENUM_SIGNATURE_ALGORITHM
};
// https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-18
#define __ENUM_HASH_ALGORITHM \
_ENUM_KEY_VALUE(NONE, 0) \
_ENUM_KEY_VALUE(MD5, 1) \
_ENUM_KEY_VALUE(SHA1, 2) \
_ENUM_KEY_VALUE(SHA224, 3) \
_ENUM_KEY_VALUE(SHA256, 4) \
_ENUM_KEY_VALUE(SHA384, 5) \
_ENUM_KEY_VALUE(SHA512, 6) \
_ENUM_KEY_VALUE(INTRINSIC, 8)
enum class HashAlgorithm : u8 {
__ENUM_HASH_ALGORITHM
};
#undef _ENUM_KEY
#undef _ENUM_KEY_VALUE