@@ -359,6 +359,7 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
359
359
struct wolfssl_ssl_backend_data * backend =
360
360
(struct wolfssl_ssl_backend_data * )connssl -> backend ;
361
361
struct ssl_primary_config * conn_config = Curl_ssl_cf_get_primary_config (cf );
362
+ const struct curl_blob * ca_info_blob = conn_config -> ca_info_blob ;
362
363
const struct ssl_config_data * ssl_config = Curl_ssl_cf_get_config (cf , data );
363
364
SSL_METHOD * req_method = NULL ;
364
365
#ifdef HAVE_LIBOQS
@@ -371,6 +372,7 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
371
372
#else
372
373
#define use_sni (x ) Curl_nop_stmt
373
374
#endif
375
+ bool imported_ca_info_blob = false;
374
376
375
377
DEBUGASSERT (backend );
376
378
@@ -504,13 +506,28 @@ wolfssl_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
504
506
}
505
507
}
506
508
}
509
+
510
+ if (ca_info_blob ) {
511
+ if (wolfSSL_CTX_load_verify_buffer (
512
+ backend -> ctx , ca_info_blob -> data , ca_info_blob -> len ,
513
+ SSL_FILETYPE_PEM
514
+ ) != SSL_SUCCESS ) {
515
+ failf (data , "error importing CA certificate blob" );
516
+ return CURLE_SSL_CACERT_BADFILE ;
517
+ }
518
+ else {
519
+ imported_ca_info_blob = true;
520
+ infof (data , "successfully imported CA certificate blob" );
521
+ }
522
+ }
523
+
507
524
#ifndef NO_FILESYSTEM
508
525
/* load trusted cacert */
509
526
if (conn_config -> CAfile ) {
510
527
if (1 != SSL_CTX_load_verify_locations (backend -> ctx ,
511
528
conn_config -> CAfile ,
512
529
conn_config -> CApath )) {
513
- if (conn_config -> verifypeer ) {
530
+ if (conn_config -> verifypeer && ! imported_ca_info_blob ) {
514
531
/* Fail if we insist on successfully verifying the server. */
515
532
failf (data , "error setting certificate verify locations:"
516
533
" CAfile: %s CApath: %s" ,
@@ -1341,6 +1358,7 @@ const struct Curl_ssl Curl_ssl_wolfssl = {
1341
1358
#ifdef USE_BIO_CHAIN
1342
1359
SSLSUPP_HTTPS_PROXY |
1343
1360
#endif
1361
+ SSLSUPP_CAINFO_BLOB |
1344
1362
SSLSUPP_SSL_CTX ,
1345
1363
1346
1364
sizeof (struct wolfssl_ssl_backend_data ),
0 commit comments