user_settings.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef USER_SETTINGS_H
  2. #define USER_SETTINGS_H
  3. #include <stdint.h>
  4. #include <string.h>
  5. #include <wolfssl/ssl.h>
  6. #include <wolfssl/wolfcrypt/types.h>
  7. /* Configuration */
  8. #define WOLFSSL_USER_IO
  9. #define WOLFSSL_GENERAL_ALIGNMENT 4
  10. #define WOLFSSL_SMALL_STACK
  11. #define WOLFSSL_BASE64_ENCODE
  12. #define WOLFSSL_SHA512
  13. #define HAVE_ECC
  14. #define HAVE_AESGCM
  15. #define HAVE_CURVE25519
  16. #define HAVE_HKDF
  17. #define HAVE_HASHDRBG
  18. #define HAVE_CHACHA
  19. #define HAVE_POLY1305
  20. #define HAVE_ONE_TIME_AUTH
  21. #define HAVE_TLS_EXTENSIONS
  22. #define HAVE_SUPPORTED_CURVES
  23. #define HAVE_ERRNO_H
  24. #define HAVE_LWIP_NATIVE
  25. #define FP_LUT 4
  26. #define FP_MAX_BITS 2048 /* 4096 */
  27. #define FP_MAX_BITS_ECC 512
  28. #define ALT_ECC_SIZE
  29. #define USE_FAST_MATH
  30. #define SMALL_SESSION_CACHE
  31. #define CURVED25519_SMALL
  32. #define RSA_LOW_MEM
  33. #define GCM_SMALL
  34. #define ECC_SHAMIR
  35. #define USE_SLOW_SHA2
  36. #define MP_LOW_MEM
  37. #define TFM_TIMING_RESISTANT
  38. //#define TFM_ARM
  39. #define SINGLE_THREADED
  40. /* Remove Features */
  41. #define NO_DEV_RANDOM
  42. #define NO_FILESYSTEM
  43. #define NO_WRITEV
  44. #define NO_MAIN_DRIVER
  45. #define NO_WOLFSSL_MEMORY
  46. #define NO_DEV_RANDOM
  47. #define NO_MD4
  48. #define NO_RABBIT
  49. #define NO_HC128
  50. #define NO_DSA
  51. #define NO_PWDBASED
  52. #define NO_PSK
  53. #define NO_64BIT
  54. #define NO_WOLFSSL_SERVER
  55. #define NO_OLD_TLS
  56. #define ECC_USER_CURVES /* Disables P-112, P-128, P-160, P-192, P-224, P-384, P-521 but leaves P-256 enabled */
  57. #define NO_DES3
  58. #define NO_MD5
  59. #define NO_RC4
  60. /* Benchmark / Testing */
  61. #define BENCH_EMBEDDED
  62. #define USE_CERT_BUFFERS_1024
  63. #define SOCKET_T int
  64. /*
  65. #define inet_addr wolfSSL_inet_addr
  66. #include <string.h>
  67. static unsigned long wolfSSL_inet_addr(const char *cp)
  68. {
  69. unsigned int a[4] ; unsigned long ret ;
  70. sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ;
  71. ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ;
  72. return(ret) ;
  73. }
  74. */
  75. /* Custom functions */
  76. //extern uint32_t rand_gen(void);
  77. //#define CUSTOM_RAND_GENERATE rand_gen
  78. //#define CUSTOM_RAND_TYPE uint32_t
  79. extern double current_time(int reset);
  80. #define WOLFSSL_USER_CURRTIME
  81. enum {
  82. WS_SELECT_FAIL,
  83. WS_SELECT_TIMEOUT,
  84. WS_SELECT_RECV_READY,
  85. WS_SELECT_ERROR_READY
  86. };
  87. #define WMEMCPY memcpy
  88. #include <lwip/sockets.h>
  89. #define WFIONREAD FIONREAD
  90. static inline void ws_Ioctl(int fd, int flag, int* ret)
  91. {
  92. int status;
  93. uint32_t bytesSz;
  94. bytesSz = sizeof(*ret);
  95. status = getsockopt(fd, SOL_SOCKET, WFIONREAD, ret, &bytesSz);
  96. if (status != 0) {
  97. /*
  98. WLOG(WS_LOG_ERROR, "Error calling getsockopt()");
  99. *ret = 0;
  100. */
  101. }
  102. }
  103. #define WIOCTL ws_Ioctl
  104. #include "wolfssl_test.h"
  105. /* Debugging - Optional */
  106. #if 0
  107. #define fprintf(file, format, ...) printf(format, ##__VA_ARGS__)
  108. #define DEBUG_WOLFSSL
  109. #endif
  110. #endif