2
0

user_settings.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. /*
  22. * user_settings.h
  23. *
  24. * Created on: Mar 20, 2020
  25. * Generated using:
  26. * ./configure --enable-cryptonly --enable-armasm --enable-ecc --enable-aesgcm --enable-pwdbased --enable-sp --enable-sp-asm \
  27. * --disable-dh --disable-sha --disable-md5 --disable-sha224 --disable-aescbc --disable-shake256
  28. * Result: wolfssl/options.h
  29. */
  30. #ifndef SRC_USER_SETTINGS_H_
  31. #define SRC_USER_SETTINGS_H_
  32. #include <xparameters.h>
  33. /* Disable all TLS support, only wolfCrypt features */
  34. #define WOLFCRYPT_ONLY
  35. /* Xilinx SDK */
  36. #define WOLFSSL_XILINX
  37. #define WOLFSSL_XILINX_CRYPT
  38. #if defined(versal) && defined(WOLFSSL_XILINX_CRYPT)
  39. #define WOLFSSL_XILINX_CRYPT_VERSAL
  40. #endif
  41. #ifndef FREERTOS
  42. #define SINGLE_THREADED
  43. #endif
  44. #define NO_FILESYSTEM
  45. #define HAVE_UINTPTR_T
  46. /* Platform - remap printf */
  47. #include "xil_printf.h"
  48. #define XPRINTF xil_printf
  49. #if !defined(WOLFSSL_XILINX_CRYPT_VERSAL)
  50. /* Enable ARMv8 (Aarch64) assembly speedups - SHA256 / AESGCM */
  51. /* Note: Requires CFLAGS="-mcpu=generic+crypto -mstrict-align" */
  52. #define WOLFSSL_ARMASM
  53. #endif
  54. /* Math */
  55. #define USE_FAST_MATH
  56. #define FP_MAX_BITS (4096 * 2) /* Max RSA 4096-bit */
  57. /* Use Single Precision assembly math speedups for ECC */
  58. #define WOLFSSL_SP
  59. #define WOLFSSL_SP_ASM
  60. #define WOLFSSL_SP_ARM64_ASM
  61. #define WOLFSSL_HAVE_SP_ECC
  62. #define WOLFSSL_HAVE_SP_RSA
  63. #if defined(WOLFSSL_XILINX_CRYPT_VERSAL)
  64. /* Random: HashDRGB / P-RNG (SHA256) */
  65. /* Versal supports both, with and w/o software-based HashDRGB.
  66. * It's your choice */
  67. #define HAVE_HASHDRBG
  68. #define WOLFSSL_PSV_TRNG_DEV_ID XPAR_VERSAL_CIPS_0_PSPMC_0_PSV_PMC_TRNG_DEVICE_ID
  69. #if !defined(HAVE_HASHDRBG)
  70. #define CUSTOM_RAND_GENERATE_BLOCK wc_VersalTrngGenerate
  71. #else
  72. #define CUSTOM_RAND_GENERATE_SEED wc_VersalTrngGenerate
  73. #endif
  74. #else
  75. /* If we don't use the Versal Crypto we need the HASHDRBG */
  76. #define HAVE_HASHDRBG
  77. extern unsigned char my_rng_seed_gen(void);
  78. #define CUSTOM_RAND_GENERATE my_rng_seed_gen
  79. #endif
  80. /* Timing Resistance */
  81. #define TFM_TIMING_RESISTANT
  82. #define ECC_TIMING_RESISTANT
  83. #define WC_RSA_BLINDING
  84. //#define WC_XIL_AESGCM_DPA_CM
  85. /* ECC */
  86. #define HAVE_ECC
  87. #if defined(WOLFSSL_XILINX_CRYPT_VERSAL)
  88. #define ECC_USER_CURVES
  89. #define NO_ECC256
  90. #define WOLFSSL_SP_NO_256
  91. #define HAVE_ECC384
  92. #define WOLFSSL_SP_384
  93. #define HAVE_ECC521
  94. #define WOLFSSL_SP_521
  95. /* Versal also supports usage of RFC6979 if you want to */
  96. //#define WOLFSSL_ECDSA_DETERMINISTIC_K
  97. #else
  98. #define TFM_ECC256
  99. #define ECC_SHAMIR
  100. #endif
  101. /* DH */
  102. #undef NO_DH
  103. #define WOLFSSL_DH_CONST
  104. #define HAVE_FFDHE_2048
  105. #define HAVE_FFDHE_4096
  106. /* Curve25519 / Ed25519 */
  107. #define HAVE_CURVE25519
  108. #define HAVE_ED25519 /* ED25519 Requires SHA512 */
  109. /* 25519 assumes UINT128_T is available for Aarch64 */
  110. #ifndef HAVE___UINT128_T
  111. #define HAVE___UINT128_T
  112. #endif
  113. /* ChaCha20 / Poly1305 */
  114. #define HAVE_CHACHA
  115. #define HAVE_POLY1305
  116. /* AES-CBC is enabled by default if not disabled
  117. * The others have to be enabled */
  118. #define HAVE_AESCCM
  119. #define HAVE_AESGCM
  120. #define WOLFSSL_AES_DIRECT
  121. #define WOLFSSL_CMAC
  122. /* Hashing */
  123. #define WOLFSSL_SHA512
  124. #define WOLFSSL_SHA384
  125. #define WOLFSSL_SHA224
  126. #define WOLFSSL_SHA3
  127. #define WOLFSSL_NO_HASH_RAW /* not supported with ARMASM */
  128. #define WOLFSSL_NO_SHAKE128
  129. #define WOLFSSL_NO_SHAKE256
  130. /* HKDF */
  131. #define HAVE_HKDF
  132. /* Disable Algorithms */
  133. #define NO_DSA
  134. #define NO_RC4
  135. #define NO_MD4
  136. #define NO_MD5
  137. #define NO_SHA
  138. #define NO_PSK
  139. #define NO_DES3
  140. /* Other */
  141. #define WOLFSSL_IGNORE_FILE_WARN /* Ignore file include warnings */
  142. #define NO_MAIN_FUNCTION /* User supplied "main" entry point */
  143. //#define BENCH_EMBEDDED /* Use smaller buffers for benchmarking */
  144. #define WOLFSSL_KEY_GEN
  145. /* Pre-define AAD size to 16 for benchmarks. When executing the benchmarks we
  146. * also use a custom size of 13 to measure "the default size". */
  147. #define AES_AUTH_ADD_SZ 16
  148. /* Test with "wolfssl/certs_test.h" buffers - no file system */
  149. #define USE_CERT_BUFFERS_256
  150. #define USE_CERT_BUFFERS_2048
  151. /* Debugging */
  152. #if 0
  153. #define DEBUG_WOLFSSL
  154. #endif
  155. #endif /* SRC_USER_SETTINGS_H_ */