wmem: convert more asn1 dissectors to pinfo->pool

We prefer pinfo->pool over the global wmem_packet_scope() now. Convert a
few more asn1 dissectors. After this commit, just three asn1 dissectors
remain.
This commit is contained in:
Evan Huus 2021-08-17 16:26:50 -04:00 committed by Wireshark GitLab Utility
parent 042001fb55
commit eda26f9e5f
16 changed files with 110 additions and 110 deletions

View File

@ -853,7 +853,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
/* check if not inherited from FeatureDescriptor */
gefx = gef_ctx_get(actx->private_data);
if (!gefx) {
gefx = gef_ctx_alloc(NULL, "GenericData");
gefx = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericData");
actx->private_data = gefx;
}
#.FN_FTR
@ -864,7 +864,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, NULL);
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, NULL);
#.FN_FTR
actx->private_data = parent_gefx;
#.END
@ -872,7 +872,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
#----------------------------------------------------------------------------------------
#.FN_HDR FeatureDescriptor
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "FeatureDescriptor");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "FeatureDescriptor");
#.FN_FTR
actx->private_data = priv_data;
#.END
@ -882,7 +882,7 @@ H221NonStandard/manufacturerCode VAL_PTR = &manufacturerCode
gef_ctx_t *gefx;
proto_item* ti;
#.FN_FTR
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h225_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);

View File

@ -571,7 +571,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
/* check if not inherited from GenericInformation */
gefx = gef_ctx_get(actx->private_data);
if (!gefx) {
gefx = gef_ctx_alloc(NULL, "GenericMessage");
gefx = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericMessage");
actx->private_data = gefx;
}
#.FN_FTR
@ -595,7 +595,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
%(DEFAULT_BODY)s
if (gefx) {
gefx->subid = wmem_strdup_printf(actx->pinfo->pool, "%%u", subMessageIdentifier);
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
}
if (hf_index == hf_h245_subMessageIdentifier_standard)
{
@ -608,7 +608,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, NULL);
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, NULL);
#.FN_FTR
actx->private_data = parent_gefx;
#.END
@ -616,7 +616,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#----------------------------------------------------------------------------------------
#.FN_HDR GenericInformation
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "GenericInformation");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericInformation");
#.FN_FTR
actx->private_data = priv_data;
#.END
@ -624,7 +624,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#--- GenericCapability ------------------------------------------------------------------
#.FN_HDR GenericCapability
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "GenericCapability");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericCapability");
#.FN_FTR
actx->private_data = priv_data;
#.END
@ -633,7 +633,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "collapsing");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "collapsing");
#.FN_FTR
actx->private_data = parent_gefx;
#.END
@ -642,7 +642,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "nonCollapsing");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "nonCollapsing");
#.FN_FTR
actx->private_data = parent_gefx;
#.END
@ -654,7 +654,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
proto_item* ti;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "nonCollapsingRaw");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "nonCollapsingRaw");
%(DEFAULT_BODY)s
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
@ -668,7 +668,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
#--- EncryptionSync ---------------------------------------------------------------------
#.FN_HDR EncryptionSync
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "EncryptionSync");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "EncryptionSync");
#.FN_FTR
actx->private_data = priv_data;
#.END
@ -679,7 +679,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
proto_item* ti;
#.FN_FTR
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h245_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);
@ -710,7 +710,7 @@ Rfc2733Format FECCapability/rfc2733Format FECMode/rfc2733Format
gef_ctx_t *gefx;
proto_item* ti;
#.FN_FTR
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h245_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);

View File

