1
0

user_settings.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /* user_settings.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. /* 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. /* Endianness */
  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 overridden */
  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. /* Note2: XFREE(NULL) must be properly handled */
  343. #include <stddef.h> /* for size_t */
  344. extern void *myMalloc(size_t n, void* heap, int type);
  345. extern void myFree(void *p, void* heap, int type);
  346. extern void *myRealloc(void *p, size_t n, void* heap, int type);
  347. #define XMALLOC(n, h, t) myMalloc(n, h, t)
  348. #define XFREE(p, h, t) myFree(p, h, t)
  349. #define XREALLOC(p, n, h, t) myRealloc(p, n, h, t)
  350. #endif
  351. #if 0
  352. /* Static memory requires fast math */
  353. #define WOLFSSL_STATIC_MEMORY
  354. /* Disable fallback malloc/free */
  355. #define WOLFSSL_NO_MALLOC
  356. #if 1
  357. #define WOLFSSL_MALLOC_CHECK /* trap malloc failure */
  358. #endif
  359. #endif
  360. /* Memory callbacks */
  361. #if 1
  362. #undef USE_WOLFSSL_MEMORY
  363. #define USE_WOLFSSL_MEMORY
  364. /* Use this to measure / print heap usage */
  365. #if 0
  366. #undef WOLFSSL_TRACK_MEMORY
  367. /* #define WOLFSSL_TRACK_MEMORY */
  368. #undef WOLFSSL_DEBUG_MEMORY
  369. /* #define WOLFSSL_DEBUG_MEMORY */
  370. #undef WOLFSSL_DEBUG_MEMORY_PRINT
  371. /* #define WOLFSSL_DEBUG_MEMORY_PRINT */
  372. #endif
  373. #else
  374. #ifndef WOLFSSL_STATIC_MEMORY
  375. #define NO_WOLFSSL_MEMORY
  376. /* Otherwise we will use stdlib malloc, free and realloc */
  377. #endif
  378. #endif
  379. /* ------------------------------------------------------------------------- */
  380. /* RNG */
  381. /* ------------------------------------------------------------------------- */
  382. /* Seed Source */
  383. /* Seed Source */
  384. #if 1
  385. extern int my_rng_generate_seed(unsigned char* output, int sz);
  386. #undef CUSTOM_RAND_GENERATE_SEED
  387. #define CUSTOM_RAND_GENERATE_SEED my_rng_generate_seed
  388. #endif
  389. /* NETOS */
  390. #if 0
  391. extern unsigned char get_byte_from_pool(void);
  392. #define CUSTOM_RAND_GENERATE get_byte_from_pool
  393. #define CUSTOM_RAND_TYPE unsigned char
  394. #endif
  395. /* Choose RNG method */
  396. #if 1
  397. /* Use built-in P-RNG (SHA256 based) with HW RNG */
  398. /* P-RNG + HW RNG (P-RNG is ~8K) */
  399. /* #define WOLFSSL_GENSEED_FORTEST */
  400. #undef HAVE_HASHDRBG
  401. #define HAVE_HASHDRBG
  402. #else
  403. #undef WC_NO_HASHDRBG
  404. #define WC_NO_HASHDRBG
  405. /* Bypass P-RNG and use only HW RNG */
  406. extern int my_rng_gen_block(unsigned char* output, unsigned int sz);
  407. #undef CUSTOM_RAND_GENERATE_BLOCK
  408. #define CUSTOM_RAND_GENERATE_BLOCK my_rng_gen_block
  409. #endif
  410. /* ------------------------------------------------------------------------- */
  411. /* Enable Features */
  412. /* ------------------------------------------------------------------------- */
  413. #undef WOLFSSL_TLS13
  414. #if 0
  415. #define WOLFSSL_TLS13
  416. #endif
  417. #undef WOLFSSL_KEY_GEN
  418. #if 1
  419. #define WOLFSSL_KEY_GEN
  420. #endif
  421. #if defined(HAVE_FIPS) && !defined(WOLFSSL_KEY_GEN)
  422. #define WOLFSSL_OLD_PRIME_CHECK
  423. #endif
  424. #undef KEEP_PEER_CERT
  425. /* #define KEEP_PEER_CERT */
  426. #undef HAVE_COMP_KEY
  427. /* #define HAVE_COMP_KEY */
  428. #undef HAVE_TLS_EXTENSIONS
  429. /* #define HAVE_TLS_EXTENSIONS */
  430. #undef HAVE_SUPPORTED_CURVES
  431. /* #define HAVE_SUPPORTED_CURVES */
  432. #undef WOLFSSL_BASE64_ENCODE
  433. #define WOLFSSL_BASE64_ENCODE
  434. /* TLS Session Cache */
  435. #if 0
  436. #define SMALL_SESSION_CACHE
  437. #else
  438. #define NO_SESSION_CACHE
  439. #endif
  440. /* ------------------------------------------------------------------------- */
  441. /* Disable Features */
  442. /* ------------------------------------------------------------------------- */
  443. #undef NO_WOLFSSL_SERVER
  444. /* #define NO_WOLFSSL_SERVER */
  445. #undef NO_WOLFSSL_CLIENT
  446. /* #define NO_WOLFSSL_CLIENT */
  447. #undef NO_CRYPT_TEST
  448. /* #define NO_CRYPT_TEST */
  449. #undef NO_CRYPT_BENCHMARK
  450. /* #define NO_CRYPT_BENCHMARK */
  451. /* In-lining of misc.c functions */
  452. /* If defined, must include wolfcrypt/src/misc.c in build */
  453. /* Slower, but about 1k smaller */
  454. #undef NO_INLINE
  455. /* #define NO_INLINE */
  456. #undef NO_FILESYSTEM
  457. /* #define NO_FILESYSTEM */
  458. #undef NO_WRITE_TEMP_FILES
  459. #define NO_WRITE_TEMP_FILES
  460. #undef NO_WOLFSSL_DIR
  461. #define NO_WOLFSSL_DIR
  462. #undef NO_WRITEV
  463. #define NO_WRITEV
  464. #undef WOLFSSL_NO_SOCK
  465. #define WOLFSSL_NO_SOCK
  466. #undef NO_MAIN_DRIVER
  467. #define NO_MAIN_DRIVER
  468. #undef NO_DEV_RANDOM
  469. /* #define NO_DEV_RANDOM */
  470. #undef NO_DSA
  471. #define NO_DSA
  472. #undef NO_RC4
  473. #define NO_RC4
  474. #undef NO_OLD_TLS
  475. #define NO_OLD_TLS
  476. #undef NO_PSK
  477. #define NO_PSK
  478. #undef NO_MD4
  479. #define NO_MD4
  480. #undef WOLFSSL_NO_SHAKE128
  481. #define WOLFSSL_NO_SHAKE128
  482. #undef WOLFSSL_NO_SHAKE256
  483. #define WOLFSSL_NO_SHAKE256
  484. #undef NO_PWDBASED
  485. /* #define NO_PWDBASED */
  486. #undef NO_CODING
  487. /* #define NO_CODING */
  488. #undef NO_ASN_TIME
  489. /* #define NO_ASN_TIME */
  490. #undef NO_CERTS
  491. /* #define NO_CERTS */
  492. #undef NO_SIG_WRAPPER
  493. /* #define NO_SIG_WRAPPER */
  494. /* ACVP Testing ONLY specific settings */
  495. #if 0
  496. #define ACVP_NO_DIR_SUPPORT
  497. /* #define DEBUG_ACVP_PRINTF */
  498. #undef USE_UART_READ_LINE
  499. /* #define USE_UART_READ_LINE */
  500. #undef USE_SMALL_MONTE
  501. /* #define USE_SMALL_MONTE */
  502. #undef WOLFSSL_PUBLIC_MP
  503. /* #define WOLFSSL_PUBLIC_MP */
  504. #undef HAVE_FORCE_FIPS_FAILURE
  505. #define HAVE_FORCE_FIPS_FAILURE
  506. #endif
  507. #ifdef __cplusplus
  508. }
  509. #endif
  510. #endif /* WOLFSSL_USER_SETTINGS_H */