blob: fefc6d0ddd83635c29de11f6e9811f243d14813c [file] [log] [blame]
Paul Bakker0a597072012-09-25 21:55:46 +00001/*
2 * SSL session cache implementation
3 *
Manuel Pégourié-Gonnard6fb81872015-07-27 11:11:48 +02004 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +02005 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
Paul Bakker0a597072012-09-25 21:55:46 +000018 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000019 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker0a597072012-09-25 21:55:46 +000020 */
21/*
22 * These session callbacks use a simple chained list
23 * to store and retrieve the session information.
24 */
25
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020026#if !defined(MBEDTLS_CONFIG_FILE)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000027#include "mbedtls/config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020028#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020029#include MBEDTLS_CONFIG_FILE
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020030#endif
Paul Bakker0a597072012-09-25 21:55:46 +000031
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020032#if defined(MBEDTLS_SSL_CACHE_C)
Paul Bakker0a597072012-09-25 21:55:46 +000033
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020034#if defined(MBEDTLS_PLATFORM_C)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000035#include "mbedtls/platform.h"
Paul Bakker6e339b52013-07-03 13:37:05 +020036#else
Rich Evans00ab4702015-02-06 13:43:58 +000037#include <stdlib.h>
Manuel Pégourié-Gonnard7551cb92015-05-26 16:04:06 +020038#define mbedtls_calloc calloc
SimonBd5800b72016-04-26 07:43:27 +010039#define mbedtls_free free
Paul Bakker6e339b52013-07-03 13:37:05 +020040#endif
41
SimonBd5800b72016-04-26 07:43:27 +010042#include "mbedtls/ssl_cache.h"
Hanno Beckera177b382019-02-06 14:53:19 +000043#include "mbedtls/ssl_internal.h"
SimonBd5800b72016-04-26 07:43:27 +010044
45#include <string.h>
46
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020047void mbedtls_ssl_cache_init( mbedtls_ssl_cache_context *cache )
Paul Bakker0a597072012-09-25 21:55:46 +000048{
Manuel Pégourié-Gonnard7a346b82019-10-02 14:47:01 +020049 mbedtls_platform_memset( cache, 0, sizeof( mbedtls_ssl_cache_context ) );
Paul Bakker0a597072012-09-25 21:55:46 +000050
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020051 cache->timeout = MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT;
52 cache->max_entries = MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES;
Paul Bakkerc5598842013-09-28 15:01:27 +020053
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020054#if defined(MBEDTLS_THREADING_C)
55 mbedtls_mutex_init( &cache->mutex );
Paul Bakkerc5598842013-09-28 15:01:27 +020056#endif
Paul Bakker0a597072012-09-25 21:55:46 +000057}
58
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020059int mbedtls_ssl_cache_get( void *data, mbedtls_ssl_session *session )
Paul Bakker0a597072012-09-25 21:55:46 +000060{
Paul Bakkerc5598842013-09-28 15:01:27 +020061 int ret = 1;
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020062#if defined(MBEDTLS_HAVE_TIME)
SimonBd5800b72016-04-26 07:43:27 +010063 mbedtls_time_t t = mbedtls_time( NULL );
Paul Bakkerfa9b1002013-07-03 15:31:03 +020064#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020065 mbedtls_ssl_cache_context *cache = (mbedtls_ssl_cache_context *) data;
66 mbedtls_ssl_cache_entry *cur, *entry;
Paul Bakker0a597072012-09-25 21:55:46 +000067
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020068#if defined(MBEDTLS_THREADING_C)
69 if( mbedtls_mutex_lock( &cache->mutex ) != 0 )
Paul Bakkerc5598842013-09-28 15:01:27 +020070 return( 1 );
71#endif
72
Paul Bakker0a597072012-09-25 21:55:46 +000073 cur = cache->chain;
74 entry = NULL;
75
76 while( cur != NULL )
77 {
78 entry = cur;
79 cur = cur->next;
80
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020081#if defined(MBEDTLS_HAVE_TIME)
Paul Bakker0a597072012-09-25 21:55:46 +000082 if( cache->timeout != 0 &&
83 (int) ( t - entry->timestamp ) > cache->timeout )
84 continue;
Paul Bakkerfa9b1002013-07-03 15:31:03 +020085#endif
Paul Bakker0a597072012-09-25 21:55:46 +000086
Hanno Beckere02758c2019-06-26 15:31:31 +010087 if( mbedtls_ssl_session_get_ciphersuite( session ) !=
88 mbedtls_ssl_session_get_ciphersuite( &entry->session ) ||
Hanno Becker88440552019-07-03 14:16:13 +010089 mbedtls_ssl_session_get_compression( session ) !=
90 mbedtls_ssl_session_get_compression( &entry->session ) ||
Manuel Pégourié-Gonnard12ad7982015-06-18 15:50:37 +020091 session->id_len != entry->session.id_len )
Hanno Beckere02758c2019-06-26 15:31:31 +010092 {
Paul Bakker0a597072012-09-25 21:55:46 +000093 continue;
Hanno Beckere02758c2019-06-26 15:31:31 +010094 }
Paul Bakker0a597072012-09-25 21:55:46 +000095
96 if( memcmp( session->id, entry->session.id,
Manuel Pégourié-Gonnard12ad7982015-06-18 15:50:37 +020097 entry->session.id_len ) != 0 )
Paul Bakker0a597072012-09-25 21:55:46 +000098 continue;
99
Hanno Beckera177b382019-02-06 14:53:19 +0000100 ret = mbedtls_ssl_session_copy( session, &entry->session );
101 if( ret != 0 )
102 {
103 ret = 1;
104 goto exit;
105 }
Manuel Pégourié-Gonnard38d1eba2013-08-23 10:44:29 +0200106
Hanno Becker2e6d3472019-02-06 15:40:27 +0000107#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
108 defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
Paul Bakkere81beda2013-03-06 17:40:46 +0100109 /*
110 * Restore peer certificate (without rest of the original chain)
111 */
112 if( entry->peer_cert.p != NULL )
113 {
Hanno Beckera177b382019-02-06 14:53:19 +0000114 /* `session->peer_cert` is NULL after the call to
115 * mbedtls_ssl_session_copy(), because cache entries
116 * have the `peer_cert` field set to NULL. */
117
Manuel Pégourié-Gonnard7551cb92015-05-26 16:04:06 +0200118 if( ( session->peer_cert = mbedtls_calloc( 1,
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200119 sizeof(mbedtls_x509_crt) ) ) == NULL )
Paul Bakkerc5598842013-09-28 15:01:27 +0200120 {
121 ret = 1;
122 goto exit;
123 }
Paul Bakkere81beda2013-03-06 17:40:46 +0100124
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200125 mbedtls_x509_crt_init( session->peer_cert );
126 if( mbedtls_x509_crt_parse( session->peer_cert, entry->peer_cert.p,
Paul Bakkerddf26b42013-09-18 13:46:23 +0200127 entry->peer_cert.len ) != 0 )
Paul Bakkere81beda2013-03-06 17:40:46 +0100128 {
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200129 mbedtls_free( session->peer_cert );
Paul Bakkere81beda2013-03-06 17:40:46 +0100130 session->peer_cert = NULL;
Paul Bakkerc5598842013-09-28 15:01:27 +0200131 ret = 1;
132 goto exit;
Paul Bakkere81beda2013-03-06 17:40:46 +0100133 }
134 }
Hanno Becker2e6d3472019-02-06 15:40:27 +0000135#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
Paul Bakkere81beda2013-03-06 17:40:46 +0100136
Paul Bakkerc5598842013-09-28 15:01:27 +0200137 ret = 0;
138 goto exit;
Paul Bakker0a597072012-09-25 21:55:46 +0000139 }
140
Paul Bakkerc5598842013-09-28 15:01:27 +0200141exit:
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200142#if defined(MBEDTLS_THREADING_C)
143 if( mbedtls_mutex_unlock( &cache->mutex ) != 0 )
Paul Bakkerc5598842013-09-28 15:01:27 +0200144 ret = 1;
145#endif
146
147 return( ret );
Paul Bakker0a597072012-09-25 21:55:46 +0000148}
149
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200150int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session )
Paul Bakker0a597072012-09-25 21:55:46 +0000151{
Paul Bakkerc5598842013-09-28 15:01:27 +0200152 int ret = 1;
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200153#if defined(MBEDTLS_HAVE_TIME)
Simon Butchera55e0842017-07-28 23:46:43 +0100154 mbedtls_time_t t = mbedtls_time( NULL ), oldest = 0;
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200155 mbedtls_ssl_cache_entry *old = NULL;
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200156#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200157 mbedtls_ssl_cache_context *cache = (mbedtls_ssl_cache_context *) data;
158 mbedtls_ssl_cache_entry *cur, *prv;
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000159 int count = 0;
Paul Bakker0a597072012-09-25 21:55:46 +0000160
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200161#if defined(MBEDTLS_THREADING_C)
162 if( ( ret = mbedtls_mutex_lock( &cache->mutex ) ) != 0 )
Paul Bakkerc5598842013-09-28 15:01:27 +0200163 return( ret );
164#endif
165
Paul Bakker0a597072012-09-25 21:55:46 +0000166 cur = cache->chain;
167 prv = NULL;
168
169 while( cur != NULL )
170 {
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000171 count++;
172
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200173#if defined(MBEDTLS_HAVE_TIME)
Paul Bakker0a597072012-09-25 21:55:46 +0000174 if( cache->timeout != 0 &&
175 (int) ( t - cur->timestamp ) > cache->timeout )
176 {
177 cur->timestamp = t;
178 break; /* expired, reuse this slot, update timestamp */
179 }
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200180#endif
Paul Bakker0a597072012-09-25 21:55:46 +0000181
Manuel Pégourié-Gonnard12ad7982015-06-18 15:50:37 +0200182 if( memcmp( session->id, cur->session.id, cur->session.id_len ) == 0 )
Paul Bakker0a597072012-09-25 21:55:46 +0000183 break; /* client reconnected, keep timestamp for session id */
184
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200185#if defined(MBEDTLS_HAVE_TIME)
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000186 if( oldest == 0 || cur->timestamp < oldest )
187 {
188 oldest = cur->timestamp;
189 old = cur;
190 }
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200191#endif
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000192
Paul Bakker0a597072012-09-25 21:55:46 +0000193 prv = cur;
194 cur = cur->next;
195 }
196
197 if( cur == NULL )
198 {
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200199#if defined(MBEDTLS_HAVE_TIME)
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000200 /*
201 * Reuse oldest entry if max_entries reached
202 */
Manuel Pégourié-Gonnard274a12e2014-02-20 21:32:08 +0100203 if( count >= cache->max_entries )
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000204 {
Manuel Pégourié-Gonnard274a12e2014-02-20 21:32:08 +0100205 if( old == NULL )
206 {
207 ret = 1;
208 goto exit;
209 }
210
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000211 cur = old;
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000212 }
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200213#else /* MBEDTLS_HAVE_TIME */
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200214 /*
215 * Reuse first entry in chain if max_entries reached,
216 * but move to last place
217 */
218 if( count >= cache->max_entries )
219 {
220 if( cache->chain == NULL )
Paul Bakkerc5598842013-09-28 15:01:27 +0200221 {
222 ret = 1;
223 goto exit;
224 }
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200225
226 cur = cache->chain;
227 cache->chain = cur->next;
Manuel Pégourié-Gonnard84c30c72014-02-26 17:38:55 +0100228 cur->next = NULL;
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200229 prv->next = cur;
230 }
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200231#endif /* MBEDTLS_HAVE_TIME */
Paul Bakker0a597072012-09-25 21:55:46 +0000232 else
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000233 {
Manuel Pégourié-Gonnard274a12e2014-02-20 21:32:08 +0100234 /*
235 * max_entries not reached, create new entry
236 */
Manuel Pégourié-Gonnard7551cb92015-05-26 16:04:06 +0200237 cur = mbedtls_calloc( 1, sizeof(mbedtls_ssl_cache_entry) );
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000238 if( cur == NULL )
Paul Bakkerc5598842013-09-28 15:01:27 +0200239 {
240 ret = 1;
241 goto exit;
242 }
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000243
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000244 if( prv == NULL )
245 cache->chain = cur;
246 else
247 prv->next = cur;
248 }
Paul Bakker0a597072012-09-25 21:55:46 +0000249
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200250#if defined(MBEDTLS_HAVE_TIME)
Paul Bakker0a597072012-09-25 21:55:46 +0000251 cur->timestamp = t;
Paul Bakkerfa9b1002013-07-03 15:31:03 +0200252#endif
Paul Bakker0a597072012-09-25 21:55:46 +0000253 }
254
Hanno Becker2e6d3472019-02-06 15:40:27 +0000255#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
256 defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
Paul Bakkere81beda2013-03-06 17:40:46 +0100257 /*
Manuel Pégourié-Gonnard84c30c72014-02-26 17:38:55 +0100258 * If we're reusing an entry, free its certificate first
259 */
260 if( cur->peer_cert.p != NULL )
261 {
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200262 mbedtls_free( cur->peer_cert.p );
Manuel Pégourié-Gonnard7a346b82019-10-02 14:47:01 +0200263 mbedtls_platform_memset( &cur->peer_cert, 0, sizeof(mbedtls_x509_buf) );
Manuel Pégourié-Gonnard84c30c72014-02-26 17:38:55 +0100264 }
Hanno Becker2e6d3472019-02-06 15:40:27 +0000265#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
Manuel Pégourié-Gonnard84c30c72014-02-26 17:38:55 +0100266
Hanno Beckera177b382019-02-06 14:53:19 +0000267 /* Copy the entire session; this temporarily makes a copy of the
268 * X.509 CRT structure even though we only want to store the raw CRT.
269 * This inefficiency will go away as soon as we implement on-demand
270 * parsing of CRTs, in which case there's no need for the `peer_cert`
271 * field anymore in the first place, and we're done after this call. */
272 ret = mbedtls_ssl_session_copy( &cur->session, session );
273 if( ret != 0 )
Paul Bakkere81beda2013-03-06 17:40:46 +0100274 {
Hanno Beckera177b382019-02-06 14:53:19 +0000275 ret = 1;
276 goto exit;
277 }
278
Hanno Becker2e6d3472019-02-06 15:40:27 +0000279#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
280 defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
Hanno Beckera177b382019-02-06 14:53:19 +0000281 /* If present, free the X.509 structure and only store the raw CRT data. */
282 if( cur->session.peer_cert != NULL )
283 {
284 cur->peer_cert.p =
285 mbedtls_calloc( 1, cur->session.peer_cert->raw.len );
Paul Bakkere81beda2013-03-06 17:40:46 +0100286 if( cur->peer_cert.p == NULL )
Paul Bakkerc5598842013-09-28 15:01:27 +0200287 {
288 ret = 1;
289 goto exit;
290 }
Paul Bakkere81beda2013-03-06 17:40:46 +0100291
Hanno Beckera177b382019-02-06 14:53:19 +0000292 memcpy( cur->peer_cert.p,
293 cur->session.peer_cert->raw.p,
294 cur->session.peer_cert->raw.len );
Paul Bakkere81beda2013-03-06 17:40:46 +0100295 cur->peer_cert.len = session->peer_cert->raw.len;
296
Hanno Beckera177b382019-02-06 14:53:19 +0000297 mbedtls_x509_crt_free( cur->session.peer_cert );
298 mbedtls_free( cur->session.peer_cert );
Paul Bakkere81beda2013-03-06 17:40:46 +0100299 cur->session.peer_cert = NULL;
300 }
Hanno Becker2e6d3472019-02-06 15:40:27 +0000301#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
Paul Bakker0a597072012-09-25 21:55:46 +0000302
Paul Bakkerc5598842013-09-28 15:01:27 +0200303 ret = 0;
304
305exit:
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200306#if defined(MBEDTLS_THREADING_C)
307 if( mbedtls_mutex_unlock( &cache->mutex ) != 0 )
Paul Bakkerc5598842013-09-28 15:01:27 +0200308 ret = 1;
309#endif
310
311 return( ret );
Paul Bakker0a597072012-09-25 21:55:46 +0000312}
313
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200314#if defined(MBEDTLS_HAVE_TIME)
315void mbedtls_ssl_cache_set_timeout( mbedtls_ssl_cache_context *cache, int timeout )
Paul Bakker0a597072012-09-25 21:55:46 +0000316{
317 if( timeout < 0 ) timeout = 0;
318
319 cache->timeout = timeout;
320}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200321#endif /* MBEDTLS_HAVE_TIME */
Paul Bakker0a597072012-09-25 21:55:46 +0000322
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200323void mbedtls_ssl_cache_set_max_entries( mbedtls_ssl_cache_context *cache, int max )
Paul Bakkerba26e9e2012-10-23 22:18:28 +0000324{
325 if( max < 0 ) max = 0;
326
327 cache->max_entries = max;
328}
329
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200330void mbedtls_ssl_cache_free( mbedtls_ssl_cache_context *cache )
Paul Bakker0a597072012-09-25 21:55:46 +0000331{
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200332 mbedtls_ssl_cache_entry *cur, *prv;
Paul Bakker0a597072012-09-25 21:55:46 +0000333
334 cur = cache->chain;
335
336 while( cur != NULL )
337 {
338 prv = cur;
339 cur = cur->next;
340
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200341 mbedtls_ssl_session_free( &prv->session );
Paul Bakkere81beda2013-03-06 17:40:46 +0100342
Hanno Becker2e6d3472019-02-06 15:40:27 +0000343#if defined(MBEDTLS_X509_CRT_PARSE_C) && \
344 defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200345 mbedtls_free( prv->peer_cert.p );
Hanno Becker2e6d3472019-02-06 15:40:27 +0000346#endif /* MBEDTLS_X509_CRT_PARSE_C && MBEDTLS_SSL_KEEP_PEER_CERTIFICATE */
Paul Bakkere81beda2013-03-06 17:40:46 +0100347
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200348 mbedtls_free( prv );
Paul Bakker0a597072012-09-25 21:55:46 +0000349 }
Paul Bakkerc5598842013-09-28 15:01:27 +0200350
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200351#if defined(MBEDTLS_THREADING_C)
352 mbedtls_mutex_free( &cache->mutex );
Paul Bakkerc5598842013-09-28 15:01:27 +0200353#endif
Ron Eldor22360822017-10-29 17:53:52 +0200354 cache->chain = NULL;
Paul Bakker0a597072012-09-25 21:55:46 +0000355}
356
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200357#endif /* MBEDTLS_SSL_CACHE_C */