Coverage Report

Created: 2026-10-15 06:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/curl/lib/vtls/vtls_config.c
Line
Count
Source
1
/***************************************************************************
2
 *                                  _   _ ____  _
3
 *  Project                     ___| | | |  _ \| |
4
 *                             / __| | | | |_) | |
5
 *                            | (__| |_| |  _ <| |___
6
 *                             \___|\___/|_| \_\_____|
7
 *
8
 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9
 *
10
 * This software is licensed as described in the file COPYING, which
11
 * you should have received as part of this distribution. The terms
12
 * are also available at https://curl.se/docs/copyright.html.
13
 *
14
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15
 * copies of the Software, and permit persons to whom the Software is
16
 * furnished to do so, under the terms of the COPYING file.
17
 *
18
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19
 * KIND, either express or implied.
20
 *
21
 * SPDX-License-Identifier: curl
22
 *
23
 ***************************************************************************/
24
25
/* This file is for implementing all "generic" SSL functions that all libcurl
26
   internals should use. It is then responsible for calling the proper
27
   "backend" function.
28
29
   SSL-functions in libcurl should call functions in this source file, and not
30
   to any specific SSL-layer.
31
32
   Curl_ssl_ - prefix for generic ones
33
34
   Note that this source code uses the functions of the configured SSL
35
   backend via the global Curl_ssl instance.
36
37
   "SSL/TLS Strong Encryption: An Introduction"
38
   https://httpd.apache.org/docs/2.0/ssl/ssl_intro.html
39
 */
40
41
#include "curl_setup.h"
42
43
#include "urldata.h"
44
#include "setopt.h"
45
#include "strcase.h"
46
#include "vtls/vtls.h"
47
#include "vtls/vtls_config.h"
48
49
50
#define CLONE_STRING(var)                    \
51
848k
  do {                                       \
52
848k
    if(source->var) {                        \
53
30.5k
      dest->var = curlx_strdup(source->var); \
54
30.5k
      if(!dest->var)                         \
55
30.5k
        return FALSE;                        \
56
30.5k
    }                                        \
57
848k
    else                                     \
58
848k
      dest->var = NULL;                      \
59
848k
  } while(0)
60
61
#define CLONE_BLOB(var)                  \
62
212k
  do {                                   \
63
212k
    if(blobdup(&dest->var, source->var)) \
64
212k
      return FALSE;                      \
65
212k
  } while(0)
66
67
static CURLcode blobdup(struct curl_blob **dest, struct curl_blob *src)
68
212k
{
69
212k
  DEBUGASSERT(dest);
70
212k
  DEBUGASSERT(!*dest);
71
212k
  if(src) {
72
    /* only if there is data to dupe! */
73
0
    struct curl_blob *d;
74
0
    d = curlx_malloc(sizeof(struct curl_blob) + src->len);
75
0
    if(!d)
76
0
      return CURLE_OUT_OF_MEMORY;
77
0
    d->len = src->len;
78
    /* Always duplicate because the connection may survive longer than the
79
       handle that passed in the blob. */
80
0
    d->flags = CURL_BLOB_COPY;
81
0
    d->data = (void *)((char *)d + sizeof(struct curl_blob));
82
0
    memcpy(d->data, src->data, src->len);
83
0
    *dest = d;
84
0
  }
85
212k
  return CURLE_OK;
86
212k
}
87
88
/* returns TRUE if the blobs are identical */
89
static bool blobcmp(struct curl_blob *first, struct curl_blob *second)
90
1.37k
{
91
1.37k
  if(!first && !second) /* both are NULL */
92
1.37k
    return TRUE;
93
0
  if(!first || !second) /* one is NULL */
94
0
    return FALSE;
95
0
  if(first->len != second->len) /* different sizes */
96
0
    return FALSE;
97
0
  return !memcmp(first->data, second->data, first->len); /* same data */
98
0
}
99
100
void Curl_ssl_config_init(struct ssl_easy_config *sslc)
101
107k
{
102
  /*
103
   * libcurl 7.10 introduced SSL verification *by default*! This needs to be
104
   * switched off unless wanted.
105
   */
106
107k
  sslc->verifypeer = TRUE;
107
107k
  sslc->verifyhost = TRUE;
108
107k
  sslc->cache_session = TRUE; /* caching by default */
109
107k
}
110
111
void Curl_ssl_config_cleanup(struct ssl_filter_config *sslc)
112
136k
{
113
136k
  if(sslc->deep_copy) {
114
53.0k
    curlx_safefree(sslc->CApath);
115
53.0k
    curlx_safefree(sslc->CAfile);
116
53.0k
    curlx_safefree(sslc->issuercert);
117
53.0k
    curlx_safefree(sslc->clientcert);
118
53.0k
    curlx_safefree(sslc->cipher_list);
119
53.0k
    curlx_safefree(sslc->cipher_list13);
120
53.0k
    curlx_safefree(sslc->pinned_key);
121
53.0k
    curlx_safefree(sslc->cert_blob);
122
53.0k
    curlx_safefree(sslc->ca_info_blob);
123
53.0k
    curlx_safefree(sslc->issuercert_blob);
124
53.0k
    curlx_safefree(sslc->key_blob);
125
53.0k
    curlx_safefree(sslc->curves);
126
53.0k
    curlx_safefree(sslc->signature_algorithms);
127
53.0k
    curlx_safefree(sslc->CRLfile);
128
53.0k
    curlx_safefree(sslc->cert_type);
129
53.0k
    curlx_safefree(sslc->key);
130
53.0k
    curlx_safefree(sslc->key_type);
131
53.0k
    curlx_safefree(sslc->key_passwd);
132
53.0k
#ifdef USE_ECH
133
53.0k
    curlx_safefree(sslc->ech_config);
134
53.0k
    curlx_safefree(sslc->ech_public);
135
53.0k
#endif
136
53.0k
    sslc->deep_copy = FALSE;
137
53.0k
  }
138
136k
}
139
140
static bool match_ssl_primary_config(struct Curl_easy *data,
141
                                     struct ssl_filter_config *c1,
142
                                     struct ssl_filter_config *c2)
