00001 00006 /* 00007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 00009 * 00010 * This file is provided under the Apache License 2.0, or the 00011 * GNU General Public License v2.0 or later. 00012 * 00013 * ********** 00014 * Apache License 2.0: 00015 * 00016 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00017 * not use this file except in compliance with the License. 00018 * You may obtain a copy of the License at 00019 * 00020 * http://www.apache.org/licenses/LICENSE-2.0 00021 * 00022 * Unless required by applicable law or agreed to in writing, software 00023 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00024 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 * 00028 * ********** 00029 * 00030 * ********** 00031 * GNU General Public License v2.0 or later: 00032 * 00033 * This program is free software; you can redistribute it and/or modify 00034 * it under the terms of the GNU General Public License as published by 00035 * the Free Software Foundation; either version 2 of the License, or 00036 * (at your option) any later version. 00037 * 00038 * This program is distributed in the hope that it will be useful, 00039 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00040 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00041 * GNU General Public License for more details. 00042 * 00043 * You should have received a copy of the GNU General Public License along 00044 * with this program; if not, write to the Free Software Foundation, Inc., 00045 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00046 * 00047 * ********** 00048 * 00049 * This file is part of mbed TLS (https://tls.mbed.org) 00050 */ 00051 #ifndef MBEDTLS_SSL_TICKET_H 00052 #define MBEDTLS_SSL_TICKET_H 00053 00054 #if !defined(MBEDTLS_CONFIG_FILE) 00055 #include "config.h" 00056 #else 00057 #include MBEDTLS_CONFIG_FILE 00058 #endif 00059 00060 /* 00061 * This implementation of the session ticket callbacks includes key 00062 * management, rotating the keys periodically in order to preserve forward 00063 * secrecy, when MBEDTLS_HAVE_TIME is defined. 00064 */ 00065 00066 #include "ssl.h" 00067 #include "cipher.h" 00068 00069 #if defined(MBEDTLS_THREADING_C) 00070 #include "threading.h" 00071 #endif 00072 00073 #ifdef __cplusplus 00074 extern "C" { 00075 #endif 00076 00080 typedef struct 00081 { 00082 unsigned char name[4]; 00083 uint32_t generation_time; 00084 mbedtls_cipher_context_t ctx; 00085 } 00086 mbedtls_ssl_ticket_key; 00087 00091 typedef struct 00092 { 00093 mbedtls_ssl_ticket_key keys[2]; 00094 unsigned char active; 00096 uint32_t ticket_lifetime; 00099 int (*f_rng)(void *, unsigned char *, size_t); 00100 void *p_rng; 00102 #if defined(MBEDTLS_THREADING_C) 00103 mbedtls_threading_mutex_t mutex; 00104 #endif 00105 } 00106 mbedtls_ssl_ticket_context; 00107 00115 void mbedtls_ssl_ticket_init( mbedtls_ssl_ticket_context *ctx ); 00116 00139 int mbedtls_ssl_ticket_setup( mbedtls_ssl_ticket_context *ctx, 00140 int (*f_rng)(void *, unsigned char *, size_t), void *p_rng, 00141 mbedtls_cipher_type_t cipher, 00142 uint32_t lifetime ); 00143 00149 mbedtls_ssl_ticket_write_t mbedtls_ssl_ticket_write; 00150 00156 mbedtls_ssl_ticket_parse_t mbedtls_ssl_ticket_parse; 00157 00163 void mbedtls_ssl_ticket_free( mbedtls_ssl_ticket_context *ctx ); 00164 00165 #ifdef __cplusplus 00166 } 00167 #endif 00168 00169 #endif /* ssl_ticket.h */