How do I configure mbed TLS-如何配置mbed TLS工程

朴灿烈づ我的快乐病毒、 2022-10-03 00:54 147阅读 0赞

Search

mbed TLS should build out-of-the box on a large variety of platforms. However, you may need to adjust a few platform-specific settings or want to customize the set of features that will be built. All of this is done in a single configuration file.

The configuration file

The default configuration file is located in include/mbedtls/config.h. It is fully documented and divided into sections:

  • System support is where you select options depending on your platform: does your compiler support inline assembly, does your libc/network stack provide IPv6, etc.
  • mbed TLS feature support is where you select which features will be enabled in the corresponding modules: which TLS version to support, which key exchanges, which specific elliptic curves, etc.
  • mbed TLS modules is where you select the modules to be built. Here you can, for example, totally disable RSA or MD5 if you don’t need them.
  • Module configuration options is where you can set specific options for the each module, such as the maximum size of multi-precision integers, the size of the internal I/O buffers for SSL, etc. All of them have reasonable default values.

The configuration script

The configuration file can of course be edited manually with the text editor of your choice. In some cases however it may be useful to set options in a more programmatic way; we provide a Perl script scripts/config.pl for doing so. Usage is as follows:

  1. scripts/config.pl unset <name>
  2. scripts/config.pl set <name> [<value>]

When run this way, from mbed TLS’s root directory, the config script automatically finds the config.hfile. If you want to run it from another directory or on an other configuration file (see below), you’ll need to use the -f option.

Alternative configuration files

Sometimes it is desirable to keep the custom configuration file for your application outside the mbed TLS source tree. This can be easily achieved by defining the macro MBEDTLS_CONFIG_FILE to the desired filename (including the quote or angular brackets) at compile time. For example, using make:

  1. CFLAGS="-Ipath/to/config -DMBEDTLS_CONFIG_FILE='<my_config.h>'" make

or, using Cmake (and clearing its cache first in case it’s not the first run):

  1. find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} +
  2. CFLAGS="-Ipath/to/config -DMBEDTLS_CONFIG_FILE='<my_config.h>'" cmake .
  3. make

We provide a file check_config.h which checks consistency of the configuration file. It is highly recommended to #include it at the end of your custom configuration file. When using the above setup, you may need to adapt the include directive depending on your compiler.

Example configurations

We provide example configurations in the configs directory. These are often minimal configurations for a specific goal, such as supporting the NSA suite B TLS profile. They also often include settings to reduce resource usage.

Did this help?

发表评论

表情:
评论列表 (有 0 条评论,147人围观)

还没有评论,来说两句吧...

相关阅读

    相关 SSL/TLS

    HTTPS协议 = HTTP协议 + SSL/TLS协议 在HTTPS数据传输的过程中,需要用SSL/TLS对数据进行加密和解密,需要用HTTP对加密后的数据进行传输,由

    相关 Poi-tl

    Poi-tl导出word模板 poi-ti是什么 poi-tl是一个Word 模板引擎,基于Apache poi,目标是在文档的任何地方做任何事情。具体详情可以查看

    相关 TLS SSL

    最近大家在使用百度、谷歌或淘宝的时候,是不是注意浏览器左上角已经全部出现了一把绿色锁,这把锁表明该网站已经使用了 HTTPS 进行保护。仔细观察,会发现这些网站已经全站使用 H

    相关 wireshark tls

    想抓一下openfire的包看看,首先要选loopback接口,如果是在本地测试的话。 然后需要搞到rsa私钥,设置好就可以了。 keytool -importke