Add in MbedTLS support

Add in MbedTLS library support as another alternative TLS library

Makefile.am:

Include new src/coap_mbedtls.c file.

configure.ac:

Add in --with-mbedtls support which generates HAVE_MBEDTLS in coap_config.h.

include/coap2/coap_dtls.h:

Add in TLS Library type COAP_TLS_LIBRARY_MBEDTLS and make COAP_TLS_LIBRARY_*
defines an enum.
Add in PKI Key type COAP_PKI_KEY_PEM_BUF for passing in PEM information
that is held in memory instead of in a file.
Add in #define COAP_DTLS_RETRANSMIT_MS, COAP_DTLS_RETRANSMIT_TOTAL_MS
and COAP_DTLS_RETRANSMIT_COAP_TICKS

src/coap_debug.c:

Output MbedTLS information if appropriate.

src/coap_mbedtls.c: (New)

Contains the MbedTLS interface code.

src/coap_notls.c:

Do not use code if MbedTLS is being built.

tests/test_tls.c:

Include MbedTLS library checks.

README.md:

Include MbedTLS as a valid (D)TLS library.
This commit is contained in:
Jon Shallow committed 2020-01-16 09:38:43 +00:00
1 parent cca37f465c
commit f601ddbf78
8 files changed
+2021 -44

No files matched your search

+10
View File
@@ -741,6 +741,16 @@ char *coap_string_tls_version(char *buffer, size_t bufsize)
(unsigned long)((tls_version->built_version >> 8) & 0xff),
(unsigned long)(tls_version->built_version & 0xff));
break;
case COAP_TLS_LIBRARY_MBEDTLS:
snprintf(buffer, bufsize, "TLS Library: MbedTLS - runtime %lu.%lu.%lu, "
"libcoap built for %lu.%lu.%lu",
(unsigned long)(tls_version->version >> 24),
(unsigned long)((tls_version->version >> 16) & 0xff),
(unsigned long)((tls_version->version >> 8) & 0xff),
(unsigned long)(tls_version->built_version >> 24),
(unsigned long)((tls_version->built_version >> 16) & 0xff),
(unsigned long)((tls_version->built_version >> 8) & 0xff));
break;
default:
snprintf(buffer, bufsize, "Library type %d unknown", tls_version->type);
break;