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 #include "ssl.h" 00028 00029 #if defined(MBEDTLS_THREADING_C) 00030 #include "threading.h" 00031 #endif 00032 00040 #ifndef MBEDTLS_SSL_COOKIE_TIMEOUT 00041 #define MBEDTLS_SSL_COOKIE_TIMEOUT 60 00042 #endif 00043 00044 /* \} name SECTION: Module settings */ 00045 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00053 typedef struct 00054 { 00055 mbedtls_md_context_t hmac_ctx; 00056 #if !defined(MBEDTLS_HAVE_TIME) 00057 unsigned long serial; 00058 #endif 00059 unsigned long timeout; 00062 #if defined(MBEDTLS_THREADING_C) 00063 mbedtls_threading_mutex_t mutex; 00064 #endif 00065 } mbedtls_ssl_cookie_ctx; 00066 00070 void mbedtls_ssl_cookie_init( mbedtls_ssl_cookie_ctx *ctx ); 00071 00075 int mbedtls_ssl_cookie_setup( mbedtls_ssl_cookie_ctx *ctx, 00076 int (*f_rng)(void *, unsigned char *, size_t), 00077 void *p_rng ); 00078 00088 void mbedtls_ssl_cookie_set_timeout( mbedtls_ssl_cookie_ctx *ctx, unsigned long delay ); 00089 00093 void mbedtls_ssl_cookie_free( mbedtls_ssl_cookie_ctx *ctx ); 00094 00098 mbedtls_ssl_cookie_write_t mbedtls_ssl_cookie_write; 00099 00103 mbedtls_ssl_cookie_check_t mbedtls_ssl_cookie_check; 00104 00105 #ifdef __cplusplus 00106 } 00107 #endif 00108 00109 #endif /* ssl_cookie.h */