From: Felix Fietkau Date: Wed, 3 Apr 2024 20:31:29 +0000 (+0200) Subject: ustream-mbedtls: add missing psa_crypto_init call X-Git-Url: http://git.openwrt.org/openwrt/svn-archive.git?a=commitdiff_plain;h=268050964b088a6000cca750e92dc6b5f54bbe7f;p=project%2Fustream-ssl.git ustream-mbedtls: add missing psa_crypto_init call Required for a few features, including TLS1.3 on newer mbedtls versions Signed-off-by: Felix Fietkau --- diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c index 18ffe06..13785ce 100644 --- a/ustream-mbedtls.c +++ b/ustream-mbedtls.c @@ -25,6 +25,7 @@ #include "ustream-ssl.h" #include "ustream-internal.h" +#include static int s_ustream_read(void *ctx, unsigned char *buf, size_t len) { @@ -136,6 +137,13 @@ __ustream_ssl_context_new(bool server) mbedtls_ssl_config *conf; int ep; +#ifdef MBEDTLS_PSA_CRYPTO_C + static bool psa_init; + + if (!psa_init && !psa_crypto_init()) + psa_init = true; +#endif + ctx = calloc(1, sizeof(*ctx)); if (!ctx) return NULL;