asn2wrs.py: use 64 bits variant for constrained integers using MIN or MAX keywords

Change-Id: Iffc7c81e9653e8c1cd938de8f4fc26c5912eceec
Reviewed-on: https://code.wireshark.org/review/24049
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Pavel Strnad 2017-10-25 10:34:47 +02:00 committed by Michael Mann
parent eae216ef1d
commit 93fba33e95
11 changed files with 56 additions and 55 deletions

View File

@ -6453,7 +6453,7 @@ dissect_h245_MultiplePayloadStreamCapability(tvbuff_t *tvb _U_, int offset _U_,
static int
dissect_h245_MaxRedundancy(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
offset = dissect_per_constrained_integer_64b(tvb, offset, actx, tree, hf_index,
1U, NO_BOUND, NULL, FALSE);
return offset;
@ -17452,15 +17452,15 @@ void proto_register_h245(void) {
"OBJECT_IDENTIFIER", HFILL }},
{ &hf_h245_rfc2733rfc2198,
{ "rfc2733rfc2198", "h245.rfc2733rfc2198",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"MaxRedundancy", HFILL }},
{ &hf_h245_rfc2733sameport,
{ "rfc2733sameport", "h245.rfc2733sameport",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"MaxRedundancy", HFILL }},
{ &hf_h245_rfc2733diffport,
{ "rfc2733diffport", "h245.rfc2733diffport",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"MaxRedundancy", HFILL }},
{ &hf_h245_rfc2733Format,
{ "rfc2733Format", "h245.rfc2733Format",

View File

@ -10632,7 +10632,7 @@ void proto_register_inap(void) {
NULL, HFILL }},
{ &hf_inap_triggerId,
{ "triggerId", "inap.triggerId",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_inap_triggerPar,
{ "triggerPar", "inap.triggerPar_element",

View File

@ -2187,7 +2187,7 @@ dissect_p22_ChangeOfAddressAdvice(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
dissect_p22_INTEGER_1_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_constrained_integer(implicit_tag, actx, tree, tvb, offset,
offset = dissect_ber_constrained_integer64(implicit_tag, actx, tree, tvb, offset,
1U, NO_BOUND, hf_index, NULL);
return offset;
@ -2197,7 +2197,7 @@ dissect_p22_INTEGER_1_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_p22_BodyPartNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_constrained_integer(implicit_tag, actx, tree, tvb, offset,
offset = dissect_ber_constrained_integer64(implicit_tag, actx, tree, tvb, offset,
1U, NO_BOUND, hf_index, NULL);
return offset;
@ -5473,7 +5473,7 @@ void proto_register_p22(void) {
"SequenceNumber", HFILL }},
{ &hf_p22_submitted_body_part,
{ "submitted-body-part", "p22.submitted_body_part",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_1_MAX", HFILL }},
{ &hf_p22_stored_body_part,
{ "stored-body-part", "p22.stored_body_part_element",
@ -5485,7 +5485,7 @@ void proto_register_p22(void) {
"SequenceNumber", HFILL }},
{ &hf_p22_body_part_number,
{ "body-part-number", "p22.body_part_number",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BodyPartNumber", HFILL }},
{ &hf_p22_Languages_item,
{ "Language", "p22.Language",
@ -6013,7 +6013,7 @@ void proto_register_p22(void) {
NULL, HFILL }},
{ &hf_p22_body_part_sequence_number,
{ "body-part-sequence-number", "p22.body_part_sequence_number",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BodyPartNumber", HFILL }},
{ &hf_p22_body_part_signature_status,
{ "body-part-signature", "p22.body_part_signature",

View File

@ -970,7 +970,7 @@ dissect_pkcs12_T_saltChoice(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_pkcs12_INTEGER_1_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -1384,7 +1384,7 @@ void proto_register_pkcs12(void) {
"AlgorithmIdentifier", HFILL }},
{ &hf_pkcs12_keyLength,
{ "keyLength", "pkcs12.keyLength",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_1_MAX", HFILL }},
{ &hf_pkcs12_prf,
{ "prf", "pkcs12.prf_element",

View File

@ -479,7 +479,7 @@ dissect_pkixac_RFC3281Clearance(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_pkixac_INTEGER_0_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -762,7 +762,7 @@ void proto_register_pkixac(void) {
NULL, HFILL }},
{ &hf_pkixac_pathLenConstraint,
{ "pathLenConstraint", "pkixac.pathLenConstraint",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_pkixac_permittedAttrs,
{ "permittedAttrs", "pkixac.permittedAttrs",

View File

@ -1704,7 +1704,7 @@ dissect_t124_Segmentation(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U
static int
dissect_t124_INTEGER_0_MAX(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index,
offset = dissect_per_constrained_integer_64b(tvb, offset, actx, tree, hf_index,
0U, NO_BOUND, NULL, FALSE);
return offset;
@ -3502,15 +3502,15 @@ void proto_register_t124(void) {
NULL, HFILL }},
{ &hf_t124_heightLimit,
{ "heightLimit", "t124.heightLimit",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t124_subHeight,
{ "subHeight", "t124.subHeight",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t124_subInterval,
{ "subInterval", "t124.subInterval",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t124_static,
{ "static", "t124.static_element",

View File

@ -126,7 +126,7 @@ dissect_t125_DataPriority(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_t125_INTEGER_0_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -462,35 +462,35 @@ void proto_register_t125(void) {
NULL, HFILL }},
{ &hf_t125_maxChannelIds,
{ "maxChannelIds", "t125.maxChannelIds",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_maxUserIds,
{ "maxUserIds", "t125.maxUserIds",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_maxTokenIds,
{ "maxTokenIds", "t125.maxTokenIds",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_numPriorities,
{ "numPriorities", "t125.numPriorities",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_minThroughput,
{ "minThroughput", "t125.minThroughput",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_maxHeight,
{ "maxHeight", "t125.maxHeight",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_maxMCSPDUsize,
{ "maxMCSPDUsize", "t125.maxMCSPDUsize",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_protocolVersion,
{ "protocolVersion", "t125.protocolVersion",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_callingDomainSelector,
{ "callingDomainSelector", "t125.callingDomainSelector",
@ -526,7 +526,7 @@ void proto_register_t125(void) {
NULL, HFILL }},
{ &hf_t125_calledConnectId,
{ "calledConnectId", "t125.calledConnectId",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_t125_domainParameters,
{ "domainParameters", "t125.domainParameters_element",

View File

@ -10460,7 +10460,7 @@ void proto_register_tetra (void)
"INTEGER_0_7", HFILL }},
{ &hf_tetra_network_time,
{ "network-time", "tetra.network_time",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_tetra_local_time_offset_sign,
{ "local-time-offset-sign", "tetra.local_time_offset_sign",
@ -10476,7 +10476,7 @@ void proto_register_tetra (void)
"INTEGER_0_63", HFILL }},
{ &hf_tetra_reserved_04,
{ "reserved", "tetra.reserved",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_tetra_u_Authentication,
{ "u-Authentication", "tetra.u_Authentication_element",

View File

@ -721,7 +721,7 @@ dissect_x509ce_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_x509ce_INTEGER_0_MAX(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -746,7 +746,7 @@ dissect_x509ce_BasicConstraintsSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb _
int
dissect_x509ce_BaseDistance(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -800,7 +800,7 @@ dissect_x509ce_NameConstraintsSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb _U
int
dissect_x509ce_SkipCerts(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -825,7 +825,7 @@ dissect_x509ce_PolicyConstraintsSyntax(gboolean implicit_tag _U_, tvbuff_t *tvb
int
dissect_x509ce_CRLNumber(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -956,7 +956,7 @@ dissect_x509ce_NumberRange(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
int
dissect_x509ce_CRLStreamIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -2064,11 +2064,11 @@ void proto_register_x509ce(void) {
NULL, HFILL }},
{ &hf_x509ce_SkipCerts_PDU,
{ "SkipCerts", "x509ce.SkipCerts",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_CRLNumber_PDU,
{ "CRLNumber", "x509ce.CRLNumber",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_CRLReason_PDU,
{ "CRLReason", "x509ce.CRLReason",
@ -2088,7 +2088,7 @@ void proto_register_x509ce(void) {
NULL, HFILL }},
{ &hf_x509ce_CRLStreamIdentifier_PDU,
{ "CRLStreamIdentifier", "x509ce.CRLStreamIdentifier",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_OrderedListSyntax_PDU,
{ "OrderedListSyntax", "x509ce.OrderedListSyntax",
@ -2108,7 +2108,7 @@ void proto_register_x509ce(void) {
NULL, HFILL }},
{ &hf_x509ce_BaseCRLNumber_PDU,
{ "BaseCRLNumber", "x509ce.BaseCRLNumber",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_ToBeRevokedSyntax_PDU,
{ "ToBeRevokedSyntax", "x509ce.ToBeRevokedSyntax",
@ -2300,7 +2300,7 @@ void proto_register_x509ce(void) {
"BOOLEAN", HFILL }},
{ &hf_x509ce_pathLenConstraint,
{ "pathLenConstraint", "x509ce.pathLenConstraint",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_x509ce_permittedSubtrees,
{ "permittedSubtrees", "x509ce.permittedSubtrees",
@ -2320,19 +2320,19 @@ void proto_register_x509ce(void) {
"GeneralName", HFILL }},
{ &hf_x509ce_minimum,
{ "minimum", "x509ce.minimum",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BaseDistance", HFILL }},
{ &hf_x509ce_maximum,
{ "maximum", "x509ce.maximum",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BaseDistance", HFILL }},
{ &hf_x509ce_requireExplicitPolicy,
{ "requireExplicitPolicy", "x509ce.requireExplicitPolicy",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"SkipCerts", HFILL }},
{ &hf_x509ce_inhibitPolicyMapping,
{ "inhibitPolicyMapping", "x509ce.inhibitPolicyMapping",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"SkipCerts", HFILL }},
{ &hf_x509ce_CRLScopeSyntax_item,
{ "PerAuthorityScope", "x509ce.PerAuthorityScope_element",
@ -2384,11 +2384,11 @@ void proto_register_x509ce(void) {
"INTEGER", HFILL }},
{ &hf_x509ce_cRLStreamIdentifier,
{ "cRLStreamIdentifier", "x509ce.cRLStreamIdentifier",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_cRLNumber,
{ "cRLNumber", "x509ce.cRLNumber",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
NULL, HFILL }},
{ &hf_x509ce_baseThisUpdate,
{ "baseThisUpdate", "x509ce.baseThisUpdate",
@ -2624,11 +2624,11 @@ void proto_register_x509ce(void) {
"Time", HFILL }},
{ &hf_x509ce_minCRLNumber,
{ "minCRLNumber", "x509ce.minCRLNumber",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"CRLNumber", HFILL }},
{ &hf_x509ce_maxCRLNumber,
{ "maxCRLNumber", "x509ce.maxCRLNumber",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"CRLNumber", HFILL }},
{ &hf_x509ce_reasonFlags,
{ "reasonFlags", "x509ce.reasonFlags",
@ -2684,11 +2684,11 @@ void proto_register_x509ce(void) {
"EntrustInfoFlags", HFILL }},
{ &hf_x509ce_capability,
{ "capability", "x509ce.capability",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_x509ce_version,
{ "version", "x509ce.version",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"INTEGER_0_MAX", HFILL }},
{ &hf_x509ce_KeyUsage_digitalSignature,
{ "digitalSignature", "x509ce.digitalSignature",

View File

@ -1070,7 +1070,7 @@ dissect_x509if_T_specificExclusions(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_x509if_BaseDistance(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
offset = dissect_ber_integer64(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
return offset;
@ -2316,11 +2316,11 @@ void proto_register_x509if(void) {
"LocalName", HFILL }},
{ &hf_x509if_minimum,
{ "minimum", "x509if.minimum",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BaseDistance", HFILL }},
{ &hf_x509if_maximum,
{ "maximum", "x509if.maximum",
FT_UINT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"BaseDistance", HFILL }},
{ &hf_x509if_item,
{ "item", "x509if.item",

View File

@ -3618,8 +3618,9 @@ class Constraint (Node):
def Needs64b(self, ectx):
(minv, maxv, ext) = self.GetValue(ectx)
if (str(minv).isdigit() or ((str(minv)[0] == "-") and str(minv)[1:].isdigit())) \
and str(maxv).isdigit() and (abs(int(maxv) - int(minv)) >= 2**32):
if ((str(minv).isdigit() or ((str(minv)[0] == "-") and str(minv)[1:].isdigit())) \
and str(maxv).isdigit() and (abs(int(maxv) - int(minv)) >= 2**32)) \
or (maxv == 'MAX') or (minv == 'MIN'):
return True
return False