@ -27,10 +27,10 @@ void proto_register_h323(void);
void proto_reg_handoff_h323(void);
/* Generic Extensible Framework */
gef_ctx_t* gef_ctx_alloc(gef_ctx_t *parent, const gchar *type) {
gef_ctx_t* gef_ctx_alloc(wmem_allocator_t *pool, gef_ctx_t *parent, const gchar *type) {
gef_ctx_t *gefx;
gefx = wmem_new0(wmem_packet_scope(), gef_ctx_t);
gefx = wmem_new0(pool, gef_ctx_t);
gefx->signature = GEF_CTX_SIGNATURE;
gefx->parent = parent;
gefx->type = type;
@ -57,12 +57,12 @@ gef_ctx_t* gef_ctx_get(void *ptr) {
return gefx;
}
void gef_ctx_update_key(gef_ctx_t *gefx) {
void gef_ctx_update_key(wmem_allocator_t *pool, gef_ctx_t *gefx) {
const gchar *parent_key;
if (!gefx) return;
parent_key = (gefx->parent) ? gefx->parent->key : NULL;
gefx->key = wmem_strdup_printf(wmem_packet_scope(),
gefx->key = wmem_strdup_printf(pool,
"%s%s" /* parent prefix */
"%s%s%s" /* type, id */
"%s%s" /* subid */,

View File

@ -43,10 +43,10 @@ typedef struct _gef_ctx_t {
const gchar *key;
} gef_ctx_t;
extern gef_ctx_t* gef_ctx_alloc(gef_ctx_t *parent, const gchar *type);
extern gef_ctx_t* gef_ctx_alloc(wmem_allocator_t *pool, gef_ctx_t *parent, const gchar *type);
extern gboolean gef_ctx_check_signature(gef_ctx_t *gefx);
extern gef_ctx_t* gef_ctx_get(void *ptr);
extern void gef_ctx_update_key(gef_ctx_t *gefx);
extern void gef_ctx_update_key(wmem_allocator_t *pool, gef_ctx_t *gefx);
#endif /* PACKET_H323_H */

View File

@ -353,18 +353,18 @@ call_kerberos_callbacks(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
}
static kerberos_private_data_t*
kerberos_new_private_data(void)
kerberos_new_private_data(packet_info *pinfo)
{
kerberos_private_data_t *p;
p = wmem_new0(wmem_packet_scope(), kerberos_private_data_t);
p = wmem_new0(pinfo->pool, kerberos_private_data_t);
if (p == NULL) {
return NULL;
}
p->decryption_keys = wmem_list_new(wmem_packet_scope());
p->learnt_keys = wmem_list_new(wmem_packet_scope());
p->missing_keys = wmem_list_new(wmem_packet_scope());
p->decryption_keys = wmem_list_new(pinfo->pool);
p->learnt_keys = wmem_list_new(pinfo->pool);
p->missing_keys = wmem_list_new(pinfo->pool);
return p;
}
@ -373,7 +373,7 @@ static kerberos_private_data_t*
kerberos_get_private_data(asn1_ctx_t *actx)
{
if (!actx->private_data) {
actx->private_data = kerberos_new_private_data();
actx->private_data = kerberos_new_private_data(actx->pinfo);
}
return (kerberos_private_data_t *)(actx->private_data);
}
@ -1549,7 +1549,7 @@ decrypt_krb5_data(proto_tree *tree _U_, packet_info *pinfo,
int keytype,
int *datalen)
{
kerberos_private_data_t *zero_private = kerberos_new_private_data();
kerberos_private_data_t *zero_private = kerberos_new_private_data(pinfo);
return decrypt_krb5_data_private(tree, pinfo, zero_private,
usage, cryptotvb, keytype,
datalen);
@ -1699,7 +1699,7 @@ decrypt_krb5_krb_cfx_dce(proto_tree *tree,
tvbuff_t *checksum_tvb)
{
struct decrypt_krb5_krb_cfx_dce_state state;
kerberos_private_data_t *zero_private = kerberos_new_private_data();
kerberos_private_data_t *zero_private = kerberos_new_private_data(pinfo);
tvbuff_t *gssapi_decrypted_tvb = NULL;
krb5_error_code ret;

View File

@ -197,7 +197,7 @@ nbap_private_data->binding_id_port = 0;
set_address(&dst_addr, AT_IPv4, 4, &transportLayerAddress_ipv4);
request_conv = find_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id);
request_conv = find_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id);
if(request_conv == NULL){
return offset;
@ -641,7 +641,7 @@ actx->pinfo->link_dir=P2P_DIR_UL;
default: /* First, subsequent or last */
if(preferences_ib_sg_data_encoding == IB_SG_DATA_ENC_VAR_1) {
is_short = ( segment_type == 1 || segment_type == 4 ); /* first-short or last-short */
nbap_ib_segment = nbap_parse_ib_sg_data_var1(parameter_tvb, is_short);
nbap_ib_segment = nbap_parse_ib_sg_data_var1(actx->pinfo, parameter_tvb, is_short);
if (nbap_ib_segment == NULL ) { /* failed to parse */
return offset;
}
@ -1065,7 +1065,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
}
#.FN_BODY PICH-Mode VAL_PTR = &PICH_Mode
@ -1194,7 +1194,7 @@ nbap_private_data->num_items = 1;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id, nbap_private_data->dd_mode, common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id, nbap_private_data->dd_mode, common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
nbap_debug("Frame %%u PCH-ParametersItem-CTCH-SetupRqstFDD End", actx->pinfo->num);
}
@ -1296,7 +1296,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
}
#.FN_HDR DCH-Specific-FDD-InformationList

View File

@ -182,7 +182,7 @@ typedef struct nbap_ib_segment_t {
guint8* data;
} nbap_ib_segment_t;
static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(tvbuff_t *tvb,gboolean is_short)
static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(packet_info *pinfo, tvbuff_t *tvb,gboolean is_short)
{
guint8 bit_length;
guint8* data;
@ -192,13 +192,13 @@ static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(tvbuff_t *tvb,gboolean is_s
}
if (is_short) {
bit_length = tvb_get_guint8(tvb,0) + 1;
data = (guint8*)tvb_memdup(wmem_packet_scope(),tvb,1,(bit_length+7)/8);
data = (guint8*)tvb_memdup(pinfo->pool,tvb,1,(bit_length+7)/8);
}
else {
bit_length = NBAP_MAX_IB_SEGMENT_LENGTH;
data = (guint8*)tvb_memdup(wmem_packet_scope(),tvb,0,(bit_length+7)/8);
data = (guint8*)tvb_memdup(pinfo->pool,tvb,0,(bit_length+7)/8);
}
output = wmem_new(wmem_packet_scope(), nbap_ib_segment_t);
output = wmem_new(pinfo->pool, nbap_ib_segment_t);
output->bit_length = bit_length;
output->data = data;
return output;
@ -424,9 +424,9 @@ static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, pro
static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv);
static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static void delete_setup_conv(nbap_setup_conv_t *conv);
/*Easy way to add hsdhsch binds for corner cases*/
@ -545,14 +545,14 @@ static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guin
return key;
}
static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv)
{
nbap_setup_conv_t *new_conv = NULL;
guint32 key;
nbap_debug("Creating new setup conv\t TransactionID: %u\tddMode: %u\tChannelID: %u\t %s:%u",
transaction_id, dd_mode, channel_id, address_to_str(wmem_packet_scope(), addr), port);
transaction_id, dd_mode, channel_id, address_to_str(pinfo->pool, addr), port);
new_conv = wmem_new0(wmem_file_scope(), nbap_setup_conv_t);
@ -571,7 +571,7 @@ static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode,
wmem_map_insert(nbap_setup_conv_table, GUINT_TO_POINTER(key), new_conv);
}
static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id)
static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id)
{
nbap_setup_conv_t *conv;
guint32 key;
@ -585,7 +585,7 @@ static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const gu
nbap_debug("\tDidn't find Setup Conversation match");
}else{
nbap_debug("\tFOUND Setup Conversation match\t TransactionID: %u\t ddMode: %u\t ChannelID: %u\t %s:%u",
conv->transaction_id, conv->dd_mode, conv->channel_id, address_to_str(wmem_packet_scope(), &(conv->addr)), conv->port);
conv->transaction_id, conv->dd_mode, conv->channel_id, address_to_str(pinfo->pool, &(conv->addr)), conv->port);
}
return conv;

