@@ -340,16 +340,30 @@ int8_t tls_sec_prot_lib_connect(tls_security_t *sec, bool is_server, const sec_p
340
340
return -1 ;
341
341
}
342
342
343
+ // Defines MBEDTLS_SSL_CONF_RECV/SEND/RECV_TIMEOUT define global functions which should be the same for all
344
+ // callers of mbedtls_ssl_set_bio_ctx and there should be only one ssl context. If these rules don't apply,
345
+ // these defines can't be used.
346
+ #if !defined(MBEDTLS_SSL_CONF_RECV ) && !defined(MBEDTLS_SSL_CONF_SEND ) && !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT )
343
347
// Set calbacks
344
348
mbedtls_ssl_set_bio (& sec -> ssl , sec , tls_sec_prot_lib_ssl_send , tls_sec_prot_lib_ssl_recv , NULL );
349
+ #else
350
+ mbedtls_ssl_set_bio_ctx (& sec -> ssl , sec );
351
+ #endif /* !defined(MBEDTLS_SSL_CONF_RECV) && !defined(MBEDTLS_SSL_CONF_SEND) && !defined(MBEDTLS_SSL_CONF_RECV_TIMEOUT) */
352
+
353
+ // Defines MBEDTLS_SSL_CONF_SET_TIMER/GET_TIMER define global functions which should be the same for all
354
+ // callers of mbedtls_ssl_set_timer_cb and there should be only one ssl context. If these rules don't apply,
355
+ // these defines can't be used.
356
+ #if !defined(MBEDTLS_SSL_CONF_SET_TIMER ) && !defined(MBEDTLS_SSL_CONF_GET_TIMER )
345
357
mbedtls_ssl_set_timer_cb (& sec -> ssl , sec , tls_sec_prot_lib_ssl_set_timer , tls_sec_prot_lib_ssl_get_timer );
358
+ #endif /* !defined(MBEDTLS_SSL_CONF_SET_TIMER) && !defined(MBEDTLS_SSL_CONF_GET_TIMER) */
346
359
347
360
// Configure certificates, keys and certificate revocation list
348
361
if (tls_sec_prot_lib_configure_certificates (sec , certs ) != 0 ) {
349
362
tr_error ("cert conf fail" );
350
363
return -1 ;
351
364
}
352
365
366
+ #if !defined(MBEDTLS_SSL_CONF_SINGLE_CIPHERSUITE )
353
367
// Configure ciphersuites
354
368
static const int sec_suites [] = {
355
369
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 ,
@@ -358,6 +372,7 @@ int8_t tls_sec_prot_lib_connect(tls_security_t *sec, bool is_server, const sec_p
358
372
0
359
373
};
360
374
mbedtls_ssl_conf_ciphersuites (& sec -> conf , sec_suites );
375
+ #endif /* !defined(MBEDTLS_SSL_CONF_SINGLE_CIPHERSUITE) */
361
376
362
377
#ifdef TLS_SEC_PROT_LIB_TLS_DEBUG
363
378
mbedtls_ssl_conf_dbg (& sec -> conf , tls_sec_prot_lib_debug , sec );
@@ -367,8 +382,13 @@ int8_t tls_sec_prot_lib_connect(tls_security_t *sec, bool is_server, const sec_p
367
382
// Export keys callback
368
383
mbedtls_ssl_conf_export_keys_ext_cb (& sec -> conf , tls_sec_prot_lib_ssl_export_keys , sec );
369
384
385
+ #if !defined(MBEDTLS_SSL_CONF_MIN_MINOR_VER ) || !defined(MBEDTLS_SSL_CONF_MIN_MAJOR_VER )
370
386
mbedtls_ssl_conf_min_version (& sec -> conf , MBEDTLS_SSL_MAJOR_VERSION_3 , MBEDTLS_SSL_MAJOR_VERSION_3 );
387
+ #endif /* !defined(MBEDTLS_SSL_CONF_MIN_MINOR_VER) || !defined(MBEDTLS_SSL_CONF_MIN_MAJOR_VER) */
388
+
389
+ #if !defined(MBEDTLS_SSL_CONF_MAX_MINOR_VER ) || !defined(MBEDTLS_SSL_CONF_MAX_MAJOR_VER )
371
390
mbedtls_ssl_conf_max_version (& sec -> conf , MBEDTLS_SSL_MAJOR_VERSION_3 , MBEDTLS_SSL_MAJOR_VERSION_3 );
391
+ #endif /* !defined(MBEDTLS_SSL_CONF_MAX_MINOR_VER) || !defined(MBEDTLS_SSL_CONF_MAX_MAJOR_VER) */
372
392
373
393
// Set certificate verify callback
374
394
mbedtls_ssl_set_verify (& sec -> ssl , tls_sec_prot_lib_x509_crt_verify , sec );
0 commit comments