CoAP component relies on some mbedTLS crypto configuration
options, e.g. DTLS and PSK. These configuration options if
selected, have footprint impact on generic TLS examples like
https_request or https_ota as well.
Footprint of https_request example with/without change is per below:
$ ./tools/idf_size.py new_https_request.map --diff old_https_request.map
<CURRENT> MAP file: new_https_request.map
<REFERENCE> MAP file: old_https_request.map
Difference is counted as <CURRENT> - <REFERENCE>, i.e. a positive number means that <CURRENT> is larger.
Total sizes of <CURRENT>: <REFERENCE> Difference
DRAM .data size: 14796 bytes 14796
DRAM .bss size: 23560 bytes 23680 -120
Used static DRAM: 38356 bytes ( 142380 available, 21.2% used) 38476 -120 ( +120 available, +0 total)
Used static IRAM: 89045 bytes ( 42027 available, 67.9% used) 89045 ( +0 available, +0 total)
Flash code: 554231 bytes 563823 -9592
Flash rodata: 179000 bytes 181224 -2224
Total image size:~ 860632 bytes (.bin may be padded larger) 872568 -11936
This commit moves relevant config options to CoAP specific examples
and also adds some run time warnings if they are kept disabled.
Closes https://github.com/espressif/esp-idf/issues/5262
components/coap/port/coap_mbedtls.c:
Add in additional compile time check wrappers for different MbedTLS
configurations.
components/coap/CMakeLists.txt:
components/coap/component.mk:
components/coap/port/coap_notls.c:
components/coap/port/include/coap_config_posix.h:
Add in the ability to compile and run if MbedTLS does not have any TLS
mode enabled.
examples/protocols/coap_client/main/coap_client_example_main.c:
Inform user that MbedTLS Client Mode is required for DTLS if not enabled,
and coaps:// has been requested.
[Lower libcoap library will still error and report this condition]
examples/protocols/coap_server/main/coap_server_example_main.c:
Inform user that MbedTLS Server Mode is required for DTLS if not enabled.
[Lower libcoap library will still error and report this condition]
Closes https://github.com/espressif/esp-idf/issues/3961
Closes https://github.com/espressif/esp-idf/issues/3971
Closes https://github.com/espressif/esp-idf/pull/3977
This update supports DTLS, TLS is a future TODO
components/coap/CMakeLists.txt:
components/coap/component.mk:
Add in the new files that have to be built
Replace libcoap/src/coap_notls.c with libcoap/src/coap_mbedtls.c
components/coap/libcoap:
Update the version to include the current version for supporting MbedTLS
components/coap/port/coap_debug.c:
components/coap/port/coap_mbedtls.c:
components/coap/port/include/coap/coap_dtls.h:
New port files for DTLS
components/coap/port/include/coap_config_posix.h:
Include building with MbedTLS
examples/protocols/coap_client/README.md:
examples/protocols/coap_client/main/CMakeLists.txt:
examples/protocols/coap_client/main/Kconfig.projbuild:
examples/protocols/coap_client/main/coap_client_example_main.c:
examples/protocols/coap_client/main/component.mk:
Update CoAP client to support DTLS
examples/protocols/coap_client/main/coap_ca.pem
examples/protocols/coap_client/main/coap_client.crt
examples/protocols/coap_client/main/coap_client.key
New PKI Certs for CoAP client (copied from wpa2_enterprise example)
examples/protocols/coap_server/README.md:
examples/protocols/coap_server/main/CMakeLists.txt:
examples/protocols/coap_server/main/Kconfig.projbuild:
examples/protocols/coap_server/main/coap_server_example_main.c:
examples/protocols/coap_server/main/component.mk:
Update CoAP server to support DTLS
Change "no data" to "Hello World!" to prevent confusion
examples/protocols/coap_server/main/coap_ca.pem
examples/protocols/coap_server/main/coap_server.crt
examples/protocols/coap_server/main/coap_server.key
New PKI Certs for CoAP server (copied from wpa2_enterprise example)
Closes https://github.com/espressif/esp-idf/pull/3345
Closes https://github.com/espressif/esp-idf/issues/1379
Do not include bootloader in flash target when secure boot is enabled.
Emit signing warning on all cases where signed apps are enabled (secure
boot and signed images)
Follow convention of capital letters for SECURE_BOOT_SIGNING_KEY
variable, since it is
relevant to other components, not just bootloader.
Pass signing key and verification key via config, not requiring
bootloader to know parent app dir.
Misc. variables name corrections
This takes the code up to the latest released version of libcoap.
As there have been API changes, coap_client and coap_server in
examples/protocols have been updated to use the new APIs.
Further information on the new libcoap APIs can be found at
https://libcoap.net/doc/reference/4.2.0/
coap_client has been updated to handle BLOCK2 responses from
"coap://californium.eclipse.org"
coap_client has been modified to only send out one request (and wait for
the response)
coap_server has been updated to support Observe subscriptions, and well as
adding in PUT and DELETE handlers to work on the Espressif resource
coap_server and coap_client have had their stack sizes increased.
port/coap_io.c has been added, a copy of libcoap/src/coap_io.c with support
added for systems that do not have RFC 3542 section 20 support.
port/coap_io_socket.c has been removed as a lot of the code is now
replicated in different libcoap files.
Once this PR is place, then adding in DTLS will be a lot simpler (as a
separate PR)
Signed-off-by: Jitin George <jitin@espressif.com>
Merges https://github.com/espressif/esp-idf/pull/3148