Skip to content

Commit

Permalink
[ssl] Initialize PSA crypto when it is present.
Browse files Browse the repository at this point in the history
In mbedtls 3.6 TLS 1.3 support is turned on by default which uses PSA crypto

See HaxeFoundation/hashlink#681
  • Loading branch information
Apprentice-Alchemist authored and tobil4sk committed Jul 2, 2024
1 parent 8934d85 commit 13cc88d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/ssl/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ typedef int SOCKET;
#include "mbedtls/x509_crt.h"
#include "mbedtls/ssl.h"

#ifdef MBEDTLS_PSA_CRYPTO_C
#include <psa/crypto.h>
#endif

#define val_ssl(o) (mbedtls_ssl_context*)val_data(o)
#define val_conf(o) (mbedtls_ssl_config*)val_data(o)
#define val_cert(o) (mbedtls_x509_crt*)val_data(o)
Expand Down Expand Up @@ -807,6 +811,10 @@ void ssl_main() {
mbedtls_entropy_init( &entropy );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy, NULL, 0 );

#ifdef MBEDTLS_PSA_CRYPTO_C
psa_crypto_init();
#endif
}

DEFINE_PRIM( ssl_new, 1 );
Expand Down

0 comments on commit 13cc88d

Please sign in to comment.