Manuel Pégourié-Gonnard | 232edd4 | 2014-07-23 16:56:27 +0200 | [diff] [blame^] | 1 | /** |
| 2 | * \file ssl_cookie.h |
| 3 | * |
| 4 | * \brief DTLS cookie callbacks implementation |
| 5 | * |
| 6 | * Copyright (C) 2014, Brainspark B.V. |
| 7 | * |
| 8 | * This file is part of PolarSSL (http://www.polarssl.org) |
| 9 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
| 10 | * |
| 11 | * All rights reserved. |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU General Public License along |
| 24 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 25 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 26 | */ |
| 27 | #ifndef POLARSSL_SSL_COOKIE_H |
| 28 | #define POLARSSL_SSL_COOKIE_H |
| 29 | |
| 30 | #include "ssl.h" |
| 31 | |
| 32 | /** |
| 33 | * \name SECTION: Module settings |
| 34 | * |
| 35 | * The configuration options you can set for this module are in this section. |
| 36 | * Either change them in config.h or define them on the compiler command line. |
| 37 | * \{ |
| 38 | */ |
| 39 | |
| 40 | /* \} name SECTION: Module settings */ |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | extern "C" { |
| 44 | #endif |
| 45 | |
| 46 | /** |
| 47 | * \brief Context for the default cookie functions. |
| 48 | */ |
| 49 | typedef struct |
| 50 | { |
| 51 | md_context_t hmac_ctx; |
| 52 | } ssl_cookie_ctx; |
| 53 | |
| 54 | /** |
| 55 | * \brief Initialize cookie context |
| 56 | */ |
| 57 | void ssl_cookie_init( ssl_cookie_ctx *ctx ); |
| 58 | |
| 59 | /** |
| 60 | * \brief Setup cookie context (generate keys) |
| 61 | */ |
| 62 | int ssl_cookie_setup( ssl_cookie_ctx *ctx, |
| 63 | int (*f_rng)(void *, unsigned char *, size_t), |
| 64 | void *p_rng ); |
| 65 | |
| 66 | /** |
| 67 | * \brief Free cookie context |
| 68 | */ |
| 69 | void ssl_cookie_free( ssl_cookie_ctx *ctx ); |
| 70 | |
| 71 | /** |
| 72 | * \brief Generate cookie, see \c ssl_cookie_write_t |
| 73 | */ |
| 74 | ssl_cookie_write_t ssl_cookie_write; |
| 75 | |
| 76 | /** |
| 77 | * \brief Verify cookie, see \c ssl_cookie_write_t |
| 78 | */ |
| 79 | ssl_cookie_check_t ssl_cookie_check; |
| 80 | |
| 81 | #ifdef __cplusplus |
| 82 | } |
| 83 | #endif |
| 84 | |
| 85 | #endif /* ssl_cookie.h */ |