00001 00006 /* 00007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00008 * SPDX-License-Identifier: Apache-2.0 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00011 * not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00018 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 * 00022 * This file is part of mbed TLS (https://tls.mbed.org) 00023 */ 00024 #ifndef MBEDTLS_SSL_COOKIE_H 00025 #define MBEDTLS_SSL_COOKIE_H 00026 00027 #if !defined(MBEDTLS_CONFIG_FILE) 00028 #include "config.h" 00029 #else 00030 #include MBEDTLS_CONFIG_FILE 00031 #endif 00032 00033 #include "ssl.h" 00034 00035 #if defined(MBEDTLS_THREADING_C) 00036 #include "threading.h" 00037 #endif 00038 00046 #ifndef MBEDTLS_SSL_COOKIE_TIMEOUT 00047 #define MBEDTLS_SSL_COOKIE_TIMEOUT 60 00048 #endif 00049 00050 /* \} name SECTION: Module settings */ 00051 00052 #ifdef __cplusplus 00053 extern "C" { 00054 #endif 00055 00059 typedef struct 00060 { 00061 mbedtls_md_context_t hmac_ctx; 00062 #if !defined(MBEDTLS_HAVE_TIME) 00063 unsigned long serial; 00064 #endif 00065 unsigned long timeout; 00068 #if defined(MBEDTLS_THREADING_C) 00069 mbedtls_threading_mutex_t mutex; 00070 #endif 00071 } mbedtls_ssl_cookie_ctx; 00072 00076 void mbedtls_ssl_cookie_init( mbedtls_ssl_cookie_ctx *ctx ); 00077 00081 int mbedtls_ssl_cookie_setup( mbedtls_ssl_cookie_ctx *ctx, 00082 int (*f_rng)(void *, unsigned char *, size_t), 00083 void *p_rng ); 00084 00094 void mbedtls_ssl_cookie_set_timeout( mbedtls_ssl_cookie_ctx *ctx, unsigned long delay ); 00095 00099 void mbedtls_ssl_cookie_free( mbedtls_ssl_cookie_ctx *ctx ); 00100 00104 mbedtls_ssl_cookie_write_t mbedtls_ssl_cookie_write; 00105 00109 mbedtls_ssl_cookie_check_t mbedtls_ssl_cookie_check; 00110 00111 #ifdef __cplusplus 00112 } 00113 #endif 00114 00115 #endif /* ssl_cookie.h */