View File

@ -65,16 +65,16 @@ static int dissect_PrivateKeyInfo_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_t
/* Initialize the subtree pointers */
#include "packet-pkcs12-ett.c"
static void append_oid(proto_tree *tree, const char *oid)
static void append_oid(wmem_allocator_t *pool, proto_tree *tree, const char *oid)
{
const char *name = NULL;
name = oid_resolved_from_string(wmem_packet_scope(), oid);
name = oid_resolved_from_string(pool, oid);
proto_item_append_text(tree, " (%s)", name ? name : oid);
}
static int
generate_key_or_iv(unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
const char *pw, unsigned int req_keylen, char * keybuf)
{
int rc;
@ -92,7 +92,7 @@ generate_key_or_iv(unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
cur_keylen = 0;
salt_size = tvb_captured_length(salt_tvb);
salt_p = (char *)tvb_memdup(wmem_packet_scope(), salt_tvb, 0, salt_size);
salt_p = (char *)tvb_memdup(pinfo->pool, salt_tvb, 0, salt_size);
if (pw == NULL)
pwlen = 0;
@ -259,14 +259,14 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry
/* allocate buffers */
key = (char *)wmem_alloc(pinfo->pool, keylen);
if(!generate_key_or_iv(1 /*LEY */, salt, iteration_count, password, keylen, key))
if(!generate_key_or_iv(pinfo, 1 /*LEY */, salt, iteration_count, password, keylen, key))
return FALSE;
if(ivlen) {
iv = (char *)wmem_alloc(pinfo->pool, ivlen);
if(!generate_key_or_iv(2 /* IV */, salt, iteration_count, password, ivlen, iv))
if(!generate_key_or_iv(pinfo, 2 /* IV */, salt, iteration_count, password, ivlen, iv))
return FALSE;
}

View File

@ -81,27 +81,27 @@ PrivateKeyInfo
#.FN_PARS SafeBag/bagId FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_FTR SafeBag/bagId
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
#.END
#.FN_PARS CertBag/certId FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_FTR CertBag/certId
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
#.END
#.FN_PARS CRLBag/crlId FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_FTR CRLBag/crlId
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
#.END
#.FN_PARS SecretBag/secretTypeId FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_FTR SecretBag/secretTypeId
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
#.END
#.FN_PARS PKCS12Attribute/attrId FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_FTR PKCS12Attribute/attrId
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
#.END
#.FN_BODY SafeBag/bagValue

View File

@ -3885,7 +3885,7 @@ dissect_h225_GenericIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac
NULL);
#line 885 "./asn1/h225/h225.cnf"
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h225_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);
@ -4023,7 +4023,7 @@ dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, NULL);
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, NULL);
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h225_EnumeratedParameter, EnumeratedParameter_sequence);
@ -4050,7 +4050,7 @@ dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
/* check if not inherited from FeatureDescriptor */
gefx = gef_ctx_get(actx->private_data);
if (!gefx) {
gefx = gef_ctx_alloc(NULL, "GenericData");
gefx = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericData");
actx->private_data = gefx;
}
@ -4098,7 +4098,7 @@ static int
dissect_h225_FeatureDescriptor(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 874 "./asn1/h225/h225.cnf"
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "FeatureDescriptor");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "FeatureDescriptor");
offset = dissect_h225_GenericData(tvb, offset, actx, tree, hf_index);