143
344
{
144
344
  (void)data;
145
344
  if((c1->version == c2->version) &&
146
344
     (c1->version_max == c2->version_max) &&
147
344
     (c1->ssl_options == c2->ssl_options) &&
148
344
     (c1->native_ca_store == c2->native_ca_store) &&
149
344
     (c1->verifypeer == c2->verifypeer) &&
150
344
     (c1->verifyhost == c2->verifyhost) &&
151
344
     (c1->verifystatus == c2->verifystatus) &&
152
344
     (c1->auto_client_cert == c2->auto_client_cert) &&
153
344
#ifdef USE_ECH
154
344
     (c1->ech == c2->ech) &&
155
344
     Curl_safecmp(c1->ech_config, c2->ech_config) &&
156
344
     Curl_safecmp(c1->ech_public, c2->ech_public) &&
157
344
#endif
158
344
     blobcmp(c1->cert_blob, c2->cert_blob) &&
159
344
     blobcmp(c1->ca_info_blob, c2->ca_info_blob) &&
160
344
     blobcmp(c1->issuercert_blob, c2->issuercert_blob) &&
161
344
     blobcmp(c1->key_blob, c2->key_blob) &&
162
344
     Curl_safecmp(c1->CApath, c2->CApath) &&
163
344
     Curl_safecmp(c1->CAfile, c2->CAfile) &&
164
344
     Curl_safecmp(c1->issuercert, c2->issuercert) &&
165
344
     Curl_safecmp(c1->clientcert, c2->clientcert) &&
166
344
     curl_strequal(c1->cipher_list, c2->cipher_list) &&
167
344
     curl_strequal(c1->cipher_list13, c2->cipher_list13) &&
168
344
     curl_strequal(c1->curves, c2->curves) &&
169
344
     curl_strequal(c1->signature_algorithms, c2->signature_algorithms) &&
170
344
     Curl_safecmp(c1->CRLfile, c2->CRLfile) &&
171
344
     Curl_safecmp(c1->pinned_key, c2->pinned_key) &&
172
344
     curl_strequal(c1->cert_type, c2->cert_type) &&
173
344
     Curl_safecmp(c1->key, c2->key) &&
174
344
     curl_strequal(c1->key_type, c2->key_type) &&
175
344
     !Curl_timestrcmp(c1->key_passwd, c2->key_passwd))
176
344
    return TRUE;
177
178
0
  return FALSE;
179
344
}
180
181
bool Curl_ssl_conn_config_match(struct Curl_easy *data,
182
                                struct ssl_filter_config *conn_config,
183
                                struct connectdata *candidate,
184
                                bool proxy)
