user_settings.h 2.5 KB

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