Add skeleton for TKM keymat variant
[strongswan.git] / src / charon-tkm / src / tkm / tkm_keymat.c
1 /*
2 * Copyrigth (C) 2012 Reto Buerki
3 * Copyright (C) 2012 Adrian-Ken Rueegsegger
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include <daemon.h>
18
19 #include "tkm_keymat.h"
20
21 typedef struct private_tkm_keymat_t private_tkm_keymat_t;
22
23 /**
24 * Private data of a keymat_t object.
25 */
26 struct private_tkm_keymat_t {
27
28 /**
29 * Public tkm_keymat_t interface.
30 */
31 tkm_keymat_t public;
32
33 };
34
35 METHOD(keymat_t, get_version, ike_version_t,
36 private_tkm_keymat_t *this)
37 {
38 return IKEV2;
39 }
40
41 METHOD(keymat_t, create_dh, diffie_hellman_t*,
42 private_tkm_keymat_t *this, diffie_hellman_group_t group)
43 {
44 return lib->crypto->create_dh(lib->crypto, group);
45 }
46
47 METHOD(keymat_t, create_nonce_gen, nonce_gen_t*,
48 private_tkm_keymat_t *this)
49 {
50 return lib->crypto->create_nonce_gen(lib->crypto);
51 }
52
53 METHOD(tkm_keymat_t, derive_ike_keys, bool,
54 private_tkm_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
55 chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
56 pseudo_random_function_t rekey_function, chunk_t rekey_skd)
57 {
58 DBG1(DBG_IKE, "deriving IKE keys");
59 return FALSE;
60 }
61
62 METHOD(tkm_keymat_t, derive_child_keys, bool,
63 private_tkm_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
64 chunk_t nonce_i, chunk_t nonce_r, chunk_t *encr_i, chunk_t *integ_i,
65 chunk_t *encr_r, chunk_t *integ_r)
66 {
67 DBG1(DBG_CHD, "deriving child keys");
68 return FALSE;
69 }
70
71 METHOD(keymat_t, get_aead, aead_t*,
72 private_tkm_keymat_t *this, bool in)
73 {
74 DBG1(DBG_IKE, "get_aead called");
75 return NULL;
76 }
77
78 METHOD(tkm_keymat_t, get_auth_octets, bool,
79 private_tkm_keymat_t *this, bool verify, chunk_t ike_sa_init,
80 chunk_t nonce, identification_t *id, char reserved[3], chunk_t *octets)
81 {
82 DBG1(DBG_IKE, "returning auth octets");
83 return FALSE;
84 }
85
86 METHOD(tkm_keymat_t, get_skd, pseudo_random_function_t,
87 private_tkm_keymat_t *this, chunk_t *skd)
88 {
89 DBG1(DBG_IKE, "returning skd");
90 return PRF_UNDEFINED;
91 }
92
93 METHOD(tkm_keymat_t, get_psk_sig, bool,
94 private_tkm_keymat_t *this, bool verify, chunk_t ike_sa_init, chunk_t nonce,
95 chunk_t secret, identification_t *id, char reserved[3], chunk_t *sig)
96 {
97 DBG1(DBG_IKE, "returning PSK signature");
98 return FALSE;
99 }
100
101 METHOD(keymat_t, destroy, void,
102 private_tkm_keymat_t *this)
103 {
104 free(this);
105 }
106
107 /**
108 * See header.
109 */
110 tkm_keymat_t *tkm_keymat_create(bool initiator)
111 {
112 private_tkm_keymat_t *this;
113
114 INIT(this,
115 .public = {
116 .keymat = {
117 .get_version = _get_version,
118 .create_dh = _create_dh,
119 .create_nonce_gen = _create_nonce_gen,
120 .get_aead = _get_aead,
121 .destroy = _destroy,
122 },
123 .derive_ike_keys = _derive_ike_keys,
124 .derive_child_keys = _derive_child_keys,
125 .get_skd = _get_skd,
126 .get_auth_octets = _get_auth_octets,
127 .get_psk_sig = _get_psk_sig,
128 },
129 );
130
131 return &this->public;
132 }