Tizen 2.0 Release
[external/libgnutls26.git] / libextra / ext_inner_application.h
1 /*
2  * Copyright (C) 2005, 2008, 2010 Free Software Foundation, Inc.
3  *
4  * Author: Simon Josefsson
5  *
6  * This file is part of GnuTLS-EXTRA.
7  *
8  * GnuTLS-extra is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation, either version 3 of the
11  * License, or (at your option) any later version.
12  *
13  * GnuTLS-extra is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see
20  * <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef EXT_IA_H
25 #define EXT_IA_H
26
27 #include <gnutls_extensions.h>
28
29 #define IA_PEER_ENABLE (1 << 1)
30 #define IA_PEER_ALLOW_SKIP (1 << 2)
31 #define IA_ENABLE (1 << 3)
32 #define IA_ALLOW_SKIP (1 << 4)
33
34 extern extension_entry_st ext_mod_ia;
35
36 typedef struct
37 {
38   unsigned int flags;
39   /* For TLS/IA.  XXX: Move to IA credential? */
40   opaque inner_secret[GNUTLS_MASTER_SIZE];
41 } ia_ext_st;
42
43 inline static void
44 _gnutls_ia_derive_inner_secret (gnutls_session_t session)
45 {
46   extension_priv_data_t epriv;
47   ia_ext_st *priv;
48   int ret;
49
50   ret =
51     _gnutls_ext_get_session_data (session, GNUTLS_EXTENSION_INNER_APPLICATION,
52                                   &epriv);
53   if (ret < 0)
54     {
55       return;
56     }
57   priv = epriv.ptr;
58
59   memcpy (priv->inner_secret,
60           session->security_parameters.master_secret, GNUTLS_MASTER_SIZE);
61
62 }
63
64 #endif