diff options
author | Damien George <damien@micropython.org> | 2023-05-09 09:52:16 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-06-23 15:22:27 +1000 |
commit | e7ae3ad92d7540cbe349cc05f5d62e0f63fce59b (patch) | |
tree | e86a9530df1c949f02d1ab92d6d7fa6f1e0b634a /extmod/modssl_mbedtls.c | |
parent | 41c91422f083aaf61036c8ead26bf0c43111ae00 (diff) | |
download | micropython-e7ae3ad92d7540cbe349cc05f5d62e0f63fce59b.tar.gz micropython-e7ae3ad92d7540cbe349cc05f5d62e0f63fce59b.zip |
extmod: Update to support mbedtls 3.x.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/modssl_mbedtls.c')
-rw-r--r-- | extmod/modssl_mbedtls.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/extmod/modssl_mbedtls.c b/extmod/modssl_mbedtls.c index c230b1eaa2..e346f986f7 100644 --- a/extmod/modssl_mbedtls.c +++ b/extmod/modssl_mbedtls.c @@ -225,7 +225,11 @@ STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) { size_t key_len; const byte *key = (const byte *)mp_obj_str_get_data(args->key.u_obj, &key_len); // len should include terminating null + #if MBEDTLS_VERSION_NUMBER >= 0x03000000 + ret = mbedtls_pk_parse_key(&o->pkey, key, key_len + 1, NULL, 0, mbedtls_ctr_drbg_random, &o->ctr_drbg); + #else ret = mbedtls_pk_parse_key(&o->pkey, key, key_len + 1, NULL, 0); + #endif if (ret != 0) { ret = MBEDTLS_ERR_PK_BAD_INPUT_DATA; // use general error for all key errors goto cleanup; |