View File

@ -3603,7 +3603,7 @@ dissect_h245_CapabilityIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
NULL);
#line 682 "./asn1/h245/h245.cnf"
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h245_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);
@ -3671,7 +3671,7 @@ dissect_h245_ParameterIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *
NULL);
#line 713 "./asn1/h245/h245.cnf"
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
gefx = gef_ctx_get(actx->private_data);
if (gefx) {
ti = proto_tree_add_string(tree, hf_h245_debug_dissector_try_string, tvb, offset>>3, 0, gefx->key);
@ -3935,7 +3935,7 @@ dissect_h245_T_collapsing_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *ac
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "collapsing");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "collapsing");
offset = dissect_h245_GenericParameter(tvb, offset, actx, tree, hf_index);
@ -3966,7 +3966,7 @@ dissect_h245_T_nonCollapsing_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "nonCollapsing");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "nonCollapsing");
offset = dissect_h245_GenericParameter(tvb, offset, actx, tree, hf_index);
@ -4000,7 +4000,7 @@ dissect_h245_T_nonCollapsingRaw(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *a
proto_item* ti;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, "nonCollapsingRaw");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, "nonCollapsingRaw");
offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index,
NO_BOUND, NO_BOUND, FALSE, &value_tvb);
@ -4031,7 +4031,7 @@ static int
dissect_h245_GenericCapability(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 626 "./asn1/h245/h245.cnf"
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "GenericCapability");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericCapability");
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h245_GenericCapability, GenericCapability_sequence);
@ -6654,7 +6654,7 @@ dissect_h245_T_subMessageIdentifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_
if (gefx) {
gefx->subid = wmem_strdup_printf(actx->pinfo->pool, "%u", subMessageIdentifier);
gef_ctx_update_key(gef_ctx_get(actx->private_data));
gef_ctx_update_key(actx->pinfo->pool, gef_ctx_get(actx->private_data));
}
if (hf_index == hf_h245_subMessageIdentifier_standard)
{
@ -6674,7 +6674,7 @@ dissect_h245_T_messageContent_item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
actx->private_data = gef_ctx_alloc(parent_gefx, NULL);
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, parent_gefx, NULL);
offset = dissect_h245_GenericParameter(tvb, offset, actx, tree, hf_index);
@ -6714,7 +6714,7 @@ dissect_h245_GenericMessage(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
/* check if not inherited from GenericInformation */
gefx = gef_ctx_get(actx->private_data);
if (!gefx) {
gefx = gef_ctx_alloc(NULL, "GenericMessage");
gefx = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericMessage");
actx->private_data = gefx;
}
@ -6733,7 +6733,7 @@ static int
dissect_h245_GenericInformation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 618 "./asn1/h245/h245.cnf"
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "GenericInformation");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "GenericInformation");
offset = dissect_h245_GenericMessage(tvb, offset, actx, tree, hf_index);
@ -8707,7 +8707,7 @@ static int
dissect_h245_EncryptionSync(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 670 "./asn1/h245/h245.cnf"
void *priv_data = actx->private_data;
actx->private_data = gef_ctx_alloc(NULL, "EncryptionSync");
actx->private_data = gef_ctx_alloc(actx->pinfo->pool, NULL, "EncryptionSync");
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h245_EncryptionSync, EncryptionSync_sequence);

