Let tkm_keymat_t extend keymat_v2_t
[strongswan.git] / src / charon-tkm / src / tkm / tkm_keymat.c
index 9783724..9f3faf5 100644 (file)
@@ -164,7 +164,7 @@ METHOD(keymat_t, create_nonce_gen, nonce_gen_t*,
        return lib->crypto->create_nonce_gen(lib->crypto);
 }
 
-METHOD(tkm_keymat_t, derive_ike_keys, bool,
+METHOD(keymat_v2_t, derive_ike_keys, bool,
        private_tkm_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
        chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
        pseudo_random_function_t rekey_function, chunk_t rekey_skd)
@@ -296,7 +296,7 @@ METHOD(tkm_keymat_t, derive_ike_keys, bool,
        return TRUE;
 }
 
-METHOD(tkm_keymat_t, derive_child_keys, bool,
+METHOD(keymat_v2_t, derive_child_keys, bool,
        private_tkm_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
        chunk_t nonce_i, chunk_t nonce_r, chunk_t *encr_i, chunk_t *integ_i,
        chunk_t *encr_r, chunk_t *integ_r)
@@ -345,7 +345,7 @@ METHOD(keymat_t, get_aead, aead_t*,
        return in ? this->aead_in : this->aead_out;
 }
 
-METHOD(tkm_keymat_t, get_auth_octets, bool,
+METHOD(keymat_v2_t, get_auth_octets, bool,
        private_tkm_keymat_t *this, bool verify, chunk_t ike_sa_init,
        chunk_t nonce, identification_t *id, char reserved[3], chunk_t *octets)
 {
@@ -354,14 +354,14 @@ METHOD(tkm_keymat_t, get_auth_octets, bool,
        return TRUE;
 }
 
-METHOD(tkm_keymat_t, get_skd, pseudo_random_function_t,
+METHOD(keymat_v2_t, get_skd, pseudo_random_function_t,
        private_tkm_keymat_t *this, chunk_t *skd)
 {
        *skd = chunk_clone(chunk_from_thing(this->isa_ctx_id));
        return PRF_HMAC_SHA2_512;
 }
 
-METHOD(tkm_keymat_t, get_psk_sig, bool,
+METHOD(keymat_v2_t, get_psk_sig, bool,
        private_tkm_keymat_t *this, bool verify, chunk_t ike_sa_init, chunk_t nonce,
        chunk_t secret, identification_t *id, char reserved[3], chunk_t *sig)
 {
@@ -432,18 +432,20 @@ tkm_keymat_t *tkm_keymat_create(bool initiator)
 
        INIT(this,
                .public = {
-                       .keymat = {
-                               .get_version = _get_version,
-                               .create_dh = _create_dh,
-                               .create_nonce_gen = _create_nonce_gen,
-                               .get_aead = _get_aead,
-                               .destroy = _destroy,
+                       .keymat_v2 = {
+                               .keymat = {
+                                       .get_version = _get_version,
+                                       .create_dh = _create_dh,
+                                       .create_nonce_gen = _create_nonce_gen,
+                                       .get_aead = _get_aead,
+                                       .destroy = _destroy,
+                               },
+                               .derive_ike_keys = _derive_ike_keys,
+                               .derive_child_keys = _derive_child_keys,
+                               .get_skd = _get_skd,
+                               .get_auth_octets = _get_auth_octets,
+                               .get_psk_sig = _get_psk_sig,
                        },
-                       .derive_ike_keys = _derive_ike_keys,
-                       .derive_child_keys = _derive_child_keys,
-                       .get_skd = _get_skd,
-                       .get_auth_octets = _get_auth_octets,
-                       .get_psk_sig = _get_psk_sig,
                        .get_isa_id = _get_isa_id,
                        .set_auth_payload = _set_auth_payload,
                        .get_auth_payload = _get_auth_payload,