Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * SSL session cache implementation |
| 3 | * |
Paul Bakker | 7dc4c44 | 2014-02-01 22:50:26 +0100 | [diff] [blame] | 4 | * Copyright (C) 2006-2014, Brainspark B.V. |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 5 | * |
| 6 | * This file is part of PolarSSL (http://www.polarssl.org) |
| 7 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License along |
| 22 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 | */ |
| 25 | /* |
| 26 | * These session callbacks use a simple chained list |
| 27 | * to store and retrieve the session information. |
| 28 | */ |
| 29 | |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame^] | 30 | #if !defined(POLARSSL_CONFIG_FILE) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 31 | #include "polarssl/config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame^] | 32 | #else |
| 33 | #include POLARSSL_CONFIG_FILE |
| 34 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 35 | |
| 36 | #if defined(POLARSSL_SSL_CACHE_C) |
| 37 | |
| 38 | #include "polarssl/ssl_cache.h" |
| 39 | |
Paul Bakker | 7dc4c44 | 2014-02-01 22:50:26 +0100 | [diff] [blame] | 40 | #if defined(POLARSSL_PLATFORM_C) |
| 41 | #include "polarssl/platform.h" |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 42 | #else |
| 43 | #define polarssl_malloc malloc |
| 44 | #define polarssl_free free |
| 45 | #endif |
| 46 | |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 47 | #include <stdlib.h> |
| 48 | |
| 49 | void ssl_cache_init( ssl_cache_context *cache ) |
| 50 | { |
| 51 | memset( cache, 0, sizeof( ssl_cache_context ) ); |
| 52 | |
| 53 | cache->timeout = SSL_CACHE_DEFAULT_TIMEOUT; |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 54 | cache->max_entries = SSL_CACHE_DEFAULT_MAX_ENTRIES; |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 55 | |
| 56 | #if defined(POLARSSL_THREADING_C) |
| 57 | polarssl_mutex_init( &cache->mutex ); |
| 58 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | int ssl_cache_get( void *data, ssl_session *session ) |
| 62 | { |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 63 | int ret = 1; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 64 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 65 | time_t t = time( NULL ); |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 66 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 67 | ssl_cache_context *cache = (ssl_cache_context *) data; |
| 68 | ssl_cache_entry *cur, *entry; |
| 69 | |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 70 | #if defined(POLARSSL_THREADING_C) |
| 71 | if( polarssl_mutex_lock( &cache->mutex ) != 0 ) |
| 72 | return( 1 ); |
| 73 | #endif |
| 74 | |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 75 | cur = cache->chain; |
| 76 | entry = NULL; |
| 77 | |
| 78 | while( cur != NULL ) |
| 79 | { |
| 80 | entry = cur; |
| 81 | cur = cur->next; |
| 82 | |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 83 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 84 | if( cache->timeout != 0 && |
| 85 | (int) ( t - entry->timestamp ) > cache->timeout ) |
| 86 | continue; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 87 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 88 | |
| 89 | if( session->ciphersuite != entry->session.ciphersuite || |
| 90 | session->compression != entry->session.compression || |
| 91 | session->length != entry->session.length ) |
| 92 | continue; |
| 93 | |
| 94 | if( memcmp( session->id, entry->session.id, |
| 95 | entry->session.length ) != 0 ) |
| 96 | continue; |
| 97 | |
| 98 | memcpy( session->master, entry->session.master, 48 ); |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 99 | |
Manuel Pégourié-Gonnard | 38d1eba | 2013-08-23 10:44:29 +0200 | [diff] [blame] | 100 | session->verify_result = entry->session.verify_result; |
| 101 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 102 | #if defined(POLARSSL_X509_CRT_PARSE_C) |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 103 | /* |
| 104 | * Restore peer certificate (without rest of the original chain) |
| 105 | */ |
| 106 | if( entry->peer_cert.p != NULL ) |
| 107 | { |
Paul Bakker | c559c7a | 2013-09-18 14:13:26 +0200 | [diff] [blame] | 108 | session->peer_cert = (x509_crt *) polarssl_malloc( sizeof(x509_crt) ); |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 109 | if( session->peer_cert == NULL ) |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 110 | { |
| 111 | ret = 1; |
| 112 | goto exit; |
| 113 | } |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 114 | |
Paul Bakker | b6b0956 | 2013-09-18 14:17:41 +0200 | [diff] [blame] | 115 | x509_crt_init( session->peer_cert ); |
Paul Bakker | ddf26b4 | 2013-09-18 13:46:23 +0200 | [diff] [blame] | 116 | if( x509_crt_parse( session->peer_cert, entry->peer_cert.p, |
| 117 | entry->peer_cert.len ) != 0 ) |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 118 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 119 | polarssl_free( session->peer_cert ); |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 120 | session->peer_cert = NULL; |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 121 | ret = 1; |
| 122 | goto exit; |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 123 | } |
| 124 | } |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 125 | #endif /* POLARSSL_X509_CRT_PARSE_C */ |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 126 | |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 127 | ret = 0; |
| 128 | goto exit; |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 131 | exit: |
| 132 | #if defined(POLARSSL_THREADING_C) |
| 133 | if( polarssl_mutex_unlock( &cache->mutex ) != 0 ) |
| 134 | ret = 1; |
| 135 | #endif |
| 136 | |
| 137 | return( ret ); |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | int ssl_cache_set( void *data, const ssl_session *session ) |
| 141 | { |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 142 | int ret = 1; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 143 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 144 | time_t t = time( NULL ), oldest = 0; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 145 | ssl_cache_entry *old = NULL; |
| 146 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 147 | ssl_cache_context *cache = (ssl_cache_context *) data; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 148 | ssl_cache_entry *cur, *prv; |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 149 | int count = 0; |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 150 | |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 151 | #if defined(POLARSSL_THREADING_C) |
| 152 | if( ( ret = polarssl_mutex_lock( &cache->mutex ) ) != 0 ) |
| 153 | return( ret ); |
| 154 | #endif |
| 155 | |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 156 | cur = cache->chain; |
| 157 | prv = NULL; |
| 158 | |
| 159 | while( cur != NULL ) |
| 160 | { |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 161 | count++; |
| 162 | |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 163 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 164 | if( cache->timeout != 0 && |
| 165 | (int) ( t - cur->timestamp ) > cache->timeout ) |
| 166 | { |
| 167 | cur->timestamp = t; |
| 168 | break; /* expired, reuse this slot, update timestamp */ |
| 169 | } |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 170 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 171 | |
| 172 | if( memcmp( session->id, cur->session.id, cur->session.length ) == 0 ) |
| 173 | break; /* client reconnected, keep timestamp for session id */ |
| 174 | |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 175 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 176 | if( oldest == 0 || cur->timestamp < oldest ) |
| 177 | { |
| 178 | oldest = cur->timestamp; |
| 179 | old = cur; |
| 180 | } |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 181 | #endif |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 182 | |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 183 | prv = cur; |
| 184 | cur = cur->next; |
| 185 | } |
| 186 | |
| 187 | if( cur == NULL ) |
| 188 | { |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 189 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 190 | /* |
| 191 | * Reuse oldest entry if max_entries reached |
| 192 | */ |
Manuel Pégourié-Gonnard | 274a12e | 2014-02-20 21:32:08 +0100 | [diff] [blame] | 193 | if( count >= cache->max_entries ) |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 194 | { |
Manuel Pégourié-Gonnard | 274a12e | 2014-02-20 21:32:08 +0100 | [diff] [blame] | 195 | if( old == NULL ) |
| 196 | { |
| 197 | ret = 1; |
| 198 | goto exit; |
| 199 | } |
| 200 | |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 201 | cur = old; |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 202 | } |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 203 | #else /* POLARSSL_HAVE_TIME */ |
| 204 | /* |
| 205 | * Reuse first entry in chain if max_entries reached, |
| 206 | * but move to last place |
| 207 | */ |
| 208 | if( count >= cache->max_entries ) |
| 209 | { |
| 210 | if( cache->chain == NULL ) |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 211 | { |
| 212 | ret = 1; |
| 213 | goto exit; |
| 214 | } |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 215 | |
| 216 | cur = cache->chain; |
| 217 | cache->chain = cur->next; |
Manuel Pégourié-Gonnard | 84c30c7 | 2014-02-26 17:38:55 +0100 | [diff] [blame] | 218 | cur->next = NULL; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 219 | prv->next = cur; |
| 220 | } |
| 221 | #endif /* POLARSSL_HAVE_TIME */ |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 222 | else |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 223 | { |
Manuel Pégourié-Gonnard | 274a12e | 2014-02-20 21:32:08 +0100 | [diff] [blame] | 224 | /* |
| 225 | * max_entries not reached, create new entry |
| 226 | */ |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 227 | cur = (ssl_cache_entry *) polarssl_malloc( sizeof(ssl_cache_entry) ); |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 228 | if( cur == NULL ) |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 229 | { |
| 230 | ret = 1; |
| 231 | goto exit; |
| 232 | } |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 233 | |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 234 | memset( cur, 0, sizeof(ssl_cache_entry) ); |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 235 | |
| 236 | if( prv == NULL ) |
| 237 | cache->chain = cur; |
| 238 | else |
| 239 | prv->next = cur; |
| 240 | } |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 241 | |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 242 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 243 | cur->timestamp = t; |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 244 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | memcpy( &cur->session, session, sizeof( ssl_session ) ); |
Paul Bakker | ed27a04 | 2013-04-18 22:46:23 +0200 | [diff] [blame] | 248 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 249 | #if defined(POLARSSL_X509_CRT_PARSE_C) |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 250 | /* |
Manuel Pégourié-Gonnard | 84c30c7 | 2014-02-26 17:38:55 +0100 | [diff] [blame] | 251 | * If we're reusing an entry, free its certificate first |
| 252 | */ |
| 253 | if( cur->peer_cert.p != NULL ) |
| 254 | { |
| 255 | polarssl_free( cur->peer_cert.p ); |
| 256 | memset( &cur->peer_cert, 0, sizeof(x509_buf) ); |
| 257 | } |
| 258 | |
| 259 | /* |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 260 | * Store peer certificate |
| 261 | */ |
| 262 | if( session->peer_cert != NULL ) |
| 263 | { |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 264 | cur->peer_cert.p = (unsigned char *) polarssl_malloc( session->peer_cert->raw.len ); |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 265 | if( cur->peer_cert.p == NULL ) |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 266 | { |
| 267 | ret = 1; |
| 268 | goto exit; |
| 269 | } |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 270 | |
| 271 | memcpy( cur->peer_cert.p, session->peer_cert->raw.p, |
| 272 | session->peer_cert->raw.len ); |
| 273 | cur->peer_cert.len = session->peer_cert->raw.len; |
| 274 | |
| 275 | cur->session.peer_cert = NULL; |
| 276 | } |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 277 | #endif /* POLARSSL_X509_CRT_PARSE_C */ |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 278 | |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 279 | ret = 0; |
| 280 | |
| 281 | exit: |
| 282 | #if defined(POLARSSL_THREADING_C) |
| 283 | if( polarssl_mutex_unlock( &cache->mutex ) != 0 ) |
| 284 | ret = 1; |
| 285 | #endif |
| 286 | |
| 287 | return( ret ); |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 288 | } |
| 289 | |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 290 | #if defined(POLARSSL_HAVE_TIME) |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 291 | void ssl_cache_set_timeout( ssl_cache_context *cache, int timeout ) |
| 292 | { |
| 293 | if( timeout < 0 ) timeout = 0; |
| 294 | |
| 295 | cache->timeout = timeout; |
| 296 | } |
Paul Bakker | fa9b100 | 2013-07-03 15:31:03 +0200 | [diff] [blame] | 297 | #endif /* POLARSSL_HAVE_TIME */ |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 298 | |
Paul Bakker | ba26e9e | 2012-10-23 22:18:28 +0000 | [diff] [blame] | 299 | void ssl_cache_set_max_entries( ssl_cache_context *cache, int max ) |
| 300 | { |
| 301 | if( max < 0 ) max = 0; |
| 302 | |
| 303 | cache->max_entries = max; |
| 304 | } |
| 305 | |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 306 | void ssl_cache_free( ssl_cache_context *cache ) |
| 307 | { |
| 308 | ssl_cache_entry *cur, *prv; |
| 309 | |
| 310 | cur = cache->chain; |
| 311 | |
| 312 | while( cur != NULL ) |
| 313 | { |
| 314 | prv = cur; |
| 315 | cur = cur->next; |
| 316 | |
| 317 | ssl_session_free( &prv->session ); |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 318 | |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 319 | #if defined(POLARSSL_X509_CRT_PARSE_C) |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 320 | if( prv->peer_cert.p != NULL ) |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 321 | polarssl_free( prv->peer_cert.p ); |
Paul Bakker | 7c6b2c3 | 2013-09-16 13:49:26 +0200 | [diff] [blame] | 322 | #endif /* POLARSSL_X509_CRT_PARSE_C */ |
Paul Bakker | e81beda | 2013-03-06 17:40:46 +0100 | [diff] [blame] | 323 | |
Paul Bakker | 6e339b5 | 2013-07-03 13:37:05 +0200 | [diff] [blame] | 324 | polarssl_free( prv ); |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 325 | } |
Paul Bakker | c559884 | 2013-09-28 15:01:27 +0200 | [diff] [blame] | 326 | |
| 327 | #if defined(POLARSSL_THREADING_C) |
| 328 | polarssl_mutex_free( &cache->mutex ); |
| 329 | #endif |
Paul Bakker | 0a59707 | 2012-09-25 21:55:46 +0000 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | #endif /* POLARSSL_SSL_CACHE_C */ |