185
344
{
186
344
#ifndef CURL_DISABLE_PROXY
187
344
  if(proxy)
188
0
    return match_ssl_primary_config(data, conn_config,
189
0
                                    &candidate->proxy_ssl_config);
190
#else
191
  (void)proxy;
192
#endif
193
344
  return match_ssl_primary_config(data, conn_config,
194
344
                                  &candidate->ssl_config);
195
344
}
196
197
static bool clone_ssl_primary_config(struct ssl_filter_config *source,
198
                                     struct ssl_filter_config *dest)
199
53.0k
{
200
53.0k
  DEBUGASSERT(!dest->deep_copy);
201
53.0k
  dest->deep_copy = TRUE;
202
53.0k
  dest->version = source->version;
203
53.0k
  dest->version_max = source->version_max;
204
53.0k
  dest->verifypeer = source->verifypeer;
205
53.0k
  dest->verifyhost = source->verifyhost;
206
53.0k
  dest->verifystatus = source->verifystatus;
207
53.0k
  dest->ssl_options = source->ssl_options;
208
53.0k
  dest->native_ca_store = source->native_ca_store;
209
53.0k
  dest->cache_session = source->cache_session;
210
53.0k
  dest->auto_client_cert = source->auto_client_cert;
211
53.0k
  dest->earlydata = source->earlydata;
212
53.0k
  dest->enable_beast = source->enable_beast;
213
53.0k
  dest->no_partialchain = source->no_partialchain;
214
53.0k
  dest->no_revoke = source->no_revoke;
215
53.0k
  dest->revoke_best_effort = source->revoke_best_effort;
216
217
53.0k
  CLONE_BLOB(cert_blob);
218
53.0k
  CLONE_BLOB(ca_info_blob);
219
53.0k
  CLONE_BLOB(issuercert_blob);
220
53.0k
  CLONE_STRING(CApath);
221
53.0k
  CLONE_STRING(CAfile);
222
53.0k
  CLONE_STRING(issuercert);
223
53.0k
  CLONE_STRING(cipher_list);
224
53.0k
  CLONE_STRING(cipher_list13);
225
53.0k
  CLONE_STRING(pinned_key);
226
53.0k
  CLONE_STRING(curves);
227
53.0k
  CLONE_STRING(signature_algorithms);
228
53.0k
  CLONE_STRING(CRLfile);
229
  /* SSL credentials: client certificate */
230
53.0k
  CLONE_STRING(clientcert);
231
53.0k
  CLONE_STRING(cert_type);
232
53.0k
  CLONE_STRING(key);
233
53.0k
  CLONE_STRING(key_type);
234
53.0k
  CLONE_STRING(key_passwd);
235
53.0k
  CLONE_BLOB(key_blob);
236
53.0k
#ifdef USE_ECH
237
53.0k
  dest->ech = source->ech;
238
53.0k
  CLONE_STRING(ech_config);
239
53.0k
  CLONE_STRING(ech_public);
240
53.0k
#endif
241
53.0k
  return TRUE;
242
53.0k
}
243
244
static void
245
ssl_easy_config_compl_options(struct Curl_peer *origin,
246
                              struct Curl_peer *initial_origin,
247
                              struct ssl_easy_config *sslc,
248
                              struct ssl_filter_config *primary)
249
68.3k
{
250
68.3k
  uint8_t options = sslc->ssl_options;
251
  /* If set via CURLOPT_(PROXY_)SSL_OPTIONS, we definitely use it.
252
   * If not, we switch it on for supported backends if no custom
253
   * CA settings exist. */
254
68.3k
  primary->native_ca_store = !!(options & CURLSSLOPT_NATIVE_CA);
255
68.3k
  primary->earlydata = !!(options & CURLSSLOPT_EARLYDATA);
256
68.3k
  primary->auto_client_cert =
257
68.3k
    Curl_peer_equal(origin, initial_origin) &&
258
66.2k
    !!(options & CURLSSLOPT_AUTO_CLIENT_CERT);
259
68.3k
  primary->enable_beast = !!(options & CURLSSLOPT_ALLOW_BEAST);
260
68.3k
  primary->no_partialchain = !!(options & CURLSSLOPT_NO_PARTIALCHAIN);
261
68.3k
  primary->no_revoke = !!(options & CURLSSLOPT_NO_REVOKE);
262
68.3k
  primary->revoke_best_effort = !!(options & CURLSSLOPT_REVOKE_BEST_EFFORT);
263
68.3k
}
264
265
static char *ssl_easy_steal(struct Curl_easy *data, enum dupstring id)
266
940k
{
267
  /* For connection matching, we borrow string references from data
268
   * THIS IS NOT REALLY NICE. */
269
940k
  return CURL_UNCONST(CURL_EASY_STR(data, id));
270
940k
}
271
272
CURLcode Curl_ssl_filter_config_tmp_init(
273
  struct Curl_easy *data, struct Curl_peer *origin,
274
  struct ssl_filter_config *ssl_origin,
275
  struct ssl_filter_config *ssl_proxy)
