2
0

cipher_suite.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) Jan Venekamp, <jan@venekamp.net>
  9. *
  10. * This software is licensed as described in the file COPYING, which
  11. * you should have received as part of this distribution. The terms
  12. * are also available at https://curl.se/docs/copyright.html.
  13. *
  14. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. * copies of the Software, and permit persons to whom the Software is
  16. * furnished to do so, under the terms of the COPYING file.
  17. *
  18. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. * KIND, either express or implied.
  20. *
  21. * SPDX-License-Identifier: curl
  22. *
  23. ***************************************************************************/
  24. #include "curl_setup.h"
  25. #if defined(USE_SECTRANSP) || defined(USE_MBEDTLS) || \
  26. defined(USE_BEARSSL) || defined(USE_RUSTLS)
  27. #include "cipher_suite.h"
  28. #include "curl_printf.h"
  29. #include "strcase.h"
  30. #include <string.h>
  31. /*
  32. * To support the CURLOPT_SSL_CIPHER_LIST option on SSL backends
  33. * that do not support it natively, but do support setting a list of
  34. * IANA ids, we need a list of all supported cipher suite names
  35. * (OpenSSL and IANA) to be able to look up the IANA ids.
  36. *
  37. * To keep the binary size of this list down we compress each entry
  38. * down to 2 + 6 bytes using the C preprocessor.
  39. */
  40. /*
  41. * mbedTLS NOTE: mbedTLS has mbedtls_ssl_get_ciphersuite_id() to
  42. * convert a string representation to an IANA id, we do not use that
  43. * because it does not support "standard" OpenSSL cipher suite
  44. * names, nor IANA names.
  45. */
  46. /* NOTE: also see tests/unit/unit3205.c */
  47. /* Text for cipher suite parts (max 64 entries),
  48. keep indexes below in sync with this! */
  49. static const char *cs_txt =
  50. "\0"
  51. "TLS" "\0"
  52. "WITH" "\0"
  53. "128" "\0"
  54. "256" "\0"
  55. "3DES" "\0"
  56. "8" "\0"
  57. "AES" "\0"
  58. "AES128" "\0"
  59. "AES256" "\0"
  60. "CBC" "\0"
  61. "CBC3" "\0"
  62. "CCM" "\0"
  63. "CCM8" "\0"
  64. "CHACHA20" "\0"
  65. "DES" "\0"
  66. "DHE" "\0"
  67. "ECDH" "\0"
  68. "ECDHE" "\0"
  69. "ECDSA" "\0"
  70. "EDE" "\0"
  71. "GCM" "\0"
  72. "MD5" "\0"
  73. "NULL" "\0"
  74. "POLY1305" "\0"
  75. "PSK" "\0"
  76. "RSA" "\0"
  77. "SHA" "\0"
  78. "SHA256" "\0"
  79. "SHA384" "\0"
  80. #if defined(USE_MBEDTLS)
  81. "ARIA" "\0"
  82. "ARIA128" "\0"
  83. "ARIA256" "\0"
  84. "CAMELLIA" "\0"
  85. "CAMELLIA128" "\0"
  86. "CAMELLIA256" "\0"
  87. #endif
  88. #if defined(USE_SECTRANSP)
  89. "40" "\0"
  90. "ADH" "\0"
  91. "AECDH" "\0"
  92. "anon" "\0"
  93. "DES40" "\0"
  94. "DH" "\0"
  95. "DSS" "\0"
  96. "EDH" "\0"
  97. "EXP" "\0"
  98. "EXPORT" "\0"
  99. "IDEA" "\0"
  100. "RC2" "\0"
  101. "RC4" "\0"
  102. #endif
  103. ;
  104. /* Indexes of above cs_txt */
  105. enum {
  106. CS_TXT_IDX_,
  107. CS_TXT_IDX_TLS,
  108. CS_TXT_IDX_WITH,
  109. CS_TXT_IDX_128,
  110. CS_TXT_IDX_256,
  111. CS_TXT_IDX_3DES,
  112. CS_TXT_IDX_8,
  113. CS_TXT_IDX_AES,
  114. CS_TXT_IDX_AES128,
  115. CS_TXT_IDX_AES256,
  116. CS_TXT_IDX_CBC,
  117. CS_TXT_IDX_CBC3,
  118. CS_TXT_IDX_CCM,
  119. CS_TXT_IDX_CCM8,
  120. CS_TXT_IDX_CHACHA20,
  121. CS_TXT_IDX_DES,
  122. CS_TXT_IDX_DHE,
  123. CS_TXT_IDX_ECDH,
  124. CS_TXT_IDX_ECDHE,
  125. CS_TXT_IDX_ECDSA,
  126. CS_TXT_IDX_EDE,
  127. CS_TXT_IDX_GCM,
  128. CS_TXT_IDX_MD5,
  129. CS_TXT_IDX_NULL,
  130. CS_TXT_IDX_POLY1305,
  131. CS_TXT_IDX_PSK,
  132. CS_TXT_IDX_RSA,
  133. CS_TXT_IDX_SHA,
  134. CS_TXT_IDX_SHA256,
  135. CS_TXT_IDX_SHA384,
  136. #if defined(USE_MBEDTLS)
  137. CS_TXT_IDX_ARIA,
  138. CS_TXT_IDX_ARIA128,
  139. CS_TXT_IDX_ARIA256,
  140. CS_TXT_IDX_CAMELLIA,
  141. CS_TXT_IDX_CAMELLIA128,
  142. CS_TXT_IDX_CAMELLIA256,
  143. #endif
  144. #if defined(USE_SECTRANSP)
  145. CS_TXT_IDX_40,
  146. CS_TXT_IDX_ADH,
  147. CS_TXT_IDX_AECDH,
  148. CS_TXT_IDX_anon,
  149. CS_TXT_IDX_DES40,
  150. CS_TXT_IDX_DH,
  151. CS_TXT_IDX_DSS,
  152. CS_TXT_IDX_EDH,
  153. CS_TXT_IDX_EXP,
  154. CS_TXT_IDX_EXPORT,
  155. CS_TXT_IDX_IDEA,
  156. CS_TXT_IDX_RC2,
  157. CS_TXT_IDX_RC4,
  158. #endif
  159. CS_TXT_LEN,
  160. };
  161. #define CS_ZIP_IDX(a, b, c, d, e, f, g, h) \
  162. { \
  163. (uint8_t) ((((a) << 2) & 0xFF) | ((b) & 0x3F) >> 4), \
  164. (uint8_t) ((((b) << 4) & 0xFF) | ((c) & 0x3F) >> 2), \
  165. (uint8_t) ((((c) << 6) & 0xFF) | ((d) & 0x3F)), \
  166. (uint8_t) ((((e) << 2) & 0xFF) | ((f) & 0x3F) >> 4), \
  167. (uint8_t) ((((f) << 4) & 0xFF) | ((g) & 0x3F) >> 2), \
  168. (uint8_t) ((((g) << 6) & 0xFF) | ((h) & 0x3F)) \
  169. }
  170. #define CS_ENTRY(id, a, b, c, d, e, f, g, h) \
  171. { \
  172. id, \
  173. CS_ZIP_IDX( \
  174. CS_TXT_IDX_ ## a, CS_TXT_IDX_ ## b, \
  175. CS_TXT_IDX_ ## c, CS_TXT_IDX_ ## d, \
  176. CS_TXT_IDX_ ## e, CS_TXT_IDX_ ## f, \
  177. CS_TXT_IDX_ ## g, CS_TXT_IDX_ ## h \
  178. ) \
  179. }
  180. struct cs_entry {
  181. uint16_t id;
  182. uint8_t zip[6];
  183. };
  184. /* !checksrc! disable COMMANOSPACE all */
  185. static const struct cs_entry cs_list [] = {
  186. /* TLS 1.3 ciphers */
  187. #if defined(USE_SECTRANSP) || defined(USE_MBEDTLS) || defined(USE_RUSTLS)
  188. CS_ENTRY(0x1301, TLS,AES,128,GCM,SHA256,,,),
  189. CS_ENTRY(0x1302, TLS,AES,256,GCM,SHA384,,,),
  190. CS_ENTRY(0x1303, TLS,CHACHA20,POLY1305,SHA256,,,,),
  191. CS_ENTRY(0x1304, TLS,AES,128,CCM,SHA256,,,),
  192. CS_ENTRY(0x1305, TLS,AES,128,CCM,8,SHA256,,),
  193. #endif
  194. /* TLS 1.2 ciphers */
  195. CS_ENTRY(0xC02B, TLS,ECDHE,ECDSA,WITH,AES,128,GCM,SHA256),
  196. CS_ENTRY(0xC02B, ECDHE,ECDSA,AES128,GCM,SHA256,,,),
  197. CS_ENTRY(0xC02C, TLS,ECDHE,ECDSA,WITH,AES,256,GCM,SHA384),
  198. CS_ENTRY(0xC02C, ECDHE,ECDSA,AES256,GCM,SHA384,,,),
  199. CS_ENTRY(0xC02F, TLS,ECDHE,RSA,WITH,AES,128,GCM,SHA256),
  200. CS_ENTRY(0xC02F, ECDHE,RSA,AES128,GCM,SHA256,,,),
  201. CS_ENTRY(0xC030, TLS,ECDHE,RSA,WITH,AES,256,GCM,SHA384),
  202. CS_ENTRY(0xC030, ECDHE,RSA,AES256,GCM,SHA384,,,),
  203. CS_ENTRY(0xCCA8, TLS,ECDHE,RSA,WITH,CHACHA20,POLY1305,SHA256,),
  204. CS_ENTRY(0xCCA8, ECDHE,RSA,CHACHA20,POLY1305,,,,),
  205. CS_ENTRY(0xCCA9, TLS,ECDHE,ECDSA,WITH,CHACHA20,POLY1305,SHA256,),
  206. CS_ENTRY(0xCCA9, ECDHE,ECDSA,CHACHA20,POLY1305,,,,),
  207. #if defined(USE_SECTRANSP) || defined(USE_MBEDTLS) || defined(USE_BEARSSL)
  208. CS_ENTRY(0x002F, TLS,RSA,WITH,AES,128,CBC,SHA,),
  209. CS_ENTRY(0x002F, AES128,SHA,,,,,,),
  210. CS_ENTRY(0x0035, TLS,RSA,WITH,AES,256,CBC,SHA,),
  211. CS_ENTRY(0x0035, AES256,SHA,,,,,,),
  212. CS_ENTRY(0x003C, TLS,RSA,WITH,AES,128,CBC,SHA256,),
  213. CS_ENTRY(0x003C, AES128,SHA256,,,,,,),
  214. CS_ENTRY(0x003D, TLS,RSA,WITH,AES,256,CBC,SHA256,),
  215. CS_ENTRY(0x003D, AES256,SHA256,,,,,,),
  216. CS_ENTRY(0x009C, TLS,RSA,WITH,AES,128,GCM,SHA256,),
  217. CS_ENTRY(0x009C, AES128,GCM,SHA256,,,,,),
  218. CS_ENTRY(0x009D, TLS,RSA,WITH,AES,256,GCM,SHA384,),
  219. CS_ENTRY(0x009D, AES256,GCM,SHA384,,,,,),
  220. CS_ENTRY(0xC004, TLS,ECDH,ECDSA,WITH,AES,128,CBC,SHA),
  221. CS_ENTRY(0xC004, ECDH,ECDSA,AES128,SHA,,,,),
  222. CS_ENTRY(0xC005, TLS,ECDH,ECDSA,WITH,AES,256,CBC,SHA),
  223. CS_ENTRY(0xC005, ECDH,ECDSA,AES256,SHA,,,,),
  224. CS_ENTRY(0xC009, TLS,ECDHE,ECDSA,WITH,AES,128,CBC,SHA),
  225. CS_ENTRY(0xC009, ECDHE,ECDSA,AES128,SHA,,,,),
  226. CS_ENTRY(0xC00A, TLS,ECDHE,ECDSA,WITH,AES,256,CBC,SHA),
  227. CS_ENTRY(0xC00A, ECDHE,ECDSA,AES256,SHA,,,,),
  228. CS_ENTRY(0xC00E, TLS,ECDH,RSA,WITH,AES,128,CBC,SHA),
  229. CS_ENTRY(0xC00E, ECDH,RSA,AES128,SHA,,,,),
  230. CS_ENTRY(0xC00F, TLS,ECDH,RSA,WITH,AES,256,CBC,SHA),
  231. CS_ENTRY(0xC00F, ECDH,RSA,AES256,SHA,,,,),
  232. CS_ENTRY(0xC013, TLS,ECDHE,RSA,WITH,AES,128,CBC,SHA),
  233. CS_ENTRY(0xC013, ECDHE,RSA,AES128,SHA,,,,),
  234. CS_ENTRY(0xC014, TLS,ECDHE,RSA,WITH,AES,256,CBC,SHA),
  235. CS_ENTRY(0xC014, ECDHE,RSA,AES256,SHA,,,,),
  236. CS_ENTRY(0xC023, TLS,ECDHE,ECDSA,WITH,AES,128,CBC,SHA256),
  237. CS_ENTRY(0xC023, ECDHE,ECDSA,AES128,SHA256,,,,),
  238. CS_ENTRY(0xC024, TLS,ECDHE,ECDSA,WITH,AES,256,CBC,SHA384),
  239. CS_ENTRY(0xC024, ECDHE,ECDSA,AES256,SHA384,,,,),
  240. CS_ENTRY(0xC025, TLS,ECDH,ECDSA,WITH,AES,128,CBC,SHA256),
  241. CS_ENTRY(0xC025, ECDH,ECDSA,AES128,SHA256,,,,),
  242. CS_ENTRY(0xC026, TLS,ECDH,ECDSA,WITH,AES,256,CBC,SHA384),
  243. CS_ENTRY(0xC026, ECDH,ECDSA,AES256,SHA384,,,,),
  244. CS_ENTRY(0xC027, TLS,ECDHE,RSA,WITH,AES,128,CBC,SHA256),
  245. CS_ENTRY(0xC027, ECDHE,RSA,AES128,SHA256,,,,),
  246. CS_ENTRY(0xC028, TLS,ECDHE,RSA,WITH,AES,256,CBC,SHA384),
  247. CS_ENTRY(0xC028, ECDHE,RSA,AES256,SHA384,,,,),
  248. CS_ENTRY(0xC029, TLS,ECDH,RSA,WITH,AES,128,CBC,SHA256),
  249. CS_ENTRY(0xC029, ECDH,RSA,AES128,SHA256,,,,),
  250. CS_ENTRY(0xC02A, TLS,ECDH,RSA,WITH,AES,256,CBC,SHA384),
  251. CS_ENTRY(0xC02A, ECDH,RSA,AES256,SHA384,,,,),
  252. CS_ENTRY(0xC02D, TLS,ECDH,ECDSA,WITH,AES,128,GCM,SHA256),
  253. CS_ENTRY(0xC02D, ECDH,ECDSA,AES128,GCM,SHA256,,,),
  254. CS_ENTRY(0xC02E, TLS,ECDH,ECDSA,WITH,AES,256,GCM,SHA384),
  255. CS_ENTRY(0xC02E, ECDH,ECDSA,AES256,GCM,SHA384,,,),
  256. CS_ENTRY(0xC031, TLS,ECDH,RSA,WITH,AES,128,GCM,SHA256),
  257. CS_ENTRY(0xC031, ECDH,RSA,AES128,GCM,SHA256,,,),
  258. CS_ENTRY(0xC032, TLS,ECDH,RSA,WITH,AES,256,GCM,SHA384),
  259. CS_ENTRY(0xC032, ECDH,RSA,AES256,GCM,SHA384,,,),
  260. #endif
  261. #if defined(USE_SECTRANSP) || defined(USE_MBEDTLS)
  262. CS_ENTRY(0x0001, TLS,RSA,WITH,NULL,MD5,,,),
  263. CS_ENTRY(0x0001, NULL,MD5,,,,,,),
  264. CS_ENTRY(0x0002, TLS,RSA,WITH,NULL,SHA,,,),
  265. CS_ENTRY(0x0002, NULL,SHA,,,,,,),
  266. CS_ENTRY(0x002C, TLS,PSK,WITH,NULL,SHA,,,),
  267. CS_ENTRY(0x002C, PSK,NULL,SHA,,,,,),
  268. CS_ENTRY(0x002D, TLS,DHE,PSK,WITH,NULL,SHA,,),
  269. CS_ENTRY(0x002D, DHE,PSK,NULL,SHA,,,,),
  270. CS_ENTRY(0x002E, TLS,RSA,PSK,WITH,NULL,SHA,,),
  271. CS_ENTRY(0x002E, RSA,PSK,NULL,SHA,,,,),
  272. CS_ENTRY(0x0033, TLS,DHE,RSA,WITH,AES,128,CBC,SHA),
  273. CS_ENTRY(0x0033, DHE,RSA,AES128,SHA,,,,),
  274. CS_ENTRY(0x0039, TLS,DHE,RSA,WITH,AES,256,CBC,SHA),
  275. CS_ENTRY(0x0039, DHE,RSA,AES256,SHA,,,,),
  276. CS_ENTRY(0x003B, TLS,RSA,WITH,NULL,SHA256,,,),
  277. CS_ENTRY(0x003B, NULL,SHA256,,,,,,),
  278. CS_ENTRY(0x0067, TLS,DHE,RSA,WITH,AES,128,CBC,SHA256),
  279. CS_ENTRY(0x0067, DHE,RSA,AES128,SHA256,,,,),
  280. CS_ENTRY(0x006B, TLS,DHE,RSA,WITH,AES,256,CBC,SHA256),
  281. CS_ENTRY(0x006B, DHE,RSA,AES256,SHA256,,,,),
  282. CS_ENTRY(0x008C, TLS,PSK,WITH,AES,128,CBC,SHA,),
  283. CS_ENTRY(0x008C, PSK,AES128,CBC,SHA,,,,),
  284. CS_ENTRY(0x008D, TLS,PSK,WITH,AES,256,CBC,SHA,),
  285. CS_ENTRY(0x008D, PSK,AES256,CBC,SHA,,,,),
  286. CS_ENTRY(0x0090, TLS,DHE,PSK,WITH,AES,128,CBC,SHA),
  287. CS_ENTRY(0x0090, DHE,PSK,AES128,CBC,SHA,,,),
  288. CS_ENTRY(0x0091, TLS,DHE,PSK,WITH,AES,256,CBC,SHA),
  289. CS_ENTRY(0x0091, DHE,PSK,AES256,CBC,SHA,,,),
  290. CS_ENTRY(0x0094, TLS,RSA,PSK,WITH,AES,128,CBC,SHA),
  291. CS_ENTRY(0x0094, RSA,PSK,AES128,CBC,SHA,,,),
  292. CS_ENTRY(0x0095, TLS,RSA,PSK,WITH,AES,256,CBC,SHA),
  293. CS_ENTRY(0x0095, RSA,PSK,AES256,CBC,SHA,,,),
  294. CS_ENTRY(0x009E, TLS,DHE,RSA,WITH,AES,128,GCM,SHA256),
  295. CS_ENTRY(0x009E, DHE,RSA,AES128,GCM,SHA256,,,),
  296. CS_ENTRY(0x009F, TLS,DHE,RSA,WITH,AES,256,GCM,SHA384),
  297. CS_ENTRY(0x009F, DHE,RSA,AES256,GCM,SHA384,,,),
  298. CS_ENTRY(0x00A8, TLS,PSK,WITH,AES,128,GCM,SHA256,),
  299. CS_ENTRY(0x00A8, PSK,AES128,GCM,SHA256,,,,),
  300. CS_ENTRY(0x00A9, TLS,PSK,WITH,AES,256,GCM,SHA384,),
  301. CS_ENTRY(0x00A9, PSK,AES256,GCM,SHA384,,,,),
  302. CS_ENTRY(0x00AA, TLS,DHE,PSK,WITH,AES,128,GCM,SHA256),
  303. CS_ENTRY(0x00AA, DHE,PSK,AES128,GCM,SHA256,,,),
  304. CS_ENTRY(0x00AB, TLS,DHE,PSK,WITH,AES,256,GCM,SHA384),
  305. CS_ENTRY(0x00AB, DHE,PSK,AES256,GCM,SHA384,,,),
  306. CS_ENTRY(0x00AC, TLS,RSA,PSK,WITH,AES,128,GCM,SHA256),
  307. CS_ENTRY(0x00AC, RSA,PSK,AES128,GCM,SHA256,,,),
  308. CS_ENTRY(0x00AD, TLS,RSA,PSK,WITH,AES,256,GCM,SHA384),
  309. CS_ENTRY(0x00AD, RSA,PSK,AES256,GCM,SHA384,,,),
  310. CS_ENTRY(0x00AE, TLS,PSK,WITH,AES,128,CBC,SHA256,),
  311. CS_ENTRY(0x00AE, PSK,AES128,CBC,SHA256,,,,),
  312. CS_ENTRY(0x00AF, TLS,PSK,WITH,AES,256,CBC,SHA384,),
  313. CS_ENTRY(0x00AF, PSK,AES256,CBC,SHA384,,,,),
  314. CS_ENTRY(0x00B0, TLS,PSK,WITH,NULL,SHA256,,,),
  315. CS_ENTRY(0x00B0, PSK,NULL,SHA256,,,,,),
  316. CS_ENTRY(0x00B1, TLS,PSK,WITH,NULL,SHA384,,,),
  317. CS_ENTRY(0x00B1, PSK,NULL,SHA384,,,,,),
  318. CS_ENTRY(0x00B2, TLS,DHE,PSK,WITH,AES,128,CBC,SHA256),
  319. CS_ENTRY(0x00B2, DHE,PSK,AES128,CBC,SHA256,,,),
  320. CS_ENTRY(0x00B3, TLS,DHE,PSK,WITH,AES,256,CBC,SHA384),
  321. CS_ENTRY(0x00B3, DHE,PSK,AES256,CBC,SHA384,,,),
  322. CS_ENTRY(0x00B4, TLS,DHE,PSK,WITH,NULL,SHA256,,),
  323. CS_ENTRY(0x00B4, DHE,PSK,NULL,SHA256,,,,),
  324. CS_ENTRY(0x00B5, TLS,DHE,PSK,WITH,NULL,SHA384,,),
  325. CS_ENTRY(0x00B5, DHE,PSK,NULL,SHA384,,,,),
  326. CS_ENTRY(0x00B6, TLS,RSA,PSK,WITH,AES,128,CBC,SHA256),
  327. CS_ENTRY(0x00B6, RSA,PSK,AES128,CBC,SHA256,,,),
  328. CS_ENTRY(0x00B7, TLS,RSA,PSK,WITH,AES,256,CBC,SHA384),
  329. CS_ENTRY(0x00B7, RSA,PSK,AES256,CBC,SHA384,,,),
  330. CS_ENTRY(0x00B8, TLS,RSA,PSK,WITH,NULL,SHA256,,),
  331. CS_ENTRY(0x00B8, RSA,PSK,NULL,SHA256,,,,),
  332. CS_ENTRY(0x00B9, TLS,RSA,PSK,WITH,NULL,SHA384,,),
  333. CS_ENTRY(0x00B9, RSA,PSK,NULL,SHA384,,,,),
  334. CS_ENTRY(0xC001, TLS,ECDH,ECDSA,WITH,NULL,SHA,,),
  335. CS_ENTRY(0xC001, ECDH,ECDSA,NULL,SHA,,,,),
  336. CS_ENTRY(0xC006, TLS,ECDHE,ECDSA,WITH,NULL,SHA,,),
  337. CS_ENTRY(0xC006, ECDHE,ECDSA,NULL,SHA,,,,),
  338. CS_ENTRY(0xC00B, TLS,ECDH,RSA,WITH,NULL,SHA,,),
  339. CS_ENTRY(0xC00B, ECDH,RSA,NULL,SHA,,,,),
  340. CS_ENTRY(0xC010, TLS,ECDHE,RSA,WITH,NULL,SHA,,),
  341. CS_ENTRY(0xC010, ECDHE,RSA,NULL,SHA,,,,),
  342. CS_ENTRY(0xC035, TLS,ECDHE,PSK,WITH,AES,128,CBC,SHA),
  343. CS_ENTRY(0xC035, ECDHE,PSK,AES128,CBC,SHA,,,),
  344. CS_ENTRY(0xC036, TLS,ECDHE,PSK,WITH,AES,256,CBC,SHA),
  345. CS_ENTRY(0xC036, ECDHE,PSK,AES256,CBC,SHA,,,),
  346. CS_ENTRY(0xCCAB, TLS,PSK,WITH,CHACHA20,POLY1305,SHA256,,),
  347. CS_ENTRY(0xCCAB, PSK,CHACHA20,POLY1305,,,,,),
  348. #endif
  349. #if defined(USE_SECTRANSP) || defined(USE_BEARSSL)
  350. CS_ENTRY(0x000A, TLS,RSA,WITH,3DES,EDE,CBC,SHA,),
  351. CS_ENTRY(0x000A, DES,CBC3,SHA,,,,,),
  352. CS_ENTRY(0xC003, TLS,ECDH,ECDSA,WITH,3DES,EDE,CBC,SHA),
  353. CS_ENTRY(0xC003, ECDH,ECDSA,DES,CBC3,SHA,,,),
  354. CS_ENTRY(0xC008, TLS,ECDHE,ECDSA,WITH,3DES,EDE,CBC,SHA),
  355. CS_ENTRY(0xC008, ECDHE,ECDSA,DES,CBC3,SHA,,,),
  356. CS_ENTRY(0xC00D, TLS,ECDH,RSA,WITH,3DES,EDE,CBC,SHA),
  357. CS_ENTRY(0xC00D, ECDH,RSA,DES,CBC3,SHA,,,),
  358. CS_ENTRY(0xC012, TLS,ECDHE,RSA,WITH,3DES,EDE,CBC,SHA),
  359. CS_ENTRY(0xC012, ECDHE,RSA,DES,CBC3,SHA,,,),
  360. #endif
  361. #if defined(USE_MBEDTLS) || defined(USE_BEARSSL)
  362. CS_ENTRY(0xC09C, TLS,RSA,WITH,AES,128,CCM,,),
  363. CS_ENTRY(0xC09C, AES128,CCM,,,,,,),
  364. CS_ENTRY(0xC09D, TLS,RSA,WITH,AES,256,CCM,,),
  365. CS_ENTRY(0xC09D, AES256,CCM,,,,,,),
  366. CS_ENTRY(0xC0A0, TLS,RSA,WITH,AES,128,CCM,8,),
  367. CS_ENTRY(0xC0A0, AES128,CCM8,,,,,,),
  368. CS_ENTRY(0xC0A1, TLS,RSA,WITH,AES,256,CCM,8,),
  369. CS_ENTRY(0xC0A1, AES256,CCM8,,,,,,),
  370. CS_ENTRY(0xC0AC, TLS,ECDHE,ECDSA,WITH,AES,128,CCM,),
  371. CS_ENTRY(0xC0AC, ECDHE,ECDSA,AES128,CCM,,,,),
  372. CS_ENTRY(0xC0AD, TLS,ECDHE,ECDSA,WITH,AES,256,CCM,),
  373. CS_ENTRY(0xC0AD, ECDHE,ECDSA,AES256,CCM,,,,),
  374. CS_ENTRY(0xC0AE, TLS,ECDHE,ECDSA,WITH,AES,128,CCM,8),
  375. CS_ENTRY(0xC0AE, ECDHE,ECDSA,AES128,CCM8,,,,),
  376. CS_ENTRY(0xC0AF, TLS,ECDHE,ECDSA,WITH,AES,256,CCM,8),
  377. CS_ENTRY(0xC0AF, ECDHE,ECDSA,AES256,CCM8,,,,),
  378. #endif
  379. #if defined(USE_SECTRANSP)
  380. /* entries marked bc are backward compatible aliases for old OpenSSL names */
  381. CS_ENTRY(0x0003, TLS,RSA,EXPORT,WITH,RC4,40,MD5,),
  382. CS_ENTRY(0x0003, EXP,RC4,MD5,,,,,),
  383. CS_ENTRY(0x0004, TLS,RSA,WITH,RC4,128,MD5,,),
  384. CS_ENTRY(0x0004, RC4,MD5,,,,,,),
  385. CS_ENTRY(0x0005, TLS,RSA,WITH,RC4,128,SHA,,),
  386. CS_ENTRY(0x0005, RC4,SHA,,,,,,),
  387. CS_ENTRY(0x0006, TLS,RSA,EXPORT,WITH,RC2,CBC,40,MD5),
  388. CS_ENTRY(0x0006, EXP,RC2,CBC,MD5,,,,),
  389. CS_ENTRY(0x0007, TLS,RSA,WITH,IDEA,CBC,SHA,,),
  390. CS_ENTRY(0x0007, IDEA,CBC,SHA,,,,,),
  391. CS_ENTRY(0x0008, TLS,RSA,EXPORT,WITH,DES40,CBC,SHA,),
  392. CS_ENTRY(0x0008, EXP,DES,CBC,SHA,,,,),
  393. CS_ENTRY(0x0009, TLS,RSA,WITH,DES,CBC,SHA,,),
  394. CS_ENTRY(0x0009, DES,CBC,SHA,,,,,),
  395. CS_ENTRY(0x000B, TLS,DH,DSS,EXPORT,WITH,DES40,CBC,SHA),
  396. CS_ENTRY(0x000B, EXP,DH,DSS,DES,CBC,SHA,,),
  397. CS_ENTRY(0x000C, TLS,DH,DSS,WITH,DES,CBC,SHA,),
  398. CS_ENTRY(0x000C, DH,DSS,DES,CBC,SHA,,,),
  399. CS_ENTRY(0x000D, TLS,DH,DSS,WITH,3DES,EDE,CBC,SHA),
  400. CS_ENTRY(0x000D, DH,DSS,DES,CBC3,SHA,,,),
  401. CS_ENTRY(0x000E, TLS,DH,RSA,EXPORT,WITH,DES40,CBC,SHA),
  402. CS_ENTRY(0x000E, EXP,DH,RSA,DES,CBC,SHA,,),
  403. CS_ENTRY(0x000F, TLS,DH,RSA,WITH,DES,CBC,SHA,),
  404. CS_ENTRY(0x000F, DH,RSA,DES,CBC,SHA,,,),
  405. CS_ENTRY(0x0010, TLS,DH,RSA,WITH,3DES,EDE,CBC,SHA),
  406. CS_ENTRY(0x0010, DH,RSA,DES,CBC3,SHA,,,),
  407. CS_ENTRY(0x0011, TLS,DHE,DSS,EXPORT,WITH,DES40,CBC,SHA),
  408. CS_ENTRY(0x0011, EXP,DHE,DSS,DES,CBC,SHA,,),
  409. CS_ENTRY(0x0011, EXP,EDH,DSS,DES,CBC,SHA,,), /* bc */
  410. CS_ENTRY(0x0012, TLS,DHE,DSS,WITH,DES,CBC,SHA,),
  411. CS_ENTRY(0x0012, DHE,DSS,DES,CBC,SHA,,,),
  412. CS_ENTRY(0x0012, EDH,DSS,DES,CBC,SHA,,,), /* bc */
  413. CS_ENTRY(0x0013, TLS,DHE,DSS,WITH,3DES,EDE,CBC,SHA),
  414. CS_ENTRY(0x0013, DHE,DSS,DES,CBC3,SHA,,,),
  415. CS_ENTRY(0x0013, EDH,DSS,DES,CBC3,SHA,,,), /* bc */
  416. CS_ENTRY(0x0014, TLS,DHE,RSA,EXPORT,WITH,DES40,CBC,SHA),
  417. CS_ENTRY(0x0014, EXP,DHE,RSA,DES,CBC,SHA,,),
  418. CS_ENTRY(0x0014, EXP,EDH,RSA,DES,CBC,SHA,,), /* bc */
  419. CS_ENTRY(0x0015, TLS,DHE,RSA,WITH,DES,CBC,SHA,),
  420. CS_ENTRY(0x0015, DHE,RSA,DES,CBC,SHA,,,),
  421. CS_ENTRY(0x0015, EDH,RSA,DES,CBC,SHA,,,), /* bc */
  422. CS_ENTRY(0x0016, TLS,DHE,RSA,WITH,3DES,EDE,CBC,SHA),
  423. CS_ENTRY(0x0016, DHE,RSA,DES,CBC3,SHA,,,),
  424. CS_ENTRY(0x0016, EDH,RSA,DES,CBC3,SHA,,,), /* bc */
  425. CS_ENTRY(0x0017, TLS,DH,anon,EXPORT,WITH,RC4,40,MD5),
  426. CS_ENTRY(0x0017, EXP,ADH,RC4,MD5,,,,),
  427. CS_ENTRY(0x0018, TLS,DH,anon,WITH,RC4,128,MD5,),
  428. CS_ENTRY(0x0018, ADH,RC4,MD5,,,,,),
  429. CS_ENTRY(0x0019, TLS,DH,anon,EXPORT,WITH,DES40,CBC,SHA),
  430. CS_ENTRY(0x0019, EXP,ADH,DES,CBC,SHA,,,),
  431. CS_ENTRY(0x001A, TLS,DH,anon,WITH,DES,CBC,SHA,),
  432. CS_ENTRY(0x001A, ADH,DES,CBC,SHA,,,,),
  433. CS_ENTRY(0x001B, TLS,DH,anon,WITH,3DES,EDE,CBC,SHA),
  434. CS_ENTRY(0x001B, ADH,DES,CBC3,SHA,,,,),
  435. CS_ENTRY(0x0030, TLS,DH,DSS,WITH,AES,128,CBC,SHA),
  436. CS_ENTRY(0x0030, DH,DSS,AES128,SHA,,,,),
  437. CS_ENTRY(0x0031, TLS,DH,RSA,WITH,AES,128,CBC,SHA),
  438. CS_ENTRY(0x0031, DH,RSA,AES128,SHA,,,,),
  439. CS_ENTRY(0x0032, TLS,DHE,DSS,WITH,AES,128,CBC,SHA),
  440. CS_ENTRY(0x0032, DHE,DSS,AES128,SHA,,,,),
  441. CS_ENTRY(0x0034, TLS,DH,anon,WITH,AES,128,CBC,SHA),
  442. CS_ENTRY(0x0034, ADH,AES128,SHA,,,,,),
  443. CS_ENTRY(0x0036, TLS,DH,DSS,WITH,AES,256,CBC,SHA),
  444. CS_ENTRY(0x0036, DH,DSS,AES256,SHA,,,,),
  445. CS_ENTRY(0x0037, TLS,DH,RSA,WITH,AES,256,CBC,SHA),
  446. CS_ENTRY(0x0037, DH,RSA,AES256,SHA,,,,),
  447. CS_ENTRY(0x0038, TLS,DHE,DSS,WITH,AES,256,CBC,SHA),
  448. CS_ENTRY(0x0038, DHE,DSS,AES256,SHA,,,,),
  449. CS_ENTRY(0x003A, TLS,DH,anon,WITH,AES,256,CBC,SHA),
  450. CS_ENTRY(0x003A, ADH,AES256,SHA,,,,,),
  451. CS_ENTRY(0x003E, TLS,DH,DSS,WITH,AES,128,CBC,SHA256),
  452. CS_ENTRY(0x003E, DH,DSS,AES128,SHA256,,,,),
  453. CS_ENTRY(0x003F, TLS,DH,RSA,WITH,AES,128,CBC,SHA256),
  454. CS_ENTRY(0x003F, DH,RSA,AES128,SHA256,,,,),
  455. CS_ENTRY(0x0040, TLS,DHE,DSS,WITH,AES,128,CBC,SHA256),
  456. CS_ENTRY(0x0040, DHE,DSS,AES128,SHA256,,,,),
  457. CS_ENTRY(0x0068, TLS,DH,DSS,WITH,AES,256,CBC,SHA256),
  458. CS_ENTRY(0x0068, DH,DSS,AES256,SHA256,,,,),
  459. CS_ENTRY(0x0069, TLS,DH,RSA,WITH,AES,256,CBC,SHA256),
  460. CS_ENTRY(0x0069, DH,RSA,AES256,SHA256,,,,),
  461. CS_ENTRY(0x006A, TLS,DHE,DSS,WITH,AES,256,CBC,SHA256),
  462. CS_ENTRY(0x006A, DHE,DSS,AES256,SHA256,,,,),
  463. CS_ENTRY(0x006C, TLS,DH,anon,WITH,AES,128,CBC,SHA256),
  464. CS_ENTRY(0x006C, ADH,AES128,SHA256,,,,,),
  465. CS_ENTRY(0x006D, TLS,DH,anon,WITH,AES,256,CBC,SHA256),
  466. CS_ENTRY(0x006D, ADH,AES256,SHA256,,,,,),
  467. CS_ENTRY(0x008A, TLS,PSK,WITH,RC4,128,SHA,,),
  468. CS_ENTRY(0x008A, PSK,RC4,SHA,,,,,),
  469. CS_ENTRY(0x008B, TLS,PSK,WITH,3DES,EDE,CBC,SHA,),
  470. CS_ENTRY(0x008B, PSK,3DES,EDE,CBC,SHA,,,),
  471. CS_ENTRY(0x008E, TLS,DHE,PSK,WITH,RC4,128,SHA,),
  472. CS_ENTRY(0x008E, DHE,PSK,RC4,SHA,,,,),
  473. CS_ENTRY(0x008F, TLS,DHE,PSK,WITH,3DES,EDE,CBC,SHA),
  474. CS_ENTRY(0x008F, DHE,PSK,3DES,EDE,CBC,SHA,,),
  475. CS_ENTRY(0x0092, TLS,RSA,PSK,WITH,RC4,128,SHA,),
  476. CS_ENTRY(0x0092, RSA,PSK,RC4,SHA,,,,),
  477. CS_ENTRY(0x0093, TLS,RSA,PSK,WITH,3DES,EDE,CBC,SHA),
  478. CS_ENTRY(0x0093, RSA,PSK,3DES,EDE,CBC,SHA,,),
  479. CS_ENTRY(0x00A0, TLS,DH,RSA,WITH,AES,128,GCM,SHA256),
  480. CS_ENTRY(0x00A0, DH,RSA,AES128,GCM,SHA256,,,),
  481. CS_ENTRY(0x00A1, TLS,DH,RSA,WITH,AES,256,GCM,SHA384),
  482. CS_ENTRY(0x00A1, DH,RSA,AES256,GCM,SHA384,,,),
  483. CS_ENTRY(0x00A2, TLS,DHE,DSS,WITH,AES,128,GCM,SHA256),
  484. CS_ENTRY(0x00A2, DHE,DSS,AES128,GCM,SHA256,,,),
  485. CS_ENTRY(0x00A3, TLS,DHE,DSS,WITH,AES,256,GCM,SHA384),
  486. CS_ENTRY(0x00A3, DHE,DSS,AES256,GCM,SHA384,,,),
  487. CS_ENTRY(0x00A4, TLS,DH,DSS,WITH,AES,128,GCM,SHA256),
  488. CS_ENTRY(0x00A4, DH,DSS,AES128,GCM,SHA256,,,),
  489. CS_ENTRY(0x00A5, TLS,DH,DSS,WITH,AES,256,GCM,SHA384),
  490. CS_ENTRY(0x00A5, DH,DSS,AES256,GCM,SHA384,,,),
  491. CS_ENTRY(0x00A6, TLS,DH,anon,WITH,AES,128,GCM,SHA256),
  492. CS_ENTRY(0x00A6, ADH,AES128,GCM,SHA256,,,,),
  493. CS_ENTRY(0x00A7, TLS,DH,anon,WITH,AES,256,GCM,SHA384),
  494. CS_ENTRY(0x00A7, ADH,AES256,GCM,SHA384,,,,),
  495. CS_ENTRY(0xC002, TLS,ECDH,ECDSA,WITH,RC4,128,SHA,),
  496. CS_ENTRY(0xC002, ECDH,ECDSA,RC4,SHA,,,,),
  497. CS_ENTRY(0xC007, TLS,ECDHE,ECDSA,WITH,RC4,128,SHA,),
  498. CS_ENTRY(0xC007, ECDHE,ECDSA,RC4,SHA,,,,),
  499. CS_ENTRY(0xC00C, TLS,ECDH,RSA,WITH,RC4,128,SHA,),
  500. CS_ENTRY(0xC00C, ECDH,RSA,RC4,SHA,,,,),
  501. CS_ENTRY(0xC011, TLS,ECDHE,RSA,WITH,RC4,128,SHA,),
  502. CS_ENTRY(0xC011, ECDHE,RSA,RC4,SHA,,,,),
  503. CS_ENTRY(0xC015, TLS,ECDH,anon,WITH,NULL,SHA,,),
  504. CS_ENTRY(0xC015, AECDH,NULL,SHA,,,,,),
  505. CS_ENTRY(0xC016, TLS,ECDH,anon,WITH,RC4,128,SHA,),
  506. CS_ENTRY(0xC016, AECDH,RC4,SHA,,,,,),
  507. CS_ENTRY(0xC017, TLS,ECDH,anon,WITH,3DES,EDE,CBC,SHA),
  508. CS_ENTRY(0xC017, AECDH,DES,CBC3,SHA,,,,),
  509. CS_ENTRY(0xC018, TLS,ECDH,anon,WITH,AES,128,CBC,SHA),
  510. CS_ENTRY(0xC018, AECDH,AES128,SHA,,,,,),
  511. CS_ENTRY(0xC019, TLS,ECDH,anon,WITH,AES,256,CBC,SHA),
  512. CS_ENTRY(0xC019, AECDH,AES256,SHA,,,,,),
  513. #endif
  514. #if defined(USE_MBEDTLS)
  515. /* entries marked ns are "non-standard", they are not in OpenSSL */
  516. CS_ENTRY(0x0041, TLS,RSA,WITH,CAMELLIA,128,CBC,SHA,),
  517. CS_ENTRY(0x0041, CAMELLIA128,SHA,,,,,,),
  518. CS_ENTRY(0x0045, TLS,DHE,RSA,WITH,CAMELLIA,128,CBC,SHA),
  519. CS_ENTRY(0x0045, DHE,RSA,CAMELLIA128,SHA,,,,),
  520. CS_ENTRY(0x0084, TLS,RSA,WITH,CAMELLIA,256,CBC,SHA,),
  521. CS_ENTRY(0x0084, CAMELLIA256,SHA,,,,,,),
  522. CS_ENTRY(0x0088, TLS,DHE,RSA,WITH,CAMELLIA,256,CBC,SHA),
  523. CS_ENTRY(0x0088, DHE,RSA,CAMELLIA256,SHA,,,,),
  524. CS_ENTRY(0x00BA, TLS,RSA,WITH,CAMELLIA,128,CBC,SHA256,),
  525. CS_ENTRY(0x00BA, CAMELLIA128,SHA256,,,,,,),
  526. CS_ENTRY(0x00BE, TLS,DHE,RSA,WITH,CAMELLIA,128,CBC,SHA256),
  527. CS_ENTRY(0x00BE, DHE,RSA,CAMELLIA128,SHA256,,,,),
  528. CS_ENTRY(0x00C0, TLS,RSA,WITH,CAMELLIA,256,CBC,SHA256,),
  529. CS_ENTRY(0x00C0, CAMELLIA256,SHA256,,,,,,),
  530. CS_ENTRY(0x00C4, TLS,DHE,RSA,WITH,CAMELLIA,256,CBC,SHA256),
  531. CS_ENTRY(0x00C4, DHE,RSA,CAMELLIA256,SHA256,,,,),
  532. CS_ENTRY(0xC037, TLS,ECDHE,PSK,WITH,AES,128,CBC,SHA256),
  533. CS_ENTRY(0xC037, ECDHE,PSK,AES128,CBC,SHA256,,,),
  534. CS_ENTRY(0xC038, TLS,ECDHE,PSK,WITH,AES,256,CBC,SHA384),
  535. CS_ENTRY(0xC038, ECDHE,PSK,AES256,CBC,SHA384,,,),
  536. CS_ENTRY(0xC039, TLS,ECDHE,PSK,WITH,NULL,SHA,,),
  537. CS_ENTRY(0xC039, ECDHE,PSK,NULL,SHA,,,,),
  538. CS_ENTRY(0xC03A, TLS,ECDHE,PSK,WITH,NULL,SHA256,,),
  539. CS_ENTRY(0xC03A, ECDHE,PSK,NULL,SHA256,,,,),
  540. CS_ENTRY(0xC03B, TLS,ECDHE,PSK,WITH,NULL,SHA384,,),
  541. CS_ENTRY(0xC03B, ECDHE,PSK,NULL,SHA384,,,,),
  542. CS_ENTRY(0xC03C, TLS,RSA,WITH,ARIA,128,CBC,SHA256,),
  543. CS_ENTRY(0xC03C, ARIA128,SHA256,,,,,,), /* ns */
  544. CS_ENTRY(0xC03D, TLS,RSA,WITH,ARIA,256,CBC,SHA384,),
  545. CS_ENTRY(0xC03D, ARIA256,SHA384,,,,,,), /* ns */
  546. CS_ENTRY(0xC044, TLS,DHE,RSA,WITH,ARIA,128,CBC,SHA256),
  547. CS_ENTRY(0xC044, DHE,RSA,ARIA128,SHA256,,,,), /* ns */
  548. CS_ENTRY(0xC045, TLS,DHE,RSA,WITH,ARIA,256,CBC,SHA384),
  549. CS_ENTRY(0xC045, DHE,RSA,ARIA256,SHA384,,,,), /* ns */
  550. CS_ENTRY(0xC048, TLS,ECDHE,ECDSA,WITH,ARIA,128,CBC,SHA256),
  551. CS_ENTRY(0xC048, ECDHE,ECDSA,ARIA128,SHA256,,,,), /* ns */
  552. CS_ENTRY(0xC049, TLS,ECDHE,ECDSA,WITH,ARIA,256,CBC,SHA384),
  553. CS_ENTRY(0xC049, ECDHE,ECDSA,ARIA256,SHA384,,,,), /* ns */
  554. CS_ENTRY(0xC04A, TLS,ECDH,ECDSA,WITH,ARIA,128,CBC,SHA256),
  555. CS_ENTRY(0xC04A, ECDH,ECDSA,ARIA128,SHA256,,,,), /* ns */
  556. CS_ENTRY(0xC04B, TLS,ECDH,ECDSA,WITH,ARIA,256,CBC,SHA384),
  557. CS_ENTRY(0xC04B, ECDH,ECDSA,ARIA256,SHA384,,,,), /* ns */
  558. CS_ENTRY(0xC04C, TLS,ECDHE,RSA,WITH,ARIA,128,CBC,SHA256),
  559. CS_ENTRY(0xC04C, ECDHE,ARIA128,SHA256,,,,,), /* ns */
  560. CS_ENTRY(0xC04D, TLS,ECDHE,RSA,WITH,ARIA,256,CBC,SHA384),
  561. CS_ENTRY(0xC04D, ECDHE,ARIA256,SHA384,,,,,), /* ns */
  562. CS_ENTRY(0xC04E, TLS,ECDH,RSA,WITH,ARIA,128,CBC,SHA256),
  563. CS_ENTRY(0xC04E, ECDH,ARIA128,SHA256,,,,,), /* ns */
  564. CS_ENTRY(0xC04F, TLS,ECDH,RSA,WITH,ARIA,256,CBC,SHA384),
  565. CS_ENTRY(0xC04F, ECDH,ARIA256,SHA384,,,,,), /* ns */
  566. CS_ENTRY(0xC050, TLS,RSA,WITH,ARIA,128,GCM,SHA256,),
  567. CS_ENTRY(0xC050, ARIA128,GCM,SHA256,,,,,),
  568. CS_ENTRY(0xC051, TLS,RSA,WITH,ARIA,256,GCM,SHA384,),
  569. CS_ENTRY(0xC051, ARIA256,GCM,SHA384,,,,,),
  570. CS_ENTRY(0xC052, TLS,DHE,RSA,WITH,ARIA,128,GCM,SHA256),
  571. CS_ENTRY(0xC052, DHE,RSA,ARIA128,GCM,SHA256,,,),
  572. CS_ENTRY(0xC053, TLS,DHE,RSA,WITH,ARIA,256,GCM,SHA384),
  573. CS_ENTRY(0xC053, DHE,RSA,ARIA256,GCM,SHA384,,,),
  574. CS_ENTRY(0xC05C, TLS,ECDHE,ECDSA,WITH,ARIA,128,GCM,SHA256),
  575. CS_ENTRY(0xC05C, ECDHE,ECDSA,ARIA128,GCM,SHA256,,,),
  576. CS_ENTRY(0xC05D, TLS,ECDHE,ECDSA,WITH,ARIA,256,GCM,SHA384),
  577. CS_ENTRY(0xC05D, ECDHE,ECDSA,ARIA256,GCM,SHA384,,,),
  578. CS_ENTRY(0xC05E, TLS,ECDH,ECDSA,WITH,ARIA,128,GCM,SHA256),
  579. CS_ENTRY(0xC05E, ECDH,ECDSA,ARIA128,GCM,SHA256,,,), /* ns */
  580. CS_ENTRY(0xC05F, TLS,ECDH,ECDSA,WITH,ARIA,256,GCM,SHA384),
  581. CS_ENTRY(0xC05F, ECDH,ECDSA,ARIA256,GCM,SHA384,,,), /* ns */
  582. CS_ENTRY(0xC060, TLS,ECDHE,RSA,WITH,ARIA,128,GCM,SHA256),
  583. CS_ENTRY(0xC060, ECDHE,ARIA128,GCM,SHA256,,,,),
  584. CS_ENTRY(0xC061, TLS,ECDHE,RSA,WITH,ARIA,256,GCM,SHA384),
  585. CS_ENTRY(0xC061, ECDHE,ARIA256,GCM,SHA384,,,,),
  586. CS_ENTRY(0xC062, TLS,ECDH,RSA,WITH,ARIA,128,GCM,SHA256),
  587. CS_ENTRY(0xC062, ECDH,ARIA128,GCM,SHA256,,,,), /* ns */
  588. CS_ENTRY(0xC063, TLS,ECDH,RSA,WITH,ARIA,256,GCM,SHA384),
  589. CS_ENTRY(0xC063, ECDH,ARIA256,GCM,SHA384,,,,), /* ns */
  590. CS_ENTRY(0xC064, TLS,PSK,WITH,ARIA,128,CBC,SHA256,),
  591. CS_ENTRY(0xC064, PSK,ARIA128,SHA256,,,,,), /* ns */
  592. CS_ENTRY(0xC065, TLS,PSK,WITH,ARIA,256,CBC,SHA384,),
  593. CS_ENTRY(0xC065, PSK,ARIA256,SHA384,,,,,), /* ns */
  594. CS_ENTRY(0xC066, TLS,DHE,PSK,WITH,ARIA,128,CBC,SHA256),
  595. CS_ENTRY(0xC066, DHE,PSK,ARIA128,SHA256,,,,), /* ns */
  596. CS_ENTRY(0xC067, TLS,DHE,PSK,WITH,ARIA,256,CBC,SHA384),
  597. CS_ENTRY(0xC067, DHE,PSK,ARIA256,SHA384,,,,), /* ns */
  598. CS_ENTRY(0xC068, TLS,RSA,PSK,WITH,ARIA,128,CBC,SHA256),
  599. CS_ENTRY(0xC068, RSA,PSK,ARIA128,SHA256,,,,), /* ns */
  600. CS_ENTRY(0xC069, TLS,RSA,PSK,WITH,ARIA,256,CBC,SHA384),
  601. CS_ENTRY(0xC069, RSA,PSK,ARIA256,SHA384,,,,), /* ns */
  602. CS_ENTRY(0xC06A, TLS,PSK,WITH,ARIA,128,GCM,SHA256,),
  603. CS_ENTRY(0xC06A, PSK,ARIA128,GCM,SHA256,,,,),
  604. CS_ENTRY(0xC06B, TLS,PSK,WITH,ARIA,256,GCM,SHA384,),
  605. CS_ENTRY(0xC06B, PSK,ARIA256,GCM,SHA384,,,,),
  606. CS_ENTRY(0xC06C, TLS,DHE,PSK,WITH,ARIA,128,GCM,SHA256),
  607. CS_ENTRY(0xC06C, DHE,PSK,ARIA128,GCM,SHA256,,,),
  608. CS_ENTRY(0xC06D, TLS,DHE,PSK,WITH,ARIA,256,GCM,SHA384),
  609. CS_ENTRY(0xC06D, DHE,PSK,ARIA256,GCM,SHA384,,,),
  610. CS_ENTRY(0xC06E, TLS,RSA,PSK,WITH,ARIA,128,GCM,SHA256),
  611. CS_ENTRY(0xC06E, RSA,PSK,ARIA128,GCM,SHA256,,,),
  612. CS_ENTRY(0xC06F, TLS,RSA,PSK,WITH,ARIA,256,GCM,SHA384),
  613. CS_ENTRY(0xC06F, RSA,PSK,ARIA256,GCM,SHA384,,,),
  614. CS_ENTRY(0xC070, TLS,ECDHE,PSK,WITH,ARIA,128,CBC,SHA256),
  615. CS_ENTRY(0xC070, ECDHE,PSK,ARIA128,SHA256,,,,), /* ns */
  616. CS_ENTRY(0xC071, TLS,ECDHE,PSK,WITH,ARIA,256,CBC,SHA384),
  617. CS_ENTRY(0xC071, ECDHE,PSK,ARIA256,SHA384,,,,), /* ns */
  618. CS_ENTRY(0xC072, TLS,ECDHE,ECDSA,WITH,CAMELLIA,128,CBC,SHA256),
  619. CS_ENTRY(0xC072, ECDHE,ECDSA,CAMELLIA128,SHA256,,,,),
  620. CS_ENTRY(0xC073, TLS,ECDHE,ECDSA,WITH,CAMELLIA,256,CBC,SHA384),
  621. CS_ENTRY(0xC073, ECDHE,ECDSA,CAMELLIA256,SHA384,,,,),
  622. CS_ENTRY(0xC074, TLS,ECDH,ECDSA,WITH,CAMELLIA,128,CBC,SHA256),
  623. CS_ENTRY(0xC074, ECDH,ECDSA,CAMELLIA128,SHA256,,,,), /* ns */
  624. CS_ENTRY(0xC075, TLS,ECDH,ECDSA,WITH,CAMELLIA,256,CBC,SHA384),
  625. CS_ENTRY(0xC075, ECDH,ECDSA,CAMELLIA256,SHA384,,,,), /* ns */
  626. CS_ENTRY(0xC076, TLS,ECDHE,RSA,WITH,CAMELLIA,128,CBC,SHA256),
  627. CS_ENTRY(0xC076, ECDHE,RSA,CAMELLIA128,SHA256,,,,),
  628. CS_ENTRY(0xC077, TLS,ECDHE,RSA,WITH,CAMELLIA,256,CBC,SHA384),
  629. CS_ENTRY(0xC077, ECDHE,RSA,CAMELLIA256,SHA384,,,,),
  630. CS_ENTRY(0xC078, TLS,ECDH,RSA,WITH,CAMELLIA,128,CBC,SHA256),
  631. CS_ENTRY(0xC078, ECDH,CAMELLIA128,SHA256,,,,,), /* ns */
  632. CS_ENTRY(0xC079, TLS,ECDH,RSA,WITH,CAMELLIA,256,CBC,SHA384),
  633. CS_ENTRY(0xC079, ECDH,CAMELLIA256,SHA384,,,,,), /* ns */
  634. CS_ENTRY(0xC07A, TLS,RSA,WITH,CAMELLIA,128,GCM,SHA256,),
  635. CS_ENTRY(0xC07A, CAMELLIA128,GCM,SHA256,,,,,), /* ns */
  636. CS_ENTRY(0xC07B, TLS,RSA,WITH,CAMELLIA,256,GCM,SHA384,),
  637. CS_ENTRY(0xC07B, CAMELLIA256,GCM,SHA384,,,,,), /* ns */
  638. CS_ENTRY(0xC07C, TLS,DHE,RSA,WITH,CAMELLIA,128,GCM,SHA256),
  639. CS_ENTRY(0xC07C, DHE,RSA,CAMELLIA128,GCM,SHA256,,,), /* ns */
  640. CS_ENTRY(0xC07D, TLS,DHE,RSA,WITH,CAMELLIA,256,GCM,SHA384),
  641. CS_ENTRY(0xC07D, DHE,RSA,CAMELLIA256,GCM,SHA384,,,), /* ns */
  642. CS_ENTRY(0xC086, TLS,ECDHE,ECDSA,WITH,CAMELLIA,128,GCM,SHA256),
  643. CS_ENTRY(0xC086, ECDHE,ECDSA,CAMELLIA128,GCM,SHA256,,,), /* ns */
  644. CS_ENTRY(0xC087, TLS,ECDHE,ECDSA,WITH,CAMELLIA,256,GCM,SHA384),
  645. CS_ENTRY(0xC087, ECDHE,ECDSA,CAMELLIA256,GCM,SHA384,,,), /* ns */
  646. CS_ENTRY(0xC088, TLS,ECDH,ECDSA,WITH,CAMELLIA,128,GCM,SHA256),
  647. CS_ENTRY(0xC088, ECDH,ECDSA,CAMELLIA128,GCM,SHA256,,,), /* ns */
  648. CS_ENTRY(0xC089, TLS,ECDH,ECDSA,WITH,CAMELLIA,256,GCM,SHA384),
  649. CS_ENTRY(0xC089, ECDH,ECDSA,CAMELLIA256,GCM,SHA384,,,), /* ns */
  650. CS_ENTRY(0xC08A, TLS,ECDHE,RSA,WITH,CAMELLIA,128,GCM,SHA256),
  651. CS_ENTRY(0xC08A, ECDHE,CAMELLIA128,GCM,SHA256,,,,), /* ns */
  652. CS_ENTRY(0xC08B, TLS,ECDHE,RSA,WITH,CAMELLIA,256,GCM,SHA384),
  653. CS_ENTRY(0xC08B, ECDHE,CAMELLIA256,GCM,SHA384,,,,), /* ns */
  654. CS_ENTRY(0xC08C, TLS,ECDH,RSA,WITH,CAMELLIA,128,GCM,SHA256),
  655. CS_ENTRY(0xC08C, ECDH,CAMELLIA128,GCM,SHA256,,,,), /* ns */
  656. CS_ENTRY(0xC08D, TLS,ECDH,RSA,WITH,CAMELLIA,256,GCM,SHA384),
  657. CS_ENTRY(0xC08D, ECDH,CAMELLIA256,GCM,SHA384,,,,), /* ns */
  658. CS_ENTRY(0xC08E, TLS,PSK,WITH,CAMELLIA,128,GCM,SHA256,),
  659. CS_ENTRY(0xC08E, PSK,CAMELLIA128,GCM,SHA256,,,,), /* ns */
  660. CS_ENTRY(0xC08F, TLS,PSK,WITH,CAMELLIA,256,GCM,SHA384,),
  661. CS_ENTRY(0xC08F, PSK,CAMELLIA256,GCM,SHA384,,,,), /* ns */
  662. CS_ENTRY(0xC090, TLS,DHE,PSK,WITH,CAMELLIA,128,GCM,SHA256),
  663. CS_ENTRY(0xC090, DHE,PSK,CAMELLIA128,GCM,SHA256,,,), /* ns */
  664. CS_ENTRY(0xC091, TLS,DHE,PSK,WITH,CAMELLIA,256,GCM,SHA384),
  665. CS_ENTRY(0xC091, DHE,PSK,CAMELLIA256,GCM,SHA384,,,), /* ns */
  666. CS_ENTRY(0xC092, TLS,RSA,PSK,WITH,CAMELLIA,128,GCM,SHA256),
  667. CS_ENTRY(0xC092, RSA,PSK,CAMELLIA128,GCM,SHA256,,,), /* ns */
  668. CS_ENTRY(0xC093, TLS,RSA,PSK,WITH,CAMELLIA,256,GCM,SHA384),
  669. CS_ENTRY(0xC093, RSA,PSK,CAMELLIA256,GCM,SHA384,,,), /* ns */
  670. CS_ENTRY(0xC094, TLS,PSK,WITH,CAMELLIA,128,CBC,SHA256,),
  671. CS_ENTRY(0xC094, PSK,CAMELLIA128,SHA256,,,,,),
  672. CS_ENTRY(0xC095, TLS,PSK,WITH,CAMELLIA,256,CBC,SHA384,),
  673. CS_ENTRY(0xC095, PSK,CAMELLIA256,SHA384,,,,,),
  674. CS_ENTRY(0xC096, TLS,DHE,PSK,WITH,CAMELLIA,128,CBC,SHA256),
  675. CS_ENTRY(0xC096, DHE,PSK,CAMELLIA128,SHA256,,,,),
  676. CS_ENTRY(0xC097, TLS,DHE,PSK,WITH,CAMELLIA,256,CBC,SHA384),
  677. CS_ENTRY(0xC097, DHE,PSK,CAMELLIA256,SHA384,,,,),
  678. CS_ENTRY(0xC098, TLS,RSA,PSK,WITH,CAMELLIA,128,CBC,SHA256),
  679. CS_ENTRY(0xC098, RSA,PSK,CAMELLIA128,SHA256,,,,),
  680. CS_ENTRY(0xC099, TLS,RSA,PSK,WITH,CAMELLIA,256,CBC,SHA384),
  681. CS_ENTRY(0xC099, RSA,PSK,CAMELLIA256,SHA384,,,,),
  682. CS_ENTRY(0xC09A, TLS,ECDHE,PSK,WITH,CAMELLIA,128,CBC,SHA256),
  683. CS_ENTRY(0xC09A, ECDHE,PSK,CAMELLIA128,SHA256,,,,),
  684. CS_ENTRY(0xC09B, TLS,ECDHE,PSK,WITH,CAMELLIA,256,CBC,SHA384),
  685. CS_ENTRY(0xC09B, ECDHE,PSK,CAMELLIA256,SHA384,,,,),
  686. CS_ENTRY(0xC09E, TLS,DHE,RSA,WITH,AES,128,CCM,),
  687. CS_ENTRY(0xC09E, DHE,RSA,AES128,CCM,,,,),
  688. CS_ENTRY(0xC09F, TLS,DHE,RSA,WITH,AES,256,CCM,),
  689. CS_ENTRY(0xC09F, DHE,RSA,AES256,CCM,,,,),
  690. CS_ENTRY(0xC0A2, TLS,DHE,RSA,WITH,AES,128,CCM,8),
  691. CS_ENTRY(0xC0A2, DHE,RSA,AES128,CCM8,,,,),
  692. CS_ENTRY(0xC0A3, TLS,DHE,RSA,WITH,AES,256,CCM,8),
  693. CS_ENTRY(0xC0A3, DHE,RSA,AES256,CCM8,,,,),
  694. CS_ENTRY(0xC0A4, TLS,PSK,WITH,AES,128,CCM,,),
  695. CS_ENTRY(0xC0A4, PSK,AES128,CCM,,,,,),
  696. CS_ENTRY(0xC0A5, TLS,PSK,WITH,AES,256,CCM,,),
  697. CS_ENTRY(0xC0A5, PSK,AES256,CCM,,,,,),
  698. CS_ENTRY(0xC0A6, TLS,DHE,PSK,WITH,AES,128,CCM,),
  699. CS_ENTRY(0xC0A6, DHE,PSK,AES128,CCM,,,,),
  700. CS_ENTRY(0xC0A7, TLS,DHE,PSK,WITH,AES,256,CCM,),
  701. CS_ENTRY(0xC0A7, DHE,PSK,AES256,CCM,,,,),
  702. CS_ENTRY(0xC0A8, TLS,PSK,WITH,AES,128,CCM,8,),
  703. CS_ENTRY(0xC0A8, PSK,AES128,CCM8,,,,,),
  704. CS_ENTRY(0xC0A9, TLS,PSK,WITH,AES,256,CCM,8,),
  705. CS_ENTRY(0xC0A9, PSK,AES256,CCM8,,,,,),
  706. CS_ENTRY(0xC0AA, TLS,PSK,DHE,WITH,AES,128,CCM,8),
  707. CS_ENTRY(0xC0AA, DHE,PSK,AES128,CCM8,,,,),
  708. CS_ENTRY(0xC0AB, TLS,PSK,DHE,WITH,AES,256,CCM,8),
  709. CS_ENTRY(0xC0AB, DHE,PSK,AES256,CCM8,,,,),
  710. CS_ENTRY(0xCCAA, TLS,DHE,RSA,WITH,CHACHA20,POLY1305,SHA256,),
  711. CS_ENTRY(0xCCAA, DHE,RSA,CHACHA20,POLY1305,,,,),
  712. CS_ENTRY(0xCCAC, TLS,ECDHE,PSK,WITH,CHACHA20,POLY1305,SHA256,),
  713. CS_ENTRY(0xCCAC, ECDHE,PSK,CHACHA20,POLY1305,,,,),
  714. CS_ENTRY(0xCCAD, TLS,DHE,PSK,WITH,CHACHA20,POLY1305,SHA256,),
  715. CS_ENTRY(0xCCAD, DHE,PSK,CHACHA20,POLY1305,,,,),
  716. CS_ENTRY(0xCCAE, TLS,RSA,PSK,WITH,CHACHA20,POLY1305,SHA256,),
  717. CS_ENTRY(0xCCAE, RSA,PSK,CHACHA20,POLY1305,,,,),
  718. #endif
  719. };
  720. #define CS_LIST_LEN (sizeof(cs_list) / sizeof(cs_list[0]))
  721. static int cs_str_to_zip(const char *cs_str, size_t cs_len,
  722. uint8_t zip[6])
  723. {
  724. uint8_t indexes[8] = {0};
  725. const char *entry, *cur;
  726. const char *nxt = cs_str;
  727. const char *end = cs_str + cs_len;
  728. char separator = '-';
  729. int idx, i = 0;
  730. size_t len;
  731. /* split the cipher string by '-' or '_' */
  732. if(strncasecompare(cs_str, "TLS", 3))
  733. separator = '_';
  734. do {
  735. if(i == 8)
  736. return -1;
  737. /* determine the length of the part */
  738. cur = nxt;
  739. for(; nxt < end && *nxt != '\0' && *nxt != separator; nxt++);
  740. len = nxt - cur;
  741. /* lookup index for the part (skip empty string at 0) */
  742. for(idx = 1, entry = cs_txt + 1; idx < CS_TXT_LEN; idx++) {
  743. size_t elen = strlen(entry);
  744. if(elen == len && strncasecompare(entry, cur, len))
  745. break;
  746. entry += elen + 1;
  747. }
  748. if(idx == CS_TXT_LEN)
  749. return -1;
  750. indexes[i++] = (uint8_t) idx;
  751. } while(nxt < end && *(nxt++) != '\0');
  752. /* zip the 8 indexes into 48 bits */
  753. zip[0] = (uint8_t) (indexes[0] << 2 | (indexes[1] & 0x3F) >> 4);
  754. zip[1] = (uint8_t) (indexes[1] << 4 | (indexes[2] & 0x3F) >> 2);
  755. zip[2] = (uint8_t) (indexes[2] << 6 | (indexes[3] & 0x3F));
  756. zip[3] = (uint8_t) (indexes[4] << 2 | (indexes[5] & 0x3F) >> 4);
  757. zip[4] = (uint8_t) (indexes[5] << 4 | (indexes[6] & 0x3F) >> 2);
  758. zip[5] = (uint8_t) (indexes[6] << 6 | (indexes[7] & 0x3F));
  759. return 0;
  760. }
  761. static int cs_zip_to_str(const uint8_t zip[6],
  762. char *buf, size_t buf_size)
  763. {
  764. uint8_t indexes[8] = {0};
  765. const char *entry;
  766. char separator = '-';
  767. int idx, i, r;
  768. size_t len = 0;
  769. /* unzip the 8 indexes */
  770. indexes[0] = zip[0] >> 2;
  771. indexes[1] = ((zip[0] << 4) & 0x3F) | zip[1] >> 4;
  772. indexes[2] = ((zip[1] << 2) & 0x3F) | zip[2] >> 6;
  773. indexes[3] = ((zip[2] << 0) & 0x3F);
  774. indexes[4] = zip[3] >> 2;
  775. indexes[5] = ((zip[3] << 4) & 0x3F) | zip[4] >> 4;
  776. indexes[6] = ((zip[4] << 2) & 0x3F) | zip[5] >> 6;
  777. indexes[7] = ((zip[5] << 0) & 0x3F);
  778. if(indexes[0] == CS_TXT_IDX_TLS)
  779. separator = '_';
  780. for(i = 0; i < 8 && indexes[i] != 0 && len < buf_size; i++) {
  781. if(indexes[i] >= CS_TXT_LEN)
  782. return -1;
  783. /* lookup the part string for the index (skip empty string at 0) */
  784. for(idx = 1, entry = cs_txt + 1; idx < indexes[i]; idx++) {
  785. size_t elen = strlen(entry);
  786. entry += elen + 1;
  787. }
  788. /* append the part string to the buffer */
  789. if(i > 0)
  790. r = msnprintf(&buf[len], buf_size - len, "%c%s", separator, entry);
  791. else
  792. r = msnprintf(&buf[len], buf_size - len, "%s", entry);
  793. if(r < 0)
  794. return -1;
  795. len += r;
  796. }
  797. return 0;
  798. }
  799. uint16_t Curl_cipher_suite_lookup_id(const char *cs_str, size_t cs_len)
  800. {
  801. size_t i;
  802. uint8_t zip[6];
  803. if(cs_len > 0 && cs_str_to_zip(cs_str, cs_len, zip) == 0) {
  804. for(i = 0; i < CS_LIST_LEN; i++) {
  805. if(memcmp(cs_list[i].zip, zip, sizeof(zip)) == 0)
  806. return cs_list[i].id;
  807. }
  808. }
  809. return 0;
  810. }
  811. static bool cs_is_separator(char c)
  812. {
  813. switch(c) {
  814. case ' ':
  815. case '\t':
  816. case ':':
  817. case ',':
  818. case ';':
  819. return TRUE;
  820. default:;
  821. }
  822. return FALSE;
  823. }
  824. uint16_t Curl_cipher_suite_walk_str(const char **str, const char **end)
  825. {
  826. /* move string pointer to first non-separator or end of string */
  827. for(; cs_is_separator(*str[0]); (*str)++);
  828. /* move end pointer to next separator or end of string */
  829. for(*end = *str; *end[0] != '\0' && !cs_is_separator(*end[0]); (*end)++);
  830. return Curl_cipher_suite_lookup_id(*str, *end - *str);
  831. }
  832. int Curl_cipher_suite_get_str(uint16_t id, char *buf, size_t buf_size,
  833. bool prefer_rfc)
  834. {
  835. size_t i, j = CS_LIST_LEN;
  836. int r = -1;
  837. for(i = 0; i < CS_LIST_LEN; i++) {
  838. if(cs_list[i].id != id)
  839. continue;
  840. if((cs_list[i].zip[0] >> 2 != CS_TXT_IDX_TLS) == !prefer_rfc) {
  841. j = i;
  842. break;
  843. }
  844. if(j == CS_LIST_LEN)
  845. j = i;
  846. }
  847. if(j < CS_LIST_LEN)
  848. r = cs_zip_to_str(cs_list[j].zip, buf, buf_size);
  849. if(r < 0)
  850. msnprintf(buf, buf_size, "TLS_UNKNOWN_0x%04x", id);
  851. return r;
  852. }
  853. #endif /* defined(USE_SECTRANSP) || defined(USE_MBEDTLS) || \
  854. defined(USE_BEARSSL) || defined(USE_RUSTLS) */