[hipl-commit] [tiny] Rev 3630: Removed unused function hip_store_base_exchange_keys and unused struct hip_context.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Fri, 5 Mar 2010 20:42:57 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: Fri Mar 05 19:40:53 2010 +0100
Revision: 3630
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Removed unused function hip_store_base_exchange_keys and unused struct 
hip_context.
  
  The function is not needed anymore, because now the keys are stored directly
  in the hadb entry.
  
  The struct hip_context was successively replaced by struct hip_packet_context.

Modified:
  M  hipd/hadb.c
  M  hipd/hadb.h
  M  hipd/input.c
  M  lib/core/state.h

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-03-05 17:28:01 +0000
+++ hipd/hadb.c 2010-03-05 18:40:53 +0000
@@ -820,71 +820,6 @@
 }
 
 /**
- * Stores the keys negotiated in base exchange.
- *
- * @param ctx          the context inside which the key data will copied 
around.
- * @param is_initiator true if the localhost is the initiator, or false if the
- *                     localhost is the Responder
- * @return             0 if everything was stored successfully, otherwise < 0.
- */
-int hip_store_base_exchange_keys(struct hip_hadb_state *entry,
-                                 struct hip_context *ctx, int is_initiator)
-{
-    int err = 0;
-    int hmac_key_len, enc_key_len, auth_key_len, hip_enc_key_len;
-
-    hmac_key_len    = hip_hmac_key_length(entry->esp_transform);
-    enc_key_len     = hip_enc_key_length(entry->esp_transform);
-    auth_key_len    = hip_auth_key_length_esp(entry->esp_transform);
-    hip_enc_key_len = hip_transform_key_length(entry->hip_transform);
-
-    memcpy(&entry->hip_hmac_out, &ctx->hip_hmac_out, hmac_key_len);
-    memcpy(&entry->hip_hmac_in, &ctx->hip_hmac_in, hmac_key_len);
-
-    memcpy(&entry->esp_in.key, &ctx->esp_in.key, enc_key_len);
-    memcpy(&entry->auth_in.key, &ctx->auth_in.key, auth_key_len);
-
-    memcpy(&entry->esp_out.key, &ctx->esp_out.key, enc_key_len);
-    memcpy(&entry->auth_out.key, &ctx->auth_out.key, auth_key_len);
-
-    memcpy(&entry->hip_enc_out.key, &ctx->hip_enc_out.key, hip_enc_key_len);
-    memcpy(&entry->hip_enc_in.key, &ctx->hip_enc_in.key, hip_enc_key_len);
-
-    hip_update_entry_keymat(entry, ctx->current_keymat_index,
-                            ctx->keymat_calc_index, ctx->esp_keymat_index,
-                            ctx->current_keymat_K);
-
-    if (entry->dh_shared_key) {
-        HIP_DEBUG("HIP_FREEing old dh_shared_key\n");
-        HIP_FREE(entry->dh_shared_key);
-        entry->dh_shared_key = NULL;
-    }
-
-    entry->dh_shared_key_len = 0;
-    /** @todo reuse pointer, no HIP_MALLOC */
-    entry->dh_shared_key     = (char *) HIP_MALLOC(ctx->dh_shared_key_len, 
GFP_ATOMIC);
-    if (!entry->dh_shared_key) {
-        HIP_ERROR("entry dh_shared HIP_MALLOC failed\n");
-        err = -ENOMEM;
-        goto out_err;
-    }
-
-    entry->dh_shared_key_len = ctx->dh_shared_key_len;
-    memcpy(entry->dh_shared_key, ctx->dh_shared_key, entry->dh_shared_key_len);
-    _HIP_HEXDUMP("Entry DH SHARED", entry->dh_shared_key, 
entry->dh_shared_key_len);
-    _HIP_HEXDUMP("Entry Kn", entry->current_keymat_K, HIP_AH_SHA_LEN);
-    return err;
-
-out_err:
-    if (entry->dh_shared_key) {
-        HIP_FREE(entry->dh_shared_key);
-        entry->dh_shared_key = NULL;
-    }
-
-    return err;
-}
-
-/**
  * .
  *
  * @param entry ...

=== modified file 'hipd/hadb.h'
--- hipd/hadb.h 2010-03-05 17:28:01 +0000
+++ hipd/hadb.h 2010-03-05 18:40:53 +0000
@@ -87,8 +87,7 @@
 int hip_del_peer_info(hip_hit_t *, hip_hit_t *);
 
 void hip_hadb_set_spi_ifindex(hip_ha_t *entry, uint32_t spi, int ifindex);
-int hip_store_base_exchange_keys(struct hip_hadb_state *entry,
-                                 struct hip_context *ctx, int is_initiator);
+
 /* Utilities */
 
 hip_ha_t *hip_hadb_create_state(int gfpmask);

