aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-isakmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-isakmp.c')
-rw-r--r--epan/dissectors/packet-isakmp.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c
index d4cb6e8078..fa89fb5057 100644
--- a/epan/dissectors/packet-isakmp.c
+++ b/epan/dissectors/packet-isakmp.c
@@ -1797,7 +1797,7 @@ decrypt_payload(tvbuff_t *tvb, packet_info *pinfo, const guint8 *buf, guint buf_
return NULL;
if (decr->iv_list == NULL) {
/* First packet */
- ivd = g_malloc(sizeof(iv_data_t));
+ ivd = (iv_data_t *)g_malloc(sizeof(iv_data_t));
ivd->frame_num = pinfo->fd->num;
ivd->iv_len = digest_size;
decr->last_message_id = hdr->message_id;
@@ -1810,7 +1810,7 @@ decrypt_payload(tvbuff_t *tvb, packet_info *pinfo, const guint8 *buf, guint buf_
iv_len = ivd->iv_len;
memcpy(iv, ivd->iv, iv_len);
} else if (decr->last_cbc_len >= cbc_block_size) {
- ivd = g_malloc(sizeof(iv_data_t));
+ ivd = (iv_data_t *)g_malloc(sizeof(iv_data_t));
ivd->frame_num = pinfo->fd->num;
if (hdr->message_id != decr->last_message_id) {
if (decr->last_p1_cbc_len == 0) {
@@ -1846,7 +1846,7 @@ decrypt_payload(tvbuff_t *tvb, packet_info *pinfo, const guint8 *buf, guint buf_
if (gcry_cipher_setkey(decr_ctx, decr->secret, decr->secret_len))
return NULL;
- decrypted_data = g_malloc(buf_len);
+ decrypted_data = (guint8 *)g_malloc(buf_len);
if (gcry_cipher_decrypt(decr_ctx, decrypted_data, buf_len, buf, buf_len) != GPG_ERR_NO_ERROR) {
g_free(decrypted_data);
@@ -2734,8 +2734,8 @@ dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
decr = (decrypt_data_t*) g_hash_table_lookup(isakmp_hash, i_cookie);
if (! decr) {
- ic_key = g_slice_alloc(COOKIE_SIZE);
- decr = g_slice_alloc(sizeof(decrypt_data_t));
+ ic_key = (guint8 *)g_slice_alloc(COOKIE_SIZE);
+ decr = (decrypt_data_t *)g_slice_alloc(sizeof(decrypt_data_t));
memcpy(ic_key, i_cookie, COOKIE_SIZE);
memset(decr, 0, sizeof(decrypt_data_t));
SET_ADDRESS(&decr->initiator, AT_NONE, 0, NULL);
@@ -2765,11 +2765,11 @@ dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hash_key.spii_len = COOKIE_SIZE;
hash_key.spir_len = COOKIE_SIZE;
- ike_sa_data = g_hash_table_lookup(ikev2_key_hash, &hash_key);
+ ike_sa_data = (ikev2_uat_data_t *)g_hash_table_lookup(ikev2_key_hash, &hash_key);
if (ike_sa_data) {
guint8 initiator_flag;
initiator_flag = hdr.flags & I_FLAG;
- ikev2_dec_data = ep_alloc(sizeof(ikev2_decrypt_data_t));
+ ikev2_dec_data = ep_new(ikev2_decrypt_data_t);
ikev2_dec_data->encr_key = initiator_flag ? ike_sa_data->sk_ei : ike_sa_data->sk_er;
ikev2_dec_data->auth_key = initiator_flag ? ike_sa_data->sk_ai : ike_sa_data->sk_ar;
ikev2_dec_data->encr_spec = ike_sa_data->encr_spec;
@@ -3586,11 +3586,11 @@ _U_
#ifdef HAVE_LIBGCRYPT
if (decr && decr->gi_len == 0 && ADDRESSES_EQUAL(&decr->initiator, &pinfo->src)) {
- decr->gi = g_malloc(length);
+ decr->gi = (gchar *)g_malloc(length);
tvb_memcpy(tvb, decr->gi, offset, length);
decr->gi_len = length;
} else if (decr && decr->gr_len == 0 && !ADDRESSES_EQUAL(&decr->initiator, &pinfo->src)) {
- decr->gr = g_malloc(length);
+ decr->gr = (gchar *)g_malloc(length);
tvb_memcpy(tvb, decr->gr, offset, length);
decr->gr_len = length;
}
@@ -4615,7 +4615,7 @@ dissect_enc(tvbuff_t *tvb,
if (iv_len) {
iv_item = proto_tree_add_item(tree, hf_isakmp_enc_iv, tvb, offset, iv_len, ENC_NA);
proto_item_append_text(iv_item, " (%d bytes)", iv_len);
- iv = ep_tvb_memdup(tvb, offset, iv_len);
+ iv = (guchar *)ep_tvb_memdup(tvb, offset, iv_len);
offset += iv_len;
}
@@ -4625,7 +4625,7 @@ dissect_enc(tvbuff_t *tvb,
*/
encr_data_item = proto_tree_add_item(tree, hf_isakmp_enc_data, tvb, offset, encr_data_len, ENC_NA);
proto_item_append_text(encr_data_item, " (%d bytes)",encr_data_len);
- encr_data = ep_tvb_memdup(tvb, offset, encr_data_len);
+ encr_data = (guchar *)ep_tvb_memdup(tvb, offset, encr_data_len);
offset += encr_data_len;
/*
@@ -4652,7 +4652,7 @@ dissect_enc(tvbuff_t *tvb,
}
/* Calculate hash over the bytes from the beginning of the ISAKMP header to the right before the ICD. */
- entire_message = ep_tvb_memdup(tvb, 0, offset);
+ entire_message = (guchar *)ep_tvb_memdup(tvb, 0, offset);
gcry_md_write(md_hd, entire_message, offset);
md = gcry_md_read(md_hd, 0);
md_len = gcry_md_get_algo_dlen(key_info->auth_spec->gcry_alg);
@@ -4839,7 +4839,8 @@ static guint ikev2_key_hash_func(gconstpointer k) {
}
static gint ikev2_key_equal_func(gconstpointer k1, gconstpointer k2) {
- const ikev2_uat_data_key_t *key1 = k1, *key2 = k2;
+ const ikev2_uat_data_key_t *key1 = (const ikev2_uat_data_key_t *)k1;
+ const ikev2_uat_data_key_t *key2 = (const ikev2_uat_data_key_t *)k2;
if (key1->spii_len != key2->spii_len) return 0;
if (key1->spir_len != key2->spir_len) return 0;
if (memcmp(key1->spii, key2->spii, key1->spii_len) != 0) return 0;
@@ -4853,8 +4854,8 @@ static gint ikev2_key_equal_func(gconstpointer k1, gconstpointer k2) {
static gboolean
free_cookie(gpointer key_arg, gpointer value, gpointer user_data _U_)
{
- guint8 *ic_key = key_arg;
- decrypt_data_t *decr = value;
+ guint8 *ic_key = (guint8 *)key_arg;
+ decrypt_data_t *decr = (decrypt_data_t *)value;
g_slice_free1(COOKIE_SIZE, ic_key);
g_slice_free1(sizeof(decrypt_data_t), decr);
@@ -4880,8 +4881,8 @@ isakmp_init_protocol(void) {
isakmp_hash = g_hash_table_new(isakmp_hash_func, isakmp_equal_func);
for (i = 0; i < num_ikev1_uat_data; i++) {
- ic_key = g_slice_alloc(COOKIE_SIZE);
- decr = g_slice_alloc(sizeof(decrypt_data_t));
+ ic_key = (guint8 *)g_slice_alloc(COOKIE_SIZE);
+ decr = (decrypt_data_t *)g_slice_alloc(sizeof(decrypt_data_t));
memcpy(ic_key, ikev1_uat_data[i].icookie, COOKIE_SIZE);
memset(decr, 0, sizeof(decrypt_data_t));
@@ -4915,7 +4916,7 @@ UAT_BUFFER_CB_DEF(ikev1_users, icookie, ikev1_uat_data_key_t, icookie, icookie_l
UAT_BUFFER_CB_DEF(ikev1_users, key, ikev1_uat_data_key_t, key, key_len)
static void ikev1_uat_data_update_cb(void* p, const char** err) {
- ikev1_uat_data_key_t *ud = p;
+ ikev1_uat_data_key_t *ud = (ikev1_uat_data_key_t *)p;
if (ud->icookie_len != COOKIE_SIZE) {
*err = ep_strdup_printf("Length of Initiator's COOKIE must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2);
@@ -4944,7 +4945,7 @@ UAT_BUFFER_CB_DEF(ikev2_users, sk_ar, ikev2_uat_data_t, sk_ar, sk_ar_len)
UAT_VS_DEF(ikev2_users, auth_alg, ikev2_uat_data_t, guint, IKEV2_AUTH_HMAC_SHA1_96, IKEV2_AUTH_HMAC_SHA1_96_STR)
static void ikev2_uat_data_update_cb(void* p, const char** err) {
- ikev2_uat_data_t *ud = p;
+ ikev2_uat_data_t *ud = (ikev2_uat_data_t *)p;
if (ud->key.spii_len != COOKIE_SIZE) {
*err = ep_strdup_printf("Length of Initiator's SPI must be %d octets (%d hex characters).", COOKIE_SIZE, COOKIE_SIZE * 2);
@@ -6119,7 +6120,7 @@ proto_register_isakmp(void)
sizeof(ikev1_uat_data_key_t),
"ikev1_decryption_table",
TRUE,
- (void*)&ikev1_uat_data,
+ (void**)&ikev1_uat_data,
&num_ikev1_uat_data,
UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
"ChIKEv1DecryptionSection",
@@ -6139,7 +6140,7 @@ proto_register_isakmp(void)
sizeof(ikev2_uat_data_t),
"ikev2_decryption_table",
TRUE,
- (void*)&ikev2_uat_data,
+ (void**)&ikev2_uat_data,
&num_ikev2_uat_data,
UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
"ChIKEv2DecryptionSection",