276
34.1k
{
277
34.1k
  struct ssl_easy_config *sslc = &data->set.ssl;
278
#if defined(CURL_CA_PATH) || defined(CURL_CA_BUNDLE)
279
  CURLcode result;
280
#endif
281
282
34.1k
  ssl_easy_config_compl_options(origin, data->state.initial_origin, sslc,
283
34.1k
                                ssl_origin);
284
285
34.1k
  if(Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL) {
286
#if defined(USE_APPLE_SECTRUST) || defined(CURL_CA_NATIVE)
287
    if(!sslc->custom_capath && !sslc->custom_cafile && !sslc->custom_cablob)
288
      ssl_origin->native_ca_store = TRUE;
289
#endif
290
#ifdef CURL_CA_PATH
291
    if(!sslc->custom_capath && !CURL_EASY_STR(data, STRING_SSL_CAPATH)) {
292
      result = Curl_setstropt(data, STRING_SSL_CAPATH, CURL_CA_PATH);
293
      if(result)
294
        return result;
295
    }
296
#endif
297
#ifdef CURL_CA_BUNDLE
298
    if(!sslc->custom_cafile && !CURL_EASY_STR(data, STRING_SSL_CAFILE)) {
299
      result = Curl_setstropt(data, STRING_SSL_CAFILE, CURL_CA_BUNDLE);
300
      if(result)
301
        return result;
302
    }
303
#endif
304
34.1k
  }
305
306
34.1k
  ssl_origin->version = sslc->version;
307
34.1k
  ssl_origin->version_max = sslc->version_max;
308
34.1k
  ssl_origin->verifypeer = sslc->verifypeer;
309
34.1k
  ssl_origin->verifyhost = sslc->verifyhost;
310
34.1k
  ssl_origin->verifystatus = sslc->verifystatus;
311
34.1k
  ssl_origin->cache_session = sslc->cache_session;
312
34.1k
  ssl_origin->ssl_options = sslc->ssl_options;
313
34.1k
  ssl_origin->CAfile = ssl_easy_steal(data, STRING_SSL_CAFILE);
314
34.1k
  ssl_origin->CRLfile = ssl_easy_steal(data, STRING_SSL_CRLFILE);
315
34.1k
  ssl_origin->CApath = ssl_easy_steal(data, STRING_SSL_CAPATH);
316
34.1k
  ssl_origin->cipher_list = ssl_easy_steal(data, STRING_SSL_CIPHER_LIST);
317
34.1k
  ssl_origin->cipher_list13 = ssl_easy_steal(data, STRING_SSL_CIPHER13_LIST);
318
34.1k
  ssl_origin->signature_algorithms =
319
34.1k
    ssl_easy_steal(data, STRING_SSL_SIGNATURE_ALGORITHMS);
320
34.1k
  ssl_origin->ca_info_blob = data->set.blobs[BLOB_CAINFO];
321
34.1k
  ssl_origin->curves = ssl_easy_steal(data, STRING_SSL_EC_CURVES);
322
  /* Maybe these should not be used for another origin. But for
323
   * backwards compatibility, keep them in. */
324
34.1k
  ssl_origin->issuercert = ssl_easy_steal(data, STRING_SSL_ISSUERCERT);
325
34.1k
  ssl_origin->issuercert_blob = data->set.blobs[BLOB_SSL_ISSUERCERT];
326
327
34.1k
  if(Curl_peer_equal(data->state.initial_origin, origin)) {
328
32.0k
    ssl_origin->pinned_key =
329
32.0k
      ssl_easy_steal(data, STRING_SSL_PINNEDPUBLICKEY);
330
32.0k
    ssl_origin->cert_blob = data->set.blobs[BLOB_CERT];
331
32.0k
    ssl_origin->cert_type = ssl_easy_steal(data, STRING_CERT_TYPE);
332
32.0k
    ssl_origin->key = ssl_easy_steal(data, STRING_KEY);
333
32.0k
    ssl_origin->key_type = ssl_easy_steal(data, STRING_KEY_TYPE);
334
32.0k
    ssl_origin->key_passwd = ssl_easy_steal(data, STRING_KEY_PASSWD);
335
32.0k
    ssl_origin->clientcert = ssl_easy_steal(data, STRING_CERT);
336
32.0k
    ssl_origin->key_blob = data->set.blobs[BLOB_KEY];
337
32.0k
#ifdef USE_ECH
338
32.0k
    ssl_origin->ech = data->set.ssl.ech;
339
32.0k
    ssl_origin->ech_config = ssl_easy_steal(data, STRING_ECH_CONFIG);
340
32.0k
    ssl_origin->ech_public = ssl_easy_steal(data, STRING_ECH_PUBLIC);
341
32.0k
#endif
342
32.0k
  }
343
2.10k
  else {
344
2.10k
    ssl_origin->pinned_key = NULL;
345
2.10k
    ssl_origin->cert_blob = NULL;
346
2.10k
    ssl_origin->cert_type = NULL;
347
2.10k
    ssl_origin->key = NULL;
348
2.10k
    ssl_origin->key_type = NULL;
349
2.10k
    ssl_origin->key_passwd = NULL;
350
2.10k
    ssl_origin->clientcert = NULL;
351
2.10k
    ssl_origin->key_blob = NULL;
352
2.10k
#ifdef USE_ECH
353
2.10k
    ssl_origin->ech = 0;
354
2.10k
    ssl_origin->ech_config = NULL;
355
2.10k
    ssl_origin->ech_public = NULL;
356
2.10k
#endif
357
2.10k
  }
358
359
34.1k
#ifndef CURL_DISABLE_PROXY
360
34.1k
  sslc = &data->set.proxy_ssl;
361
362
34.1k
  ssl_easy_config_compl_options(NULL, NULL, sslc, ssl_proxy);
363
34.1k
  if((Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL)) {
364
    /* no initial origin for proxy, it is not changed for redirects */
365
#if defined(USE_APPLE_SECTRUST) || defined(CURL_CA_NATIVE)
366
    if(!sslc->custom_capath && !sslc->custom_cafile && !sslc->custom_cablob)
367
      ssl_proxy->native_ca_store = TRUE;
368
#endif
369
#ifdef CURL_CA_PATH
370
    if(!sslc->custom_capath &&
371
       !CURL_EASY_STR(data, STRING_SSL_CAPATH_PROXY)) {
372
      result = Curl_setstropt(data, STRING_SSL_CAPATH_PROXY, CURL_CA_PATH);
373
      if(result)
374
        return result;
375
    }
376
#endif
377
#ifdef CURL_CA_BUNDLE
378
    if(!sslc->custom_cafile &&
379
       !CURL_EASY_STR(data, STRING_SSL_CAFILE_PROXY)) {
380
      result = Curl_setstropt(data, STRING_SSL_CAFILE_PROXY, CURL_CA_BUNDLE);
381
      if(result)
382
        return result;
383
    }
384
#endif
385
34.1k
  }
386
387
34.1k
  ssl_proxy->version = sslc->version;
388
34.1k
  ssl_proxy->version_max = sslc->version_max;
389
34.1k
  ssl_proxy->verifypeer = sslc->verifypeer;
390
34.1k
  ssl_proxy->verifyhost = sslc->verifyhost;
391
34.1k
  ssl_proxy->verifystatus = sslc->verifystatus;
392
34.1k
  ssl_proxy->cache_session = sslc->cache_session;
393
34.1k
  ssl_proxy->ssl_options = sslc->ssl_options;
394
34.1k
  ssl_proxy->CAfile = ssl_easy_steal(data, STRING_SSL_CAFILE_PROXY);
395
34.1k
  ssl_proxy->CApath = ssl_easy_steal(data, STRING_SSL_CAPATH_PROXY);
396
34.1k
  ssl_proxy->cipher_list =
397
34.1k
    ssl_easy_steal(data, STRING_SSL_CIPHER_LIST_PROXY);
398
34.1k
  ssl_proxy->cipher_list13 =
399
34.1k
    ssl_easy_steal(data, STRING_SSL_CIPHER13_LIST_PROXY);
400
34.1k
  ssl_proxy->pinned_key =
401
34.1k
    ssl_easy_steal(data, STRING_SSL_PINNEDPUBLICKEY_PROXY);
402
34.1k
  ssl_proxy->cert_blob = data->set.blobs[BLOB_CERT_PROXY];
403
34.1k
  ssl_proxy->ca_info_blob = data->set.blobs[BLOB_CAINFO_PROXY];
404
34.1k
  ssl_proxy->issuercert = ssl_easy_steal(data, STRING_SSL_ISSUERCERT_PROXY);
405
34.1k
  ssl_proxy->issuercert_blob = data->set.blobs[BLOB_SSL_ISSUERCERT_PROXY];
406
34.1k
  ssl_proxy->CRLfile = ssl_easy_steal(data, STRING_SSL_CRLFILE_PROXY);
407
34.1k
  ssl_proxy->cert_type = ssl_easy_steal(data, STRING_CERT_TYPE_PROXY);
408
34.1k
  ssl_proxy->key = ssl_easy_steal(data, STRING_KEY_PROXY);
409
34.1k
  ssl_proxy->key_type = ssl_easy_steal(data, STRING_KEY_TYPE_PROXY);
410
34.1k
  ssl_proxy->key_passwd = ssl_easy_steal(data, STRING_KEY_PASSWD_PROXY);
411
34.1k
  ssl_proxy->clientcert = ssl_easy_steal(data, STRING_CERT_PROXY);
412
34.1k
  ssl_proxy->key_blob = data->set.blobs[BLOB_KEY_PROXY];
413
34.1k
#ifdef USE_ECH
414
  /* Not configurable via a CURLOPT_* */
415
34.1k
  ssl_proxy->ech = 0;
416
34.1k
  ssl_proxy->ech_config = NULL;
417
34.1k
  ssl_proxy->ech_public = NULL;
418
34.1k
#endif
419
#else
420
  (void)ssl_proxy;
421
#endif /* CURL_DISABLE_PROXY */
422
423
34.1k
  return CURLE_OK;
424
34.1k
}
425
426
CURLcode Curl_ssl_conn_config_clone(struct ssl_filter_config *ssl_config,
427
                                    struct ssl_filter_config *proxy_ssl_config,
428
                                    struct connectdata *conn)
