]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
keymat: Add AUTH payload setter/getter functions
authorReto Buerki <reet@codelabs.ch>
Thu, 6 Sep 2012 15:27:45 +0000 (17:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 19 Mar 2013 14:23:47 +0000 (15:23 +0100)
These functions are used in the TKM specific bus listener to
store/retrieve the AUTH payload chunk in the message/authorize hooks.

src/charon-tkm/src/tkm/tkm_keymat.c
src/charon-tkm/src/tkm/tkm_keymat.h

index bb085b86faa7547ea8a74489257b77f8ef48efac..b36353b5c6582343a8ce50d85bddf2a81de82975 100644 (file)
@@ -66,6 +66,11 @@ struct private_tkm_keymat_t {
         */
        ae_id_type ae_ctx_id;
 
+       /**
+        * AUTH payload chunk.
+        */
+       chunk_t auth_payload;
+
 };
 
 /**
@@ -352,6 +357,7 @@ METHOD(keymat_t, destroy, void,
 
        DESTROY_IF(this->aead_in);
        DESTROY_IF(this->aead_out);
+       chunk_free(&this->auth_payload);
        this->proxy->keymat.destroy(&this->proxy->keymat);
        free(this);
 }
@@ -362,6 +368,18 @@ METHOD(tkm_keymat_t, get_isa_id, isa_id_type,
        return this->isa_ctx_id;
 }
 
+METHOD(tkm_keymat_t, set_auth_payload, void,
+       private_tkm_keymat_t *this, const chunk_t * const payload)
+{
+       this->auth_payload = chunk_clone(*payload);
+}
+
+METHOD(tkm_keymat_t, get_auth_payload, chunk_t*,
+       private_tkm_keymat_t *this)
+{
+       return &this->auth_payload;
+}
+
 /**
  * See header.
  */
@@ -384,10 +402,13 @@ tkm_keymat_t *tkm_keymat_create(bool initiator)
                        .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,
                },
                .initiator = initiator,
                .isa_ctx_id = tkm->idmgr->acquire_id(tkm->idmgr, TKM_CTX_ISA),
                .ae_ctx_id = tkm->idmgr->acquire_id(tkm->idmgr, TKM_CTX_AE),
+               .auth_payload = chunk_empty,
                .proxy = keymat_v2_create(initiator),
        );
 
index 1fb15596a1c9d04ce68390ce0a3335cea48ab044..22da32f4e616003f8f2332ab4dfd53e95531d3ab 100644 (file)
@@ -114,6 +114,20 @@ struct tkm_keymat_t {
         */
        isa_id_type (*get_isa_id)(tkm_keymat_t * const this);
 
+       /**
+        * Set IKE AUTH payload.
+        *
+        * @param payload               AUTH payload
+        */
+       void (*set_auth_payload)(tkm_keymat_t *this, const chunk_t * const payload);
+
+       /**
+        * Get IKE AUTH payload.
+        *
+        * @return                              AUTH payload if set, chunk_empty otherwise
+        */
+       chunk_t* (*get_auth_payload)(tkm_keymat_t * const this);
+
 };
 
 /**