/src/botan/build/include/botan/tls_algos.h
Line | Count | Source |
1 | | /* |
2 | | * (C) 2017 Jack Lloyd |
3 | | * |
4 | | * Botan is released under the Simplified BSD License (see license.txt) |
5 | | */ |
6 | | |
7 | | #ifndef BOTAN_TLS_ALGO_IDS_H_ |
8 | | #define BOTAN_TLS_ALGO_IDS_H_ |
9 | | |
10 | | #include <botan/types.h> |
11 | | #include <string> |
12 | | #include <vector> |
13 | | |
14 | | //BOTAN_FUTURE_INTERNAL_HEADER(tls_algos.h) |
15 | | |
16 | | namespace Botan { |
17 | | |
18 | | namespace TLS { |
19 | | |
20 | | enum class Cipher_Algo { |
21 | | CHACHA20_POLY1305, |
22 | | |
23 | | AES_128_GCM, |
24 | | AES_256_GCM, |
25 | | |
26 | | AES_256_OCB, |
27 | | |
28 | | CAMELLIA_128_GCM, |
29 | | CAMELLIA_256_GCM, |
30 | | |
31 | | ARIA_128_GCM, |
32 | | ARIA_256_GCM, |
33 | | |
34 | | AES_128_CCM, |
35 | | AES_256_CCM, |
36 | | AES_128_CCM_8, |
37 | | AES_256_CCM_8, |
38 | | |
39 | | AES_128_CBC_HMAC_SHA1, |
40 | | AES_128_CBC_HMAC_SHA256, |
41 | | AES_256_CBC_HMAC_SHA1, |
42 | | AES_256_CBC_HMAC_SHA256, |
43 | | AES_256_CBC_HMAC_SHA384, |
44 | | |
45 | | DES_EDE_CBC_HMAC_SHA1, |
46 | | }; |
47 | | |
48 | | enum class KDF_Algo { |
49 | | SHA_1, |
50 | | SHA_256, |
51 | | SHA_384, |
52 | | }; |
53 | | |
54 | | std::string BOTAN_DLL kdf_algo_to_string(KDF_Algo algo); |
55 | | |
56 | | enum class Nonce_Format { |
57 | | CBC_MODE, |
58 | | AEAD_IMPLICIT_4, |
59 | | AEAD_XOR_12, |
60 | | }; |
61 | | |
62 | | // TODO encoding should match signature_algorithms extension |
63 | | // TODO this should include hash etc as in TLS v1.3 |
64 | | enum class Auth_Method { |
65 | | RSA, |
66 | | ECDSA, |
67 | | |
68 | | // These are placed outside the encodable range |
69 | | IMPLICIT = 0x10000, |
70 | | }; |
71 | | |
72 | | std::string BOTAN_TEST_API auth_method_to_string(Auth_Method method); |
73 | | Auth_Method BOTAN_TEST_API auth_method_from_string(const std::string& str); |
74 | | |
75 | | /* |
76 | | * This matches the wire encoding |
77 | | */ |
78 | | enum class Signature_Scheme : uint16_t { |
79 | | NONE = 0x0000, |
80 | | |
81 | | RSA_PKCS1_SHA256 = 0x0401, |
82 | | RSA_PKCS1_SHA384 = 0x0501, |
83 | | RSA_PKCS1_SHA512 = 0x0601, |
84 | | |
85 | | ECDSA_SHA256 = 0x0403, |
86 | | ECDSA_SHA384 = 0x0503, |
87 | | ECDSA_SHA512 = 0x0603, |
88 | | |
89 | | RSA_PSS_SHA256 = 0x0804, |
90 | | RSA_PSS_SHA384 = 0x0805, |
91 | | RSA_PSS_SHA512 = 0x0806, |
92 | | |
93 | | EDDSA_25519 = 0x0807, |
94 | | EDDSA_448 = 0x0808, |
95 | | }; |
96 | | |
97 | | BOTAN_UNSTABLE_API const std::vector<Signature_Scheme>& all_signature_schemes(); |
98 | | |
99 | | bool BOTAN_UNSTABLE_API signature_scheme_is_known(Signature_Scheme scheme); |
100 | | std::string BOTAN_UNSTABLE_API sig_scheme_to_string(Signature_Scheme scheme); |
101 | | std::string BOTAN_UNSTABLE_API hash_function_of_scheme(Signature_Scheme scheme); |
102 | | std::string BOTAN_UNSTABLE_API padding_string_for_scheme(Signature_Scheme scheme); |
103 | | std::string signature_algorithm_of_scheme(Signature_Scheme scheme); |
104 | | |
105 | | /* |
106 | | * Matches with wire encoding |
107 | | */ |
108 | | enum class Group_Params : uint16_t { |
109 | | NONE = 0, |
110 | | |
111 | | SECP256R1 = 23, |
112 | | SECP384R1 = 24, |
113 | | SECP521R1 = 25, |
114 | | BRAINPOOL256R1 = 26, |
115 | | BRAINPOOL384R1 = 27, |
116 | | BRAINPOOL512R1 = 28, |
117 | | |
118 | | X25519 = 29, |
119 | | |
120 | | FFDHE_2048 = 256, |
121 | | FFDHE_3072 = 257, |
122 | | FFDHE_4096 = 258, |
123 | | FFDHE_6144 = 259, |
124 | | FFDHE_8192 = 260, |
125 | | }; |
126 | | |
127 | | std::string group_param_to_string(Group_Params group); |
128 | | Group_Params group_param_from_string(const std::string& group_name); |
129 | | bool group_param_is_dh(Group_Params group); |
130 | | |
131 | | enum class Kex_Algo { |
132 | | STATIC_RSA, |
133 | | DH, |
134 | | ECDH, |
135 | | CECPQ1, |
136 | | PSK, |
137 | | ECDHE_PSK, |
138 | | }; |
139 | | |
140 | | std::string BOTAN_TEST_API kex_method_to_string(Kex_Algo method); |
141 | | Kex_Algo BOTAN_TEST_API kex_method_from_string(const std::string& str); |
142 | | |
143 | | inline bool key_exchange_is_psk(Kex_Algo m) |
144 | 15.7k | { |
145 | 15.7k | return (m == Kex_Algo::PSK || |
146 | 15.7k | m == Kex_Algo::ECDHE_PSK); |
147 | 15.7k | } |
148 | | |
149 | | } |
150 | | |
151 | | } |
152 | | |
153 | | #endif |