429
26.5k
{
430
  /* Clone "primary" SSL configurations from the easy handle to
431
   * the connection. They are used for connection cache matching and
432
   * probably outlive the easy handle */
433
26.5k
  if(!clone_ssl_primary_config(ssl_config, &conn->ssl_config))
434
0
    return CURLE_OUT_OF_MEMORY;
435
26.5k
#ifndef CURL_DISABLE_PROXY
436
26.5k
  if(proxy_ssl_config &&
437
26.5k
     !clone_ssl_primary_config(proxy_ssl_config, &conn->proxy_ssl_config))
438
0
    return CURLE_OUT_OF_MEMORY;
439
#else
440
  (void)proxy_ssl_config;
441
#endif
442
26.5k
  return CURLE_OK;
443
26.5k
}
444
445
void Curl_ssl_conn_config_cleanup(struct connectdata *conn)
446
34.2k
{
447
34.2k
  Curl_ssl_config_cleanup(&conn->ssl_config);
448
34.2k
#ifndef CURL_DISABLE_PROXY
449
34.2k
  Curl_ssl_config_cleanup(&conn->proxy_ssl_config);
450
34.2k
#endif
451
34.2k
}
452
453
void Curl_ssl_conn_config_update(struct Curl_easy *data, bool for_proxy)
454
1.52k
{
455
  /* May be called on an easy that has no connection yet */
456
1.52k
  if(data->conn) {
457
0
    struct ssl_easy_config *src;
458
0
    struct ssl_filter_config *dest;
459
0
#ifndef CURL_DISABLE_PROXY
460
0
    src = for_proxy ? &data->set.proxy_ssl : &data->set.ssl;
461
0
    dest = for_proxy ? &data->conn->proxy_ssl_config : &data->conn->ssl_config;
462
#else
463
    (void)for_proxy;
464
    src = &data->set.ssl;
465
    dest = &data->conn->ssl_config;
466
#endif
467
0
    dest->verifyhost = src->verifyhost;
468
0
    dest->verifypeer = src->verifypeer;
469
0
    dest->verifystatus = src->verifystatus;
470
0
#ifdef USE_ECH
471
0
    dest->ech = src->ech;
472
0
#endif
473
0
  }
474
1.52k
}