2
0

cipher_suite.c 36 KB

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