1
0

user_settings_arduino.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. /* examples/configs/user_settings_arduino.h
  2. *
  3. * Copyright (C) 2006-2024 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* This is a sample Arduino user_settings.h for wolfSSL
  22. >> Edit with caution. This is the file copied to wolfSSL Arduino library.
  23. >> at publish time. (lines with ">>" are removed)
  24. */
  25. /* Define a macro to display user settings version in example code: */
  26. #define WOLFSSL_USER_SETTINGS_ID "Arduino user_settings.h v5.6.7"
  27. /* Due to limited build control, we'll ignore file warnings. */
  28. /* See https://github.com/arduino/arduino-cli/issues/631 */
  29. #undef WOLFSSL_IGNORE_FILE_WARN
  30. #define WOLFSSL_IGNORE_FILE_WARN
  31. #define NO_FILESYSTEM
  32. #define USE_CERT_BUFFERS_2048
  33. /* Make sure this is not an ESP-IDF file */
  34. #undef WOLFSSL_ESPIDF
  35. #define HAVE_ECC
  36. #define WOLFSSL_SMALL_STACK
  37. /* #define WOLFSSL_SMALL_STACK_EXTRA */
  38. /* #define WOLFSSL_SMALL_STACK_CIPHERS */
  39. /* #define NO_DH */
  40. #define MICRO_SESSION_CACHE
  41. /* RSA must be enabled for examples, but can be disabled like this: */
  42. /* #define NO_RSA */
  43. #define RSA_LOW_MEM
  44. #define NO_OLD_TLS
  45. /* TLS 1.3 */
  46. /* #define WOLFSSL_TLS13 */
  47. #if defined(WOLFSSL_TLS13)
  48. #define HAVE_TLS_EXTENSIONS
  49. #define WC_RSA_PSS
  50. #define HAVE_HKDF
  51. #define HAVE_AEAD
  52. #endif
  53. /* #define HAVE_SUPPORTED_CURVES */
  54. /* Cannot use WOLFSSL_NO_MALLOC with small stack */
  55. /* #define WOLFSSL_NO_MALLOC */
  56. #define HAVE_TLS_EXTENSIONS
  57. #define HAVE_SUPPORTED_CURVES
  58. /* To further reduce size, client or server functionality can be disabled.
  59. * Here, we check if the example code gave us a hint.
  60. *
  61. * The calling application can define either one of these macros before
  62. * including the Arduino wolfssl.h library file:
  63. *
  64. * WOLFSSL_CLIENT_EXAMPLE
  65. * WOLFSSL_SERVER_EXAMPLE
  66. */
  67. #if defined(WOLFSSL_CLIENT_EXAMPLE)
  68. #define NO_WOLFSSL_SERVER
  69. #elif defined(WOLFSSL_SERVER_EXAMPLE)
  70. #define NO_WOLFSSL_CLIENT
  71. #else
  72. /* Provide a hint to application that neither WOLFSSL_CLIENT_EXAMPLE
  73. * or WOLFSSL_SERVER_EXAMPLE macro hint was desired but not found. */
  74. #define NO_WOLFSSL_SERVER_CLIENT_MISSING
  75. #warning "Define WOLFSSL_CLIENT_EXAMPLE or WOLFSSL_SERVER_EXAMPLE to" \
  76. " optimize memory for small embedded devices."
  77. /* Both can be disabled in wolfssl test & benchmark */
  78. #endif
  79. #define NO_DH
  80. #define NO_DSA
  81. #define USE_FAST_MATH
  82. #define WOLFSSL_SMALL_STACK
  83. #define SINGLE_THREADED
  84. #define WOLFSSL_LOW_MEMORY
  85. #define HAVE_AESGCM
  86. /* optionally turn off SHA512/224 SHA512/256 */
  87. /* #define WOLFSSL_NOSHA512_224 */
  88. /* #define WOLFSSL_NOSHA512_256 */
  89. /* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
  90. #define SINGLE_THREADED
  91. /* Optional OPENSSL compatibility */
  92. /* #define OPENSSL_EXTRA */
  93. /* #define OPENSSL_ALL */
  94. /* when you want to use pkcs7 */
  95. /* #define HAVE_PKCS7 */
  96. /* when you want to use AES counter mode */
  97. /* #define WOLFSSL_AES_DIRECT */
  98. /* #define WOLFSSL_AES_COUNTER */
  99. /* esp32-wroom-32se specific definition */
  100. #if defined(WOLFSSL_ESPWROOM32SE)
  101. #define WOLFSSL_ATECC508A
  102. #define HAVE_PK_CALLBACKS
  103. /* when you want to use a custom slot allocation for ATECC608A */
  104. /* unless your configuration is unusual, you can use default */
  105. /* implementation. */
  106. /* #define CUSTOM_SLOT_ALLOCATION */
  107. #endif
  108. /* RSA primitive specific definition */
  109. #if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
  110. /* Define USE_FAST_MATH and SMALL_STACK */
  111. #define ESP32_USE_RSA_PRIMITIVE
  112. #if defined(CONFIG_IDF_TARGET_ESP32)
  113. /* NOTE HW unreliable for small values! */
  114. /* threshold for performance adjustment for HW primitive use */
  115. /* X bits of G^X mod P greater than */
  116. #undef ESP_RSA_EXPT_XBITS
  117. #define ESP_RSA_EXPT_XBITS 32
  118. /* X and Y of X * Y mod P greater than */
  119. #undef ESP_RSA_MULM_BITS
  120. #define ESP_RSA_MULM_BITS 16
  121. #endif
  122. #endif
  123. /* #define WOLFSSL_ATECC508A_DEBUG */
  124. /* date/time */
  125. /* if it cannot adjust time in the device, */
  126. /* enable macro below */
  127. /* #define NO_ASN_TIME */
  128. /* #define XTIME time */
  129. /* adjust wait-timeout count if you see timeout in RSA HW acceleration */
  130. #define ESP_RSA_TIMEOUT_CNT 0x249F00
  131. #define HASH_SIZE_LIMIT /* for test.c */
  132. /* USE_FAST_MATH is default */
  133. #define USE_FAST_MATH
  134. /***** Use SP_MATH *****/
  135. /* #undef USE_FAST_MATH */
  136. /* #define SP_MATH */
  137. /* #define WOLFSSL_SP_MATH_ALL */
  138. /***** Use Integer Heap Math *****/
  139. /* #undef USE_FAST_MATH */
  140. /* #define USE_INTEGER_HEAP_MATH */
  141. /* Default is HW enabled unless turned off.
  142. ** Uncomment these lines to force SW instead of HW acceleration */
  143. #if defined(CONFIG_IDF_TARGET_ESP32)
  144. /* wolfSSL HW Acceleration supported on ESP32. Uncomment to disable: */
  145. /* #define NO_ESP32_CRYPT */
  146. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
  147. /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
  148. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
  149. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  150. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  151. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  152. /* These are defined automatically in esp32-crypt.h, here for clarity: */
  153. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
  154. #undef ESP_RSA_MULM_BITS
  155. #define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
  156. /***** END CONFIG_IDF_TARGET_ESP32 *****/
  157. #elif defined(CONFIG_IDF_TARGET_ESP32S2)
  158. /* wolfSSL HW Acceleration supported on ESP32-S2. Uncomment to disable: */
  159. /* #define NO_ESP32_CRYPT */
  160. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
  161. /* Note: There's no AES192 HW on the ESP32-S2; falls back to SW */
  162. /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
  163. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
  164. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  165. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  166. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  167. /***** END CONFIG_IDF_TARGET_ESP32S2 *****/
  168. #elif defined(CONFIG_IDF_TARGET_ESP32S3)
  169. /* wolfSSL HW Acceleration supported on ESP32-S3. Uncomment to disable: */
  170. /* #define NO_ESP32_CRYPT */
  171. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
  172. /* Note: There's no AES192 HW on the ESP32-S3; falls back to SW */
  173. /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
  174. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
  175. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  176. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  177. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  178. /***** END CONFIG_IDF_TARGET_ESP32S3 *****/
  179. #elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
  180. defined(CONFIG_IDF_TARGET_ESP8684)
  181. /* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
  182. * single QFN 4x4 mm package. Out of released documentation, Technical
  183. * Reference Manual as well as ESP-IDF Programming Guide is applicable
  184. * to both ESP32-C2 and ESP8684.
  185. *
  186. * See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
  187. /* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
  188. /* #define NO_ESP32_CRYPT */
  189. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
  190. /* These are defined automatically in esp32-crypt.h, here for clarity */
  191. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
  192. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
  193. /* There's no AES or RSA/Math accelerator on the ESP32-C2
  194. * Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
  195. #define NO_WOLFSSL_ESP32_CRYPT_AES
  196. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
  197. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
  198. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
  199. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
  200. /***** END CONFIG_IDF_TARGET_ESP32C2 *****/
  201. #elif defined(CONFIG_IDF_TARGET_ESP32C3)
  202. /* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
  203. /* #define NO_ESP32_CRYPT */
  204. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
  205. /* These are defined automatically in esp32-crypt.h, here for clarity: */
  206. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
  207. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
  208. /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
  209. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
  210. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  211. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  212. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  213. /***** END CONFIG_IDF_TARGET_ESP32C3 *****/
  214. #elif defined(CONFIG_IDF_TARGET_ESP32C6)
  215. /* wolfSSL HW Acceleration supported on ESP32-C6. Uncomment to disable: */
  216. /* #define NO_ESP32_CRYPT */
  217. /* #define NO_WOLFSSL_ESP32_CRYPT_HASH */
  218. /* These are defined automatically in esp32-crypt.h, here for clarity: */
  219. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C6 */
  220. #define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C6 */
  221. /* #define NO_WOLFSSL_ESP32_CRYPT_AES */
  222. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI */
  223. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  224. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  225. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  226. /***** END CONFIG_IDF_TARGET_ESP32C6 *****/
  227. #elif defined(CONFIG_IDF_TARGET_ESP32H2)
  228. /* wolfSSL Hardware Acceleration not yet implemented */
  229. #define NO_ESP32_CRYPT
  230. #define NO_WOLFSSL_ESP32_CRYPT_HASH
  231. #define NO_WOLFSSL_ESP32_CRYPT_AES
  232. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
  233. /***** END CONFIG_IDF_TARGET_ESP32H2 *****/
  234. #elif defined(CONFIG_IDF_TARGET_ESP8266)
  235. /* TODO: Revisit ESP8266 */
  236. #define NO_ESP32_CRYPT
  237. #define NO_WOLFSSL_ESP32_CRYPT_HASH
  238. #define NO_WOLFSSL_ESP32_CRYPT_AES
  239. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
  240. /***** END CONFIG_IDF_TARGET_ESP266 *****/
  241. #else
  242. /* Anything else encountered, disable HW acceleration */
  243. #define NO_ESP32_CRYPT
  244. #define NO_WOLFSSL_ESP32_CRYPT_HASH
  245. #define NO_WOLFSSL_ESP32_CRYPT_AES
  246. #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
  247. #endif /* CONFIG_IDF_TARGET Check */
  248. #define DEBUG_WOLFSSL
  249. /* Debug options:
  250. #define ESP_VERIFY_MEMBLOCK
  251. #define DEBUG_WOLFSSL
  252. #define DEBUG_WOLFSSL_VERBOSE
  253. #define DEBUG_WOLFSSL_SHA_MUTEX
  254. #define WOLFSSL_ESP32_CRYPT_DEBUG
  255. #define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
  256. #define NO_RECOVER_SOFTWARE_CALC
  257. #define WOLFSSL_TEST_STRAY 1
  258. #define USE_ESP_DPORT_ACCESS_READ_BUFFER
  259. #define WOLFSSL_ESP32_HW_LOCK_DEBUG
  260. #define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
  261. #define ESP_DISABLE_HW_TASK_LOCK
  262. */
  263. #define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
  264. #define WOLFSSL_HW_METRICS
  265. #define ALT_ECC_SIZE
  266. /* #define HASH_SIZE_LIMIT */ /* for test.c */
  267. /* #define NO_HW_MATH_TEST */ /* Optionally turn off HW math checks */
  268. /* Optionally include alternate HW test library: alt_hw_test.h */
  269. /* When enabling, the ./components/wolfssl/CMakeLists.txt file
  270. * will need the name of the library in the idf_component_register
  271. * for the PRIV_REQUIRES list. */
  272. /* #define INCLUDE_ALT_HW_TEST */
  273. /* optionally turn off individual math HW acceleration features */
  274. /* Turn off Large Number ESP32 HW Multiplication:
  275. ** [Z = X * Y] in esp_mp_mul() */
  276. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
  277. /* Turn off Large Number ESP32 HW Modular Exponentiation:
  278. ** [Z = X^Y mod M] in esp_mp_exptmod() */
  279. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
  280. /* Turn off Large Number ESP32 HW Modular Multiplication
  281. ** [Z = X * Y mod M] in esp_mp_mulmod() */
  282. /* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
  283. #define WOLFSSL_PUBLIC_MP /* used by benchmark */
  284. /* when turning on ECC508 / ECC608 support
  285. #define WOLFSSL_ESPWROOM32SE
  286. #define HAVE_PK_CALLBACKS
  287. #define WOLFSSL_ATECC508A
  288. #define ATCA_WOLFSSL
  289. */
  290. /* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
  291. /* The section below defines macros used in typically all of the wolfSSL
  292. * examples such as the client and server for certs stored in header files.
  293. *
  294. * There are various certificate examples in this header file:
  295. * https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h
  296. *
  297. * To use the sets of macros below, define *one* of these:
  298. *
  299. * USE_CERT_BUFFERS_1024 - ECC 1024 bit encoded ASN1
  300. * USE_CERT_BUFFERS_2048 - RSA 2048 bit encoded ASN1
  301. * WOLFSSL_SM[2,3,4] - SM Ciphers
  302. *
  303. * For example: define USE_CERT_BUFFERS_2048 to use CA Certs used in this
  304. * wolfSSL function for the `ca_cert_der_2048` buffer, size and types:
  305. *
  306. * ret = wolfSSL_CTX_load_verify_buffer(ctx,
  307. * CTX_CA_CERT,
  308. * CTX_CA_CERT_SIZE,
  309. * CTX_CA_CERT_TYPE);
  310. *
  311. * See https://www.wolfssl.com/documentation/manuals/wolfssl/group__CertsKeys.html#function-wolfssl_ctx_load_verify_buffer
  312. *
  313. * In this case the CTX_CA_CERT will be defined as `ca_cert_der_2048` as
  314. * defined here: https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h
  315. *
  316. * The CTX_CA_CERT_SIZE and CTX_CA_CERT_TYPE are similarly used to reference
  317. * array size and cert type respectively.
  318. *
  319. * Similarly for loading the private client key:
  320. *
  321. * ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx,
  322. * CTX_CLIENT_KEY,
  323. * CTX_CLIENT_KEY_SIZE,
  324. * CTX_CLIENT_KEY_TYPE);
  325. *
  326. * see https://www.wolfssl.com/documentation/manuals/wolfssl/group__CertsKeys.html#function-wolfssl_ctx_use_privatekey_buffer
  327. *
  328. * Similarly, the other macros are for server certificates and keys:
  329. * `CTX_SERVER_CERT` and `CTX_SERVER_KEY` are available.
  330. *
  331. * The certificate and key names are typically `static const unsigned char`
  332. * arrays. The [NAME]_size are typically `sizeof([array name])`, and the types
  333. * are the known wolfSSL encoding type integers (e.g. WOLFSSL_FILETYPE_PEM).
  334. *
  335. * See `SSL_FILETYPE_[name]` in
  336. * https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/ssl.h
  337. *
  338. * See Abstract Syntax Notation One (ASN.1) in:
  339. * https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/wolfcrypt/asn.h
  340. *
  341. * Optional SM4 Ciphers:
  342. *
  343. * Although the SM ciphers are shown here, the `certs_test_sm.h` may not yet
  344. * be available. See:
  345. * https://github.com/wolfSSL/wolfssl/pull/6825
  346. * https://github.com/wolfSSL/wolfsm
  347. *
  348. * Uncomment these 3 macros to enable the SM Ciphers and use the macros below.
  349. */
  350. /*
  351. #define WOLFSSL_SM2
  352. #define WOLFSSL_SM3
  353. #define WOLFSSL_SM4
  354. */
  355. /* Conditional macros used in wolfSSL TLS client and server examples */
  356. #if defined(WOLFSSL_SM2) || defined(WOLFSSL_SM3) || defined(WOLFSSL_SM4)
  357. #include <wolfssl/certs_test_sm.h>
  358. #define CTX_CA_CERT root_sm2
  359. #define CTX_CA_CERT_SIZE sizeof_root_sm2
  360. #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_PEM
  361. #define CTX_SERVER_CERT server_sm2
  362. #define CTX_SERVER_CERT_SIZE sizeof_server_sm2
  363. #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_PEM
  364. #define CTX_SERVER_KEY server_sm2_priv
  365. #define CTX_SERVER_KEY_SIZE sizeof_server_sm2_priv
  366. #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_PEM
  367. #undef WOLFSSL_BASE16
  368. #define WOLFSSL_BASE16
  369. #else
  370. #if defined(USE_CERT_BUFFERS_2048)
  371. #ifdef USE_CERT_BUFFERS_1024
  372. #error "USE_CERT_BUFFERS_1024 is already defined. Pick one."
  373. #endif
  374. #include <wolfssl/certs_test.h>
  375. #define CTX_CA_CERT ca_cert_der_2048
  376. #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_2048
  377. #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  378. #define CTX_SERVER_CERT server_cert_der_2048
  379. #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_2048
  380. #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  381. #define CTX_SERVER_KEY server_key_der_2048
  382. #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
  383. #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
  384. #define CTX_CLIENT_CERT client_cert_der_2048
  385. #define CTX_CLIENT_CERT_SIZE sizeof_client_cert_der_2048
  386. #define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  387. #define CTX_CLIENT_KEY client_key_der_2048
  388. #define CTX_CLIENT_KEY_SIZE sizeof_client_key_der_2048
  389. #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1
  390. #elif defined(USE_CERT_BUFFERS_1024)
  391. #ifdef USE_CERT_BUFFERS_2048
  392. #error "USE_CERT_BUFFERS_2048 is already defined. Pick one."
  393. #endif
  394. #include <wolfssl/certs_test.h>
  395. #define CTX_CA_CERT ca_cert_der_1024
  396. #define CTX_CA_CERT_SIZE sizeof_ca_cert_der_1024
  397. #define CTX_CA_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  398. #define CTX_CLIENT_CERT client_cert_der_1024
  399. #define CTX_CLIENT_CERT_SIZE sizeof_client_cert_der_1024
  400. #define CTX_CLIENT_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  401. #define CTX_CLIENT_KEY client_key_der_1024
  402. #define CTX_CLIENT_KEY_SIZE sizeof_client_key_der_1024
  403. #define CTX_CLIENT_KEY_TYPE WOLFSSL_FILETYPE_ASN1
  404. #define CTX_SERVER_CERT server_cert_der_1024
  405. #define CTX_SERVER_CERT_SIZE sizeof_server_cert_der_1024
  406. #define CTX_SERVER_CERT_TYPE WOLFSSL_FILETYPE_ASN1
  407. #define CTX_SERVER_KEY server_key_der_1024
  408. #define CTX_SERVER_KEY_SIZE sizeof_server_key_der_1024
  409. #define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
  410. #else
  411. #error "Must define USE_CERT_BUFFERS_2048 or USE_CERT_BUFFERS_1024"
  412. #endif
  413. #endif