summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-04-03 20:31:29 +0000
committerFelix Fietkau2024-04-03 20:41:57 +0000
commit268050964b088a6000cca750e92dc6b5f54bbe7f (patch)
treec398d8954764ca21418ebb58564ca425c7722a47
parent7621339d7694abef5da5e5353ac440f2d39dcecb (diff)
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 <nbd@nbd.name>
-rw-r--r--ustream-mbedtls.c8
1 files changed, 8 insertions, 0 deletions
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 <psa/crypto.h>
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;