user_settings.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /* user_settings.h
  2. *
  3. * Copyright (C) 2006-2023 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. /* Custom wolfSSL user settings for Vortec Scheduler,
  22. * VxWorks 6.9 and VxWorks 7.0 */
  23. #ifndef WOLFSSL_USER_SETTINGS_H
  24. #define WOLFSSL_USER_SETTINGS_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* ------------------------------------------------------------------------- */
  29. /* Platform */
  30. /* ------------------------------------------------------------------------- */
  31. #undef WOLFSSL_GENERAL_ALIGNMENT
  32. #define WOLFSSL_GENERAL_ALIGNMENT 4
  33. /* Platform */
  34. #undef WOLFSSL_STARCORE
  35. #define WOLFSSL_STARCORE
  36. /* Endianess */
  37. #undef BIG_ENDIAN_ORDER
  38. #define BIG_ENDIAN_ORDER
  39. #undef WOLFSSL_SMALL_STACK
  40. #define WOLFSSL_SMALL_STACK
  41. #undef WOLFSSL_USER_IO
  42. /* #define WOLFSSL_USER_IO */
  43. #undef SINGLE_THREADED
  44. #define SINGLE_THREADED
  45. /* ------------------------------------------------------------------------- */
  46. /* Math Configuration */
  47. /* ------------------------------------------------------------------------- */
  48. #undef SIZEOF_LONG_LONG
  49. #define SIZEOF_LONG_LONG 8
  50. #undef SIZEOF_LONG
  51. #define SIZEOF_LONG 4
  52. #undef USE_FAST_MATH
  53. #if 1
  54. #define USE_FAST_MATH
  55. #undef TFM_TIMING_RESISTANT
  56. #define TFM_TIMING_RESISTANT
  57. /* Optimizations (footprint) */
  58. #define WOLFCRYPT_ONLY
  59. #define TFM_NO_ASM
  60. #endif
  61. #if 0
  62. #define WOLFSSL_SP
  63. #define WOLFSSL_SP_SMALL
  64. #define WOLFSSL_HAVE_SP_RSA
  65. #define WOLFSSL_HAVE_SP_DH
  66. #define WOLFSSL_HAVE_SP_ECC
  67. #endif
  68. /* ------------------------------------------------------------------------- */
  69. /* FIPS - Requires eval or license from wolfSSL */
  70. /* ------------------------------------------------------------------------- */
  71. #undef HAVE_FIPS
  72. #if 1
  73. #define HAVE_FIPS
  74. #undef HAVE_FIPS_VERSION
  75. #define HAVE_FIPS_VERSION 2
  76. #ifdef SINGLE_THREADED
  77. #undef NO_THREAD_LS
  78. #define NO_THREAD_LS
  79. #endif
  80. #if 1
  81. #undef NO_ATTRIBUTE_CONSTRUCTOR
  82. #define NO_ATTRIBUTE_CONSTRUCTOR
  83. #endif
  84. #endif
  85. /* ------------------------------------------------------------------------- */
  86. /* Crypto */
  87. /* ------------------------------------------------------------------------- */
  88. /* RSA */
  89. #undef NO_RSA
  90. #if 1
  91. #ifdef USE_FAST_MATH
  92. /* Maximum math bits (Max RSA key bits * 2) */
  93. #undef FP_MAX_BITS
  94. #define FP_MAX_BITS 8192
  95. #endif
  96. /* half as much memory but twice as slow */
  97. #undef RSA_LOW_MEM
  98. #define RSA_LOW_MEM
  99. /* Enables blinding mode, to prevent timing attacks */
  100. #if 0
  101. #undef WC_RSA_BLINDING
  102. #define WC_RSA_BLINDING
  103. #else
  104. #undef WC_NO_HARDEN
  105. #define WC_NO_HARDEN
  106. #endif
  107. /* RSA PSS Support */
  108. #if 1
  109. #define WC_RSA_PSS
  110. #endif
  111. #if 1
  112. #define WC_RSA_NO_PADDING
  113. #endif
  114. #else
  115. #define NO_RSA
  116. #endif
  117. /* ECC */
  118. #undef HAVE_ECC
  119. #if 1
  120. #define HAVE_ECC
  121. /* Manually define enabled curves */
  122. #undef ECC_USER_CURVES
  123. #define ECC_USER_CURVES
  124. #ifdef ECC_USER_CURVES
  125. /* Manual Curve Selection */
  126. #define HAVE_ECC192
  127. #define HAVE_ECC224
  128. #undef NO_ECC256
  129. #define HAVE_ECC384
  130. #define HAVE_ECC521
  131. #endif
  132. /* Fixed point cache (speeds repeated operations against same private key) */
  133. #undef FP_ECC
  134. /* #define FP_ECC */
  135. #ifdef FP_ECC
  136. /* Bits / Entries */
  137. #undef FP_ENTRIES
  138. #define FP_ENTRIES 2
  139. #undef FP_LUT
  140. #define FP_LUT 4
  141. #endif
  142. /* Optional ECC calculation method */
  143. /* Note: doubles heap usage, but slightly faster */
  144. #undef ECC_SHAMIR
  145. /* #define ECC_SHAMIR */
  146. /* Reduces heap usage, but slower */
  147. #undef ECC_TIMING_RESISTANT
  148. #define ECC_TIMING_RESISTANT
  149. #ifdef HAVE_FIPS
  150. #undef HAVE_ECC_CDH
  151. #define HAVE_ECC_CDH /* Enable cofactor support */
  152. #undef NO_STRICT_ECDSA_LEN
  153. #define NO_STRICT_ECDSA_LEN /* Do not force fixed len w/ FIPS */
  154. #undef WOLFSSL_VALIDATE_ECC_IMPORT
  155. #define WOLFSSL_VALIDATE_ECC_IMPORT /* Validate import */
  156. #endif
  157. /* Compressed Key Support */
  158. #undef HAVE_COMP_KEY
  159. /* #define HAVE_COMP_KEY */
  160. /* Use alternate ECC size for ECC math */
  161. #ifdef USE_FAST_MATH
  162. /* MAX ECC BITS = ROUND8(MAX ECC) * 2 */
  163. #ifdef NO_RSA
  164. /* Custom fastmath size if not using RSA */
  165. #undef FP_MAX_BITS
  166. #define FP_MAX_BITS (256 * 2)
  167. #else
  168. #undef ALT_ECC_SIZE
  169. #define ALT_ECC_SIZE
  170. /* wolfSSL will compute the FP_MAX_BITS_ECC, but it can be overriden */
  171. /* #undef FP_MAX_BITS_ECC */
  172. /* #define FP_MAX_BITS_ECC (256 * 2) */
  173. #endif
  174. /* Speedups specific to curve */
  175. #ifndef NO_ECC256
  176. #undef TFM_ECC256
  177. #define TFM_ECC256
  178. #endif
  179. #endif
  180. #endif
  181. /* DH */
  182. #undef NO_DH
  183. #if 1
  184. /* Use table for DH instead of -lm (math) lib dependency */
  185. #if 1
  186. #define WOLFSSL_DH_CONST
  187. #define HAVE_FFDHE_2048
  188. #define HAVE_FFDHE_3072
  189. #define HAVE_FFDHE_4096
  190. /* #define HAVE_FFDHE_6144 */
  191. /* #define HAVE_FFDHE_8192 */
  192. #endif
  193. #ifdef HAVE_FIPS
  194. #define WOLFSSL_VALIDATE_FFC_IMPORT
  195. #define HAVE_FFDHE_Q
  196. #endif
  197. #else
  198. #define NO_DH
  199. #endif
  200. /* AES */
  201. #undef NO_AES
  202. #if 1
  203. #undef HAVE_AES_CBC
  204. #define HAVE_AES_CBC
  205. #undef HAVE_AESGCM
  206. #define HAVE_AESGCM
  207. /* GCM Method: GCM_SMALL, GCM_WORD32 or GCM_TABLE */
  208. /* #define GCM_SMALL */
  209. /* #define GCM_WORD32 */
  210. #define GCM_TABLE
  211. #undef WOLFSSL_AES_DIRECT
  212. #define WOLFSSL_AES_DIRECT
  213. #undef HAVE_AES_ECB
  214. #define HAVE_AES_ECB
  215. #undef WOLFSSL_AES_COUNTER
  216. #define WOLFSSL_AES_COUNTER
  217. #undef HAVE_AESCCM
  218. #define HAVE_AESCCM
  219. #else
  220. #define NO_AES
  221. #endif
  222. /* DES3 */
  223. #undef NO_DES3
  224. #if 1
  225. /* No change */
  226. #else
  227. #define NO_DES3
  228. #endif
  229. /* ChaCha20 / Poly1305 */
  230. #undef HAVE_CHACHA
  231. #undef HAVE_POLY1305
  232. #if 0
  233. #define HAVE_CHACHA
  234. #define HAVE_POLY1305
  235. /* Needed for Poly1305 */
  236. #undef HAVE_ONE_TIME_AUTH
  237. #define HAVE_ONE_TIME_AUTH
  238. #endif
  239. /* Ed25519 / Curve25519 */
  240. #undef HAVE_CURVE25519
  241. #undef HAVE_ED25519
  242. #if 0
  243. #define HAVE_CURVE25519
  244. #define HAVE_ED25519 /* ED25519 Requires SHA512 */
  245. /* Optionally use small math (less flash usage, but much slower) */
  246. #if 1
  247. #define CURVED25519_SMALL
  248. #endif
  249. #endif
  250. /* ------------------------------------------------------------------------- */
  251. /* Hashing */
  252. /* ------------------------------------------------------------------------- */
  253. /* Sha */
  254. #undef NO_SHA
  255. #if 1
  256. /* 1k smaller, but 25% slower */
  257. /* #define USE_SLOW_SHA */
  258. #else
  259. #define NO_SHA
  260. #endif
  261. /* Sha256 */
  262. #undef NO_SHA256
  263. #if 1
  264. /* not unrolled - ~2k smaller and ~25% slower */
  265. /* #define USE_SLOW_SHA256 */
  266. /* Sha224 */
  267. #if 1
  268. #define WOLFSSL_SHA224
  269. #endif
  270. #else
  271. #define NO_SHA256
  272. #endif
  273. /* Sha512 */
  274. #undef WOLFSSL_SHA512
  275. #if 1
  276. #define WOLFSSL_SHA512
  277. /* Sha384 */
  278. #undef WOLFSSL_SHA384
  279. #if 1
  280. #define WOLFSSL_SHA384
  281. #endif
  282. /* over twice as small, but 50% slower */
  283. /* #define USE_SLOW_SHA512 */
  284. #endif
  285. /* Sha3 */
  286. #undef WOLFSSL_SHA3
  287. #if 1
  288. #define WOLFSSL_SHA3
  289. #endif
  290. /* MD5 */
  291. #undef NO_MD5
  292. #if 1
  293. /* No change */
  294. #else
  295. #define NO_MD5
  296. #endif
  297. /* HKDF */
  298. #undef HAVE_HKDF
  299. #if 1
  300. #define HAVE_HKDF
  301. #endif
  302. /* CMAC */
  303. #undef WOLFSSL_CMAC
  304. #if 1
  305. #define WOLFSSL_CMAC
  306. #endif
  307. /* ------------------------------------------------------------------------- */
  308. /* Benchmark / Test */
  309. /* ------------------------------------------------------------------------- */
  310. /* Use reduced benchmark / test sizes */
  311. #undef BENCH_EMBEDDED
  312. #define BENCH_EMBEDDED
  313. #undef USE_CERT_BUFFERS_2048
  314. #define USE_CERT_BUFFERS_2048
  315. #undef USE_CERT_BUFFERS_1024
  316. /* #define USE_CERT_BUFFERS_1024 */
  317. #undef USE_CERT_BUFFERS_256
  318. #define USE_CERT_BUFFERS_256
  319. #undef FORCE_BUFFER_TEST
  320. #define FORCE_BUFFER_TEST
  321. /* ------------------------------------------------------------------------- */
  322. /* Debugging */
  323. /* ------------------------------------------------------------------------- */
  324. #undef DEBUG_WOLFSSL
  325. #undef NO_ERROR_STRINGS
  326. #if 0
  327. #define DEBUG_WOLFSSL
  328. #else
  329. #if 1
  330. #define NO_ERROR_STRINGS
  331. #endif
  332. #endif
  333. /* ------------------------------------------------------------------------- */
  334. /* Memory */
  335. /* ------------------------------------------------------------------------- */
  336. /* Override Memory API's */
  337. #if 0
  338. #undef XMALLOC_OVERRIDE
  339. #define XMALLOC_OVERRIDE
  340. /* prototypes for user heap override functions */
  341. /* Note: Realloc only required for normal math */
  342. #include <stddef.h> /* for size_t */
  343. extern void *myMalloc(size_t n, void* heap, int type);
  344. extern void myFree(void *p, void* heap, int type);
  345. extern void *myRealloc(void *p, size_t n, void* heap, int type);
  346. #define XMALLOC(n, h, t) myMalloc(n, h, t)
  347. #define XFREE(p, h, t) myFree(p, h, t)
  348. #define XREALLOC(p, n, h, t) myRealloc(p, n, h, t)
  349. #endif
  350. #if 0
  351. /* Static memory requires fast math */
  352. #define WOLFSSL_STATIC_MEMORY
  353. /* Disable fallback malloc/free */
  354. #define WOLFSSL_NO_MALLOC
  355. #if 1
  356. #define WOLFSSL_MALLOC_CHECK /* trap malloc failure */
  357. #endif
  358. #endif
  359. /* Memory callbacks */
  360. #if 1
  361. #undef USE_WOLFSSL_MEMORY
  362. #define USE_WOLFSSL_MEMORY
  363. /* Use this to measure / print heap usage */
  364. #if 0
  365. #undef WOLFSSL_TRACK_MEMORY
  366. /* #define WOLFSSL_TRACK_MEMORY */
  367. #undef WOLFSSL_DEBUG_MEMORY
  368. /* #define WOLFSSL_DEBUG_MEMORY */
  369. #undef WOLFSSL_DEBUG_MEMORY_PRINT
  370. /* #define WOLFSSL_DEBUG_MEMORY_PRINT */
  371. #endif
  372. #else
  373. #ifndef WOLFSSL_STATIC_MEMORY
  374. #define NO_WOLFSSL_MEMORY
  375. /* Otherwise we will use stdlib malloc, free and realloc */
  376. #endif
  377. #endif
  378. /* ------------------------------------------------------------------------- */
  379. /* RNG */
  380. /* ------------------------------------------------------------------------- */
  381. /* Seed Source */
  382. /* Seed Source */
  383. #if 1
  384. extern int my_rng_generate_seed(unsigned char* output, int sz);
  385. #undef CUSTOM_RAND_GENERATE_SEED
  386. #define CUSTOM_RAND_GENERATE_SEED my_rng_generate_seed
  387. #endif
  388. /* NETOS */
  389. #if 0
  390. extern unsigned char get_byte_from_pool(void);
  391. #define CUSTOM_RAND_GENERATE get_byte_from_pool
  392. #define CUSTOM_RAND_TYPE unsigned char
  393. #endif
  394. /* Choose RNG method */
  395. #if 1
  396. /* Use built-in P-RNG (SHA256 based) with HW RNG */
  397. /* P-RNG + HW RNG (P-RNG is ~8K) */
  398. /* #define WOLFSSL_GENSEED_FORTEST */
  399. #undef HAVE_HASHDRBG
  400. #define HAVE_HASHDRBG
  401. #else
  402. #undef WC_NO_HASHDRBG
  403. #define WC_NO_HASHDRBG
  404. /* Bypass P-RNG and use only HW RNG */
  405. extern int my_rng_gen_block(unsigned char* output, unsigned int sz);
  406. #undef CUSTOM_RAND_GENERATE_BLOCK
  407. #define CUSTOM_RAND_GENERATE_BLOCK my_rng_gen_block
  408. #endif
  409. /* ------------------------------------------------------------------------- */
  410. /* Enable Features */
  411. /* ------------------------------------------------------------------------- */
  412. #undef WOLFSSL_TLS13
  413. #if 0
  414. #define WOLFSSL_TLS13
  415. #endif
  416. #undef WOLFSSL_KEY_GEN
  417. #if 1
  418. #define WOLFSSL_KEY_GEN
  419. #endif
  420. #if defined(HAVE_FIPS) && !defined(WOLFSSL_KEY_GEN)
  421. #define WOLFSSL_OLD_PRIME_CHECK
  422. #endif
  423. #undef KEEP_PEER_CERT
  424. /* #define KEEP_PEER_CERT */
  425. #undef HAVE_COMP_KEY
  426. /* #define HAVE_COMP_KEY */
  427. #undef HAVE_TLS_EXTENSIONS
  428. /* #define HAVE_TLS_EXTENSIONS */
  429. #undef HAVE_SUPPORTED_CURVES
  430. /* #define HAVE_SUPPORTED_CURVES */
  431. #undef WOLFSSL_BASE64_ENCODE
  432. #define WOLFSSL_BASE64_ENCODE
  433. /* TLS Session Cache */
  434. #if 0
  435. #define SMALL_SESSION_CACHE
  436. #else
  437. #define NO_SESSION_CACHE
  438. #endif
  439. /* ------------------------------------------------------------------------- */
  440. /* Disable Features */
  441. /* ------------------------------------------------------------------------- */
  442. #undef NO_WOLFSSL_SERVER
  443. /* #define NO_WOLFSSL_SERVER */
  444. #undef NO_WOLFSSL_CLIENT
  445. /* #define NO_WOLFSSL_CLIENT */
  446. #undef NO_CRYPT_TEST
  447. /* #define NO_CRYPT_TEST */
  448. #undef NO_CRYPT_BENCHMARK
  449. /* #define NO_CRYPT_BENCHMARK */
  450. /* In-lining of misc.c functions */
  451. /* If defined, must include wolfcrypt/src/misc.c in build */
  452. /* Slower, but about 1k smaller */
  453. #undef NO_INLINE
  454. /* #define NO_INLINE */
  455. #undef NO_FILESYSTEM
  456. /* #define NO_FILESYSTEM */
  457. #undef NO_WRITE_TEMP_FILES
  458. #define NO_WRITE_TEMP_FILES
  459. #undef NO_WOLFSSL_DIR
  460. #define NO_WOLFSSL_DIR
  461. #undef NO_WRITEV
  462. #define NO_WRITEV
  463. #undef WOLFSSL_NO_SOCK
  464. #define WOLFSSL_NO_SOCK
  465. #undef NO_MAIN_DRIVER
  466. #define NO_MAIN_DRIVER
  467. #undef NO_DEV_RANDOM
  468. /* #define NO_DEV_RANDOM */
  469. #undef NO_DSA
  470. #define NO_DSA
  471. #undef NO_RC4
  472. #define NO_RC4
  473. #undef NO_OLD_TLS
  474. #define NO_OLD_TLS
  475. #undef NO_PSK
  476. #define NO_PSK
  477. #undef NO_MD4
  478. #define NO_MD4
  479. #undef WOLFSSL_NO_SHAKE128
  480. #define WOLFSSL_NO_SHAKE128
  481. #undef WOLFSSL_NO_SHAKE256
  482. #define WOLFSSL_NO_SHAKE256
  483. #undef NO_PWDBASED
  484. /* #define NO_PWDBASED */
  485. #undef NO_CODING
  486. /* #define NO_CODING */
  487. #undef NO_ASN_TIME
  488. /* #define NO_ASN_TIME */
  489. #undef NO_CERTS
  490. /* #define NO_CERTS */
  491. #undef NO_SIG_WRAPPER
  492. /* #define NO_SIG_WRAPPER */
  493. /* ACVP Testing ONLY specific settings */
  494. #if 0
  495. #define ACVP_NO_DIR_SUPPORT
  496. /* #define DEBUG_ACVP_PRINTF */
  497. #undef USE_UART_READ_LINE
  498. /* #define USE_UART_READ_LINE */
  499. #undef USE_SMALL_MONTE
  500. /* #define USE_SMALL_MONTE */
  501. #undef WOLFSSL_PUBLIC_MP
  502. /* #define WOLFSSL_PUBLIC_MP */
  503. #undef HAVE_FORCE_FIPS_FAILURE
  504. #define HAVE_FORCE_FIPS_FAILURE
  505. #endif
  506. #ifdef __cplusplus
  507. }
  508. #endif
  509. #endif /* WOLFSSL_USER_SETTINGS_H */