View File

@ -35,10 +35,10 @@ void proto_register_h323(void);
void proto_reg_handoff_h323(void);
/* Generic Extensible Framework */
gef_ctx_t* gef_ctx_alloc(gef_ctx_t *parent, const gchar *type) {
gef_ctx_t* gef_ctx_alloc(wmem_allocator_t *pool, gef_ctx_t *parent, const gchar *type) {
gef_ctx_t *gefx;
gefx = wmem_new0(wmem_packet_scope(), gef_ctx_t);
gefx = wmem_new0(pool, gef_ctx_t);
gefx->signature = GEF_CTX_SIGNATURE;
gefx->parent = parent;
gefx->type = type;
@ -65,12 +65,12 @@ gef_ctx_t* gef_ctx_get(void *ptr) {
return gefx;
}
void gef_ctx_update_key(gef_ctx_t *gefx) {
void gef_ctx_update_key(wmem_allocator_t *pool, gef_ctx_t *gefx) {
const gchar *parent_key;
if (!gefx) return;
parent_key = (gefx->parent) ? gefx->parent->key : NULL;
gefx->key = wmem_strdup_printf(wmem_packet_scope(),
gefx->key = wmem_strdup_printf(pool,
"%s%s" /* parent prefix */
"%s%s%s" /* type, id */
"%s%s" /* subid */,

View File

@ -51,10 +51,10 @@ typedef struct _gef_ctx_t {
const gchar *key;
} gef_ctx_t;
extern gef_ctx_t* gef_ctx_alloc(gef_ctx_t *parent, const gchar *type);
extern gef_ctx_t* gef_ctx_alloc(wmem_allocator_t *pool, gef_ctx_t *parent, const gchar *type);
extern gboolean gef_ctx_check_signature(gef_ctx_t *gefx);
extern gef_ctx_t* gef_ctx_get(void *ptr);
extern void gef_ctx_update_key(gef_ctx_t *gefx);
extern void gef_ctx_update_key(wmem_allocator_t *pool, gef_ctx_t *gefx);
#endif /* PACKET_H323_H */

View File

@ -802,18 +802,18 @@ call_kerberos_callbacks(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int
}
static kerberos_private_data_t*
kerberos_new_private_data(void)
kerberos_new_private_data(packet_info *pinfo)
{
kerberos_private_data_t *p;
p = wmem_new0(wmem_packet_scope(), kerberos_private_data_t);
p = wmem_new0(pinfo->pool, kerberos_private_data_t);
if (p == NULL) {
return NULL;
}
p->decryption_keys = wmem_list_new(wmem_packet_scope());
p->learnt_keys = wmem_list_new(wmem_packet_scope());
p->missing_keys = wmem_list_new(wmem_packet_scope());
p->decryption_keys = wmem_list_new(pinfo->pool);
p->learnt_keys = wmem_list_new(pinfo->pool);
p->missing_keys = wmem_list_new(pinfo->pool);
return p;
}
@ -822,7 +822,7 @@ static kerberos_private_data_t*
kerberos_get_private_data(asn1_ctx_t *actx)
{
if (!actx->private_data) {
actx->private_data = kerberos_new_private_data();
actx->private_data = kerberos_new_private_data(actx->pinfo);
}
return (kerberos_private_data_t *)(actx->private_data);
}
@ -1998,7 +1998,7 @@ decrypt_krb5_data(proto_tree *tree _U_, packet_info *pinfo,
int keytype,
int *datalen)
{
kerberos_private_data_t *zero_private = kerberos_new_private_data();
kerberos_private_data_t *zero_private = kerberos_new_private_data(pinfo);
return decrypt_krb5_data_private(tree, pinfo, zero_private,
usage, cryptotvb, keytype,
datalen);
@ -2148,7 +2148,7 @@ decrypt_krb5_krb_cfx_dce(proto_tree *tree,
tvbuff_t *checksum_tvb)
{
struct decrypt_krb5_krb_cfx_dce_state state;
kerberos_private_data_t *zero_private = kerberos_new_private_data();
kerberos_private_data_t *zero_private = kerberos_new_private_data(pinfo);
tvbuff_t *gssapi_decrypted_tvb = NULL;
krb5_error_code ret;

View File

@ -6575,7 +6575,7 @@ typedef struct nbap_ib_segment_t {
guint8* data;
} nbap_ib_segment_t;
static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(tvbuff_t *tvb,gboolean is_short)
static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(packet_info *pinfo, tvbuff_t *tvb,gboolean is_short)
{
guint8 bit_length;
guint8* data;
@ -6585,13 +6585,13 @@ static nbap_ib_segment_t* nbap_parse_ib_sg_data_var1(tvbuff_t *tvb,gboolean is_s
}
if (is_short) {
bit_length = tvb_get_guint8(tvb,0) + 1;
data = (guint8*)tvb_memdup(wmem_packet_scope(),tvb,1,(bit_length+7)/8);
data = (guint8*)tvb_memdup(pinfo->pool,tvb,1,(bit_length+7)/8);
}
else {
bit_length = NBAP_MAX_IB_SEGMENT_LENGTH;
data = (guint8*)tvb_memdup(wmem_packet_scope(),tvb,0,(bit_length+7)/8);
data = (guint8*)tvb_memdup(pinfo->pool,tvb,0,(bit_length+7)/8);
}
output = wmem_new(wmem_packet_scope(), nbap_ib_segment_t);
output = wmem_new(pinfo->pool, nbap_ib_segment_t);
output->bit_length = bit_length;
output->data = data;
return output;
@ -6817,9 +6817,9 @@ static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, pro
static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *);
static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv);
static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id);
static void delete_setup_conv(nbap_setup_conv_t *conv);
/*Easy way to add hsdhsch binds for corner cases*/
@ -12654,7 +12654,7 @@ nbap_private_data->binding_id_port = 0;
set_address(&dst_addr, AT_IPv4, 4, &transportLayerAddress_ipv4);
request_conv = find_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id);
request_conv = find_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id);
if(request_conv == NULL){
return offset;
@ -26723,7 +26723,7 @@ dissect_nbap_IB_SG_DATA(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
default: /* First, subsequent or last */
if(preferences_ib_sg_data_encoding == IB_SG_DATA_ENC_VAR_1) {
is_short = ( segment_type == 1 || segment_type == 4 ); /* first-short or last-short */
nbap_ib_segment = nbap_parse_ib_sg_data_var1(parameter_tvb, is_short);
nbap_ib_segment = nbap_parse_ib_sg_data_var1(actx->pinfo, parameter_tvb, is_short);
if (nbap_ib_segment == NULL ) { /* failed to parse */
return offset;
}
@ -33017,7 +33017,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
}
@ -33199,7 +33199,7 @@ nbap_private_data->num_items = 1;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id, nbap_private_data->dd_mode, common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id, nbap_private_data->dd_mode, common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
nbap_debug("Frame %u PCH-ParametersItem-CTCH-SetupRqstFDD End", actx->pinfo->num);
}
@ -33314,7 +33314,7 @@ nbap_private_data->transport_format_set_type = NBAP_CPCH;
set_umts_fp_conv_data(conversation, umts_fp_conversation_info);
/* Add Setup Conversation to list, we need it in response msg */
add_setup_conv(nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
add_setup_conv(actx->pinfo, nbap_private_data->transaction_id,nbap_private_data->dd_mode,nbap_private_data->common_transport_channel_id, actx->pinfo->num, &dst_addr, bindingID, umts_fp_conversation_info, conversation);
}
@ -55814,14 +55814,14 @@ static guint32 calculate_setup_conv_key(const guint32 transaction_id, const guin
return key;
}
static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
static void add_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id, const guint32 req_frame_number,
const address *addr, const guint32 port, umts_fp_conversation_info_t * umts_fp_conversation_info, conversation_t *conv)
{
nbap_setup_conv_t *new_conv = NULL;
guint32 key;
nbap_debug("Creating new setup conv\t TransactionID: %u\tddMode: %u\tChannelID: %u\t %s:%u",
transaction_id, dd_mode, channel_id, address_to_str(wmem_packet_scope(), addr), port);
transaction_id, dd_mode, channel_id, address_to_str(pinfo->pool, addr), port);
new_conv = wmem_new0(wmem_file_scope(), nbap_setup_conv_t);
@ -55840,7 +55840,7 @@ static void add_setup_conv(const guint32 transaction_id, const guint32 dd_mode,
wmem_map_insert(nbap_setup_conv_table, GUINT_TO_POINTER(key), new_conv);
}
static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id)
static nbap_setup_conv_t* find_setup_conv(const packet_info *pinfo _U_, const guint32 transaction_id, const guint32 dd_mode, const guint32 channel_id)
{
nbap_setup_conv_t *conv;
guint32 key;
@ -55854,7 +55854,7 @@ static nbap_setup_conv_t* find_setup_conv(const guint32 transaction_id, const gu
nbap_debug("\tDidn't find Setup Conversation match");
}else{
nbap_debug("\tFOUND Setup Conversation match\t TransactionID: %u\t ddMode: %u\t ChannelID: %u\t %s:%u",
conv->transaction_id, conv->dd_mode, conv->channel_id, address_to_str(wmem_packet_scope(), &(conv->addr)), conv->port);
conv->transaction_id, conv->dd_mode, conv->channel_id, address_to_str(pinfo->pool, &(conv->addr)), conv->port);
}
return conv;

View File

@ -153,16 +153,16 @@ static gint ett_pkcs12_PBMAC1Params = -1;
/*--- End of included file: packet-pkcs12-ett.c ---*/
#line 67 "./asn1/pkcs12/packet-pkcs12-template.c"
static void append_oid(proto_tree *tree, const char *oid)
static void append_oid(wmem_allocator_t *pool, proto_tree *tree, const char *oid)
{
const char *name = NULL;
name = oid_resolved_from_string(wmem_packet_scope(), oid);
name = oid_resolved_from_string(pool, oid);
proto_item_append_text(tree, " (%s)", name ? name : oid);
}
static int
generate_key_or_iv(unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
generate_key_or_iv(packet_info *pinfo, unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
const char *pw, unsigned int req_keylen, char * keybuf)
{
int rc;
@ -180,7 +180,7 @@ generate_key_or_iv(unsigned int id, tvbuff_t *salt_tvb, unsigned int iter,
cur_keylen = 0;
salt_size = tvb_captured_length(salt_tvb);
salt_p = (char *)tvb_memdup(wmem_packet_scope(), salt_tvb, 0, salt_size);
salt_p = (char *)tvb_memdup(pinfo->pool, salt_tvb, 0, salt_size);
if (pw == NULL)
pwlen = 0;
@ -347,14 +347,14 @@ int PBE_decrypt_data(const char *object_identifier_id_param _U_, tvbuff_t *encry
/* allocate buffers */
key = (char *)wmem_alloc(pinfo->pool, keylen);
if(!generate_key_or_iv(1 /*LEY */, salt, iteration_count, password, keylen, key))
if(!generate_key_or_iv(pinfo, 1 /*LEY */, salt, iteration_count, password, keylen, key))
return FALSE;
if(ivlen) {
iv = (char *)wmem_alloc(pinfo->pool, ivlen);
if(!generate_key_or_iv(2 /* IV */, salt, iteration_count, password, ivlen, iv))
if(!generate_key_or_iv(pinfo, 2 /* IV */, salt, iteration_count, password, ivlen, iv))
return FALSE;
}
@ -563,7 +563,7 @@ dissect_pkcs12_T_bagId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
#line 84 "./asn1/pkcs12/pkcs12.cnf"
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
return offset;
}
@ -588,7 +588,7 @@ dissect_pkcs12_T_attrId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
#line 104 "./asn1/pkcs12/pkcs12.cnf"
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
return offset;
}
@ -799,7 +799,7 @@ dissect_pkcs12_T_certId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
#line 89 "./asn1/pkcs12/pkcs12.cnf"
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
return offset;
}
@ -839,7 +839,7 @@ dissect_pkcs12_T_crlId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
#line 94 "./asn1/pkcs12/pkcs12.cnf"
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
return offset;
}
@ -879,7 +879,7 @@ dissect_pkcs12_T_secretTypeId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
#line 99 "./asn1/pkcs12/pkcs12.cnf"
append_oid(tree, object_identifier_id);
append_oid(actx->pinfo->pool, tree, object_identifier_id);
return offset;
}