user_settings_wolfssh.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /* user_settings_wolfssh.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. /* To use the rename file to user_settings.h and define WOLFSSL_USER_SETTINGS */
  22. /* Started from the following configure and hand tuned, organized and commented:
  23. ./configure --enable-wolfssh --enable-sp=small --enable-sp-math \
  24. --disable-sp-asm --disable-asm --disable-sys-ca-certs --enable-aesgcm=small \
  25. --enable-cryptonly --disable-sha3 --disable-chacha --disable-poly1305 \
  26. --disable-md5 --disable-error-queue-per-thread --disable-pkcs12 \
  27. --disable-errorstrings --disable-sni --disable-sha224
  28. make
  29. */
  30. /* Tested using:
  31. cp ./examples/configs/user_settings_wolfssh.h user_settings.h
  32. cp ./examples/configs/user_settings_wolfssh.h ../wolfSSH/user_settings.h
  33. wolfSSL:
  34. ./configure --enable-usersettings --disable-examples CFLAGS="-Os"
  35. make
  36. sudo make install
  37. wolfSSH:
  38. ./configure --enable-scp --disable-shared --disable-term \
  39. CFLAGS="-DWOLFSSL_USER_SETTINGS -Os"
  40. make
  41. */
  42. #ifndef WOLFSSL_USER_SETTINGS_SSH_H
  43. #define WOLFSSL_USER_SETTINGS_SSH_H
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /* #define USE_LOW_RESOURCE */
  48. /* Platform */
  49. #ifdef USE_LOW_RESOURCE
  50. /* Threading and filesystem required for wolfSSH tests \
  51. * Can be set for wolfSSH library only use */
  52. #define SINGLE_THREADED
  53. #define NO_FILESYSTEM
  54. #define BENCH_EMBEDDED
  55. #endif
  56. /* Features */
  57. #define WOLFSSL_WOLFSSH
  58. #if 1
  59. #define WOLFCRYPT_ONLY /* no TLS */
  60. #endif
  61. #define HAVE_HASHDRBG
  62. #define WOLFSSL_ASN_TEMPLATE
  63. #define WOLFSSL_PUBLIC_MP
  64. #ifndef USE_LOW_RESOURCE
  65. #define WOLFSSL_BASE64_ENCODE
  66. #endif
  67. #ifndef WOLFCRYPT_ONLY
  68. #define HAVE_TLS_EXTENSIONS
  69. #define HAVE_SUPPORTED_CURVES
  70. #define HAVE_ENCRYPT_THEN_MAC
  71. #endif
  72. /* Timing Resistance */
  73. #define TFM_TIMING_RESISTANT
  74. #define ECC_TIMING_RESISTANT
  75. #define WC_RSA_BLINDING
  76. /* Asymmetric */
  77. #if 1 /* RSA - PKCS1v1.5 */
  78. #undef NO_RSA
  79. #define WC_NO_RSA_OAEP /* SSH does not use OAEP */
  80. #ifdef USE_LOW_RESOURCE
  81. #define RSA_LOW_MEM
  82. #endif
  83. #else
  84. #define NO_RSA
  85. #endif
  86. #if 1 /* DH */
  87. /* RFC 4253 requires "DH w/SHA-1"
  88. * RFC 9142 requires "diffie-hellman-group14-sha256"
  89. */
  90. #undef NO_DH
  91. #ifndef WOLFCRYPT_ONLY
  92. #define HAVE_DH_DEFAULT_PARAMS
  93. #define HAVE_FFDHE_2048
  94. #endif
  95. #else
  96. #define NO_DH
  97. #endif
  98. #if 1 /* ECC */
  99. #define HAVE_ECC
  100. #ifndef USE_LOW_RESOURCE /* optional ECC SHAMIR speedup */
  101. #define ECC_SHAMIR
  102. #endif
  103. #define ECC_USER_CURVES
  104. #ifndef USE_LOW_RESOURCE
  105. #define HAVE_ECC384
  106. #define HAVE_ECC521
  107. #endif
  108. #endif
  109. /* Symmetric AES CBC/GCM */
  110. #undef NO_AES_CBC
  111. #if 1 /* GCM */
  112. #define HAVE_AESGCM
  113. #define GCM_SMALL
  114. #endif
  115. #ifdef USE_LOW_RESOURCE
  116. #define WOLFSSL_AES_SMALL_TABLES
  117. #endif
  118. /* Hashing SHA-1/SHA2-256 */
  119. #undef NO_SHA
  120. #undef NO_SHA256
  121. #ifdef USE_LOW_RESOURCE
  122. #define USE_SLOW_SHA
  123. #define USE_SLOW_SHA256
  124. #endif
  125. #if 0
  126. #define WOLFSSL_SHA384
  127. #define WOLFSSL_SHA512
  128. #ifdef USE_LOW_RESOURCE
  129. #define USE_SLOW_SHA512
  130. #endif
  131. #endif
  132. /* Math */
  133. /* Multi Precision (MP): Enable support for uncommon key sizes / curves */
  134. #if 0
  135. #define WOLFSSL_SP_MATH_ALL
  136. #endif
  137. /* Single Precision (SP) Math */
  138. #define WOLFSSL_SP_MATH
  139. #define WOLFSSL_SP_SMALL
  140. #if !defined(NO_RSA) || !defined(NO_DH)
  141. #undef WOLFSSL_SP_NO_2048 /* 2048-bit */
  142. #ifdef USE_LOW_RESOURCE
  143. #define WOLFSSL_SP_NO_3072 /* 3072-bit */
  144. #else
  145. #undef WOLFSSL_SP_NO_3072 /* 3072-bit */
  146. #define WOLFSSL_SP_4096 /* 4096-bit */
  147. #endif
  148. #ifndef NO_RSA
  149. #define WOLFSSL_HAVE_SP_RSA
  150. #endif
  151. #ifndef NO_DH
  152. #define WOLFSSL_HAVE_SP_DH
  153. #endif
  154. #endif
  155. #ifdef HAVE_ECC
  156. #define WOLFSSL_HAVE_SP_ECC
  157. #undef WOLFSSL_SP_NO_256 /* 256-bit */
  158. #ifdef HAVE_ECC384
  159. #define WOLFSSL_SP_384 /* 384-bit */
  160. #endif
  161. #ifdef HAVE_ECC521
  162. #define WOLFSSL_SP_521 /* 521-bit */
  163. #endif
  164. #endif
  165. /* Disable Algorithms */
  166. #define NO_DSA
  167. #define NO_DES3
  168. #define NO_MD4
  169. #define NO_MD5
  170. #define NO_RC4
  171. #define NO_PSK
  172. #define NO_PKCS12
  173. #define NO_PWDBASED
  174. #define WOLFSSL_NO_SHAKE128
  175. #define WOLFSSL_NO_SHAKE256
  176. /* Disable Features */
  177. #define NO_ERROR_STRINGS
  178. #define WC_NO_ASYNC_THREADING
  179. #define NO_DES3_TLS_SUITES
  180. #define NO_OLD_TLS
  181. #define WOLFSSL_NO_TLS12
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185. #endif /* WOLFSSL_USER_SETTINGS_SSH_H */