=== modified file 'hipd/input.c'
--- hipd/input.c        2010-03-05 17:28:01 +0000
+++ hipd/input.c        2010-03-05 18:40:53 +0000
@@ -1543,15 +1543,6 @@
      * */
 
     ctx->hadb_entry->spi_outbound_new = spi_out;
-    //HIP_IFE(hip_store_base_exchange_keys(ctx->hadb_entry, &i2_context, 0), 
-1);
-    //hip_hadb_insert_state(ctx->hadb_entry);
-
-    HIP_DEBUG("\nInserted a new host association state.\n"
-              "\tHIP state: %s\n" \
-              "\tDefault outgoing SPI 0x%x.\n"
-              "\tCreating an R2 packet in response next.\n",
-              hip_state_str(ctx->hadb_entry->state), 
ctx->hadb_entry->spi_outbound_new);
-
 
 #ifdef CONFIG_HIP_RVS
     ipv6_addr_copy(&dest, &in6addr_any);

=== modified file 'lib/core/state.h'
--- lib/core/state.h    2010-03-05 17:28:01 +0000
+++ lib/core/state.h    2010-03-05 18:40:53 +0000
@@ -127,36 +127,6 @@
     in_port_t       sin6_port;     /**< Transport layer port number. */
 } __attribute__ ((packed));
 
-struct hip_context {
-    //struct sk_buff *skb_in;         /* received skbuff */
-    struct hip_common *   input;        /**< Received packet. */
-    struct hip_common *   output;       /**< Packet to be built and sent. */
-    struct hip_crypto_key hip_enc_out;
-    struct hip_crypto_key hip_hmac_out;
-    struct hip_crypto_key esp_out;
-    struct hip_crypto_key auth_out;
-    struct hip_crypto_key hip_enc_in;
-    struct hip_crypto_key hip_hmac_in;
-    struct hip_crypto_key esp_in;
-    struct hip_crypto_key auth_in;
-    char *                dh_shared_key;
-    size_t                dh_shared_key_len;
-    struct hip_esp_info * esp_info;
-
-    uint16_t              current_keymat_index; /**< The byte offset index in 
draft
-                                        * chapter HIP KEYMAT */
-    unsigned char         current_keymat_K[HIP_AH_SHA_LEN];
-    uint8_t               keymat_calc_index; /**< The one byte index number 
used
-                                    * during the keymat calculation. */
-    uint16_t              keymat_index; /**< KEYMAT offset. */
-    uint16_t              esp_keymat_index; /**< A pointer to the esp keymat 
index. */
-
-    int                   esp_prot_param;
-
-    char                  hip_nat_key[HIP_MAX_KEY_LEN];
-    int                   use_ice;
-};
-
 /*
  * Fixed start of this struct must match to struct hip_locator_info_addr_item
  * for the part of address item. It is used in hip_update_locator_match().

Other related posts:

  • » [hipl-commit] [tiny] Rev 3630: Removed unused function hip_store_base_exchange_keys and unused struct hip_context. - Tim Just