Kconfig 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. # Cryptography primitive options for mbed TLS
  2. # Copyright (c) 2016 Intel Corporation
  3. # SPDX-License-Identifier: Apache-2.0
  4. config ZEPHYR_MBEDTLS_MODULE
  5. bool
  6. config MBEDTLS_PROMPTLESS
  7. bool
  8. help
  9. Symbol to disable the prompt for MBEDTLS selection.
  10. This symbol may be used internally in a Kconfig tree to hide the
  11. mbed TLS menu prompt and instead handle the selection of MBEDTLS from
  12. dependent sub-configurations and thus preven stuck symbol behavior.
  13. menuconfig MBEDTLS
  14. bool "mbed TLS Support" if !MBEDTLS_PROMPTLESS
  15. help
  16. This option enables the mbedTLS cryptography library.
  17. if MBEDTLS
  18. choice MBEDTLS_IMPLEMENTATION
  19. prompt "Select implementation"
  20. default MBEDTLS_BUILTIN
  21. config MBEDTLS_BUILTIN
  22. bool "Use Zephyr in-tree mbedTLS version"
  23. help
  24. Link with mbedTLS sources included with Zephyr distribution.
  25. Included mbedTLS version is well integrated with and supported
  26. by Zephyr, and the recommended choice for most users.
  27. config MBEDTLS_LIBRARY
  28. bool "Use external mbedTLS library"
  29. help
  30. Use external, out-of-tree prebuilt mbedTLS library. For advanced
  31. users only.
  32. endchoice
  33. config CUSTOM_MBEDTLS_CFG_FILE
  34. bool "Custom mbed TLS configuration file"
  35. help
  36. Allow user defined input for the MBEDTLS_CFG_FILE setting.
  37. You can specify the actual configuration file using the
  38. MBEDTLS_CFG_FILE setting.
  39. config MBEDTLS_CFG_FILE
  40. string "mbed TLS configuration file" if CUSTOM_MBEDTLS_CFG_FILE
  41. depends on MBEDTLS_BUILTIN
  42. default "config-tls-generic.h"
  43. help
  44. Use a specific mbedTLS configuration file. The default config file
  45. file can be tweaked with Kconfig. The default configuration is
  46. suitable to communicate with majority of HTTPS servers on the Internet,
  47. but has relatively many features enabled. To optimize resources for
  48. special TLS usage, use available Kconfig options, or select an
  49. alternative config.
  50. rsource "Kconfig.tls-generic"
  51. config MBEDTLS_SSL_MAX_CONTENT_LEN
  52. int "Max payload size for TLS protocol message"
  53. default 1500
  54. depends on MBEDTLS_BUILTIN
  55. help
  56. The TLS standards mandate max payload size of 16384 bytes. So, for
  57. maximum operability and for general-purpose usage, that value must
  58. be used. For specific usages, that value can be largely decreased.
  59. E.g. for DTLS, payload size is limited by UDP datagram size, and
  60. even for HTTPS REST API, the payload can be limited to max size of
  61. (REST request, REST response, server certificate(s)).
  62. mbedTLS uses this value separate for input and output buffers, so
  63. twice this value will be allocated (on mbedTLS own heap, so the
  64. value of MBEDTLS_HEAP_SIZE should accommodate that).
  65. config MBEDTLS_DEBUG
  66. bool "mbed TLS debug activation"
  67. depends on MBEDTLS_BUILTIN
  68. help
  69. Enable debugging activation for mbed TLS configuration. If you use
  70. mbedTLS/Zephyr integration (e.g. net_app), this will activate debug
  71. logging (of the level configured by MBEDTLS_DEBUG_LEVEL).
  72. If you use mbedTLS directly instead, you will need to perform
  73. additional configuration yourself: call
  74. mbedtls_ssl_conf_dbg(&mbedtls.conf, my_debug, NULL);
  75. mbedtls_debug_set_threshold(level);
  76. functions in your application, and create the my_debug() function to
  77. actually print something useful.
  78. config MBEDTLS_DEBUG_LEVEL
  79. int "mbed TLS default debug level"
  80. depends on MBEDTLS_DEBUG
  81. default 0
  82. range 0 4
  83. help
  84. Default mbed TLS debug logging level for Zephyr integration code
  85. (from ext/lib/crypto/mbedtls/include/mbedtls/debug.h):
  86. 0 No debug
  87. 1 Error
  88. 2 State change
  89. 3 Information
  90. 4 Verbose
  91. config MBEDTLS_MEMORY_DEBUG
  92. bool "mbed TLS memory debug activation"
  93. depends on MBEDTLS_BUILTIN
  94. help
  95. Enable debugging of buffer allocator memory issues. Automatically
  96. prints (to stderr) all (fatal) messages on memory allocation
  97. issues. Enables function for 'debug output' of allocated memory.
  98. config MBEDTLS_TEST
  99. bool "Compile internal self test functions"
  100. depends on MBEDTLS_BUILTIN
  101. help
  102. Enable self test function for the crypto algorithms
  103. config MBEDTLS_INSTALL_PATH
  104. string "mbedTLS install path"
  105. depends on MBEDTLS_LIBRARY
  106. help
  107. This option holds the path where the mbedTLS libraries and headers are
  108. installed. Make sure this option is properly set when MBEDTLS_LIBRARY
  109. is enabled otherwise the build will fail.
  110. config MBEDTLS_ENABLE_HEAP
  111. bool "Enable global heap for mbed TLS"
  112. help
  113. This option enables the mbedtls to use the heap. This setting must
  114. be global so that various applications and libraries in Zephyr do not
  115. try to do this themselves as there can be only one heap defined
  116. in mbedtls. If this is enabled, then the Zephyr will, during the device
  117. startup, initialize the heap automatically.
  118. config MBEDTLS_HEAP_SIZE
  119. int "Heap size for mbed TLS"
  120. default 10240 if OPENTHREAD_COMMISSIONER || OPENTHREAD_JOINER
  121. default 512
  122. depends on MBEDTLS_ENABLE_HEAP
  123. help
  124. The mbedtls routines will use this heap if enabled.
  125. See ext/lib/crypto/mbedtls/include/mbedtls/config.h and
  126. MBEDTLS_MEMORY_BUFFER_ALLOC_C option for details. That option is not
  127. enabled by default.
  128. Default value for the heap size is not set as it depends on the
  129. application. For streaming communication with arbitrary (HTTPS)
  130. servers on the Internet, 32KB + overheads (up to another 20KB) may
  131. be needed. For some dedicated and specific usage of mbedtls API, the
  132. 1000 bytes might be ok.
  133. config MBEDTLS_SHELL
  134. bool "mbed TLS shell"
  135. depends on MBEDTLS
  136. depends on SHELL
  137. help
  138. Enable mbed TLS shell module, which allows to show debug information
  139. about mbed TLS library, such as heap usage.
  140. config APP_LINK_WITH_MBEDTLS
  141. bool "Link 'app' with MBEDTLS"
  142. default y
  143. help
  144. Add MBEDTLS header files to the 'app' include path. It may be
  145. disabled if the include paths for MBEDTLS are causing aliasing
  146. issues for 'app'.
  147. endif # MBEDTLS