implement AlgorithmIdentifier using the conformance file and remove it from the template
svn path=/trunk/; revision=12437
This commit is contained in:
parent
ee310edcda
commit
805f948c29
|
@ -24,7 +24,9 @@ IMPORTS
|
|||
FROM SelectedAttributeTypes selectedAttributeTypes
|
||||
certificateExactMatch, certificatePairExactMatch, certificateListExactMatch,
|
||||
GeneralNames
|
||||
FROM CertificateExtensions certificateExtensions;
|
||||
FROM CertificateExtensions certificateExtensions
|
||||
Any
|
||||
FROM DummyAF;
|
||||
|
||||
-- basic certificate definition
|
||||
Certificate ::= SEQUENCE {
|
||||
|
@ -50,10 +52,9 @@ Version ::= INTEGER {v1(0), v2(1), v3(2)}
|
|||
|
||||
CertificateSerialNumber ::= INTEGER
|
||||
|
||||
-- Can not be handled by compiler. Handimplemented in the template
|
||||
AlgorithmIdentifier ::= SEQUENCE {
|
||||
-- algorithm ALGORITHM.&id({SupportedAlgorithms}),
|
||||
-- parameters ALGORITHM.&Type({SupportedAlgorithms}{@algorithm}) OPTIONAL
|
||||
algorithmId OBJECT IDENTIFIER,
|
||||
parameters Any OPTIONAL
|
||||
}
|
||||
|
||||
-- Definition of the following information object set is deferred, perhaps to standardized
|
||||
|
@ -79,11 +80,10 @@ Extensions ::= SEQUENCE OF Extension
|
|||
|
||||
-- For those extensions where ordering of individual extensions within the SEQUENCE is significant, the
|
||||
-- specification of those individual extensions shall include the rules for the significance of the order therein
|
||||
-- XXX Implemented by hand in the template
|
||||
Extension ::= SEQUENCE {
|
||||
-- extnId EXTENSION.&id({ExtensionSet}),
|
||||
-- critical BOOLEAN DEFAULT FALSE,
|
||||
-- extnValue OCTET STRING
|
||||
extnId OBJECT IDENTIFIER,
|
||||
critical BOOLEAN DEFAULT FALSE,
|
||||
extnValue Any
|
||||
-- contains a DER encoding of a value of type &ExtnType
|
||||
-- for the extension object identified by extnId
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ static int hf_x509af_critical = -1; /* BOOLEAN */
|
|||
/* Initialize the subtree pointers */
|
||||
#include "packet-x509af-ett.c"
|
||||
|
||||
static char algorithm_id[64]; /*64 chars should be long enough? */
|
||||
|
||||
|
||||
static char extension_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
|
@ -96,38 +98,6 @@ dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, p
|
|||
return offset;
|
||||
}
|
||||
|
||||
static char algorithm_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_x509af_algorithm_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_x509af_algorithm_id, algorithm_id);
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_hf_x509af_algorithm_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(algorithm_id, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/* Algorithm Identifier can not yet be handled by the compiler */
|
||||
static const ber_sequence AlgorithmIdentifier_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_x509af_algorithm_id },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_hf_x509af_algorithm_type },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
AlgorithmIdentifier_sequence, hf_index, ett_x509af_AlgorithmIdentifier);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
#include "packet-x509af-fn.c"
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#ifndef PACKET_X509AF_H
|
||||
#define PACKET_X509AF_H
|
||||
|
||||
int dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
#include "packet-x509af-exp.h"
|
||||
|
||||
#endif /* PACKET_X509AF_H */
|
||||
|
|
|
@ -11,9 +11,10 @@ SelectedAttributeTypes x509sat
|
|||
#.INCLUDE ../x509ce/x509ce_exp.cnf
|
||||
#.INCLUDE ../x509if/x509if_exp.cnf
|
||||
#.INCLUDE ../x509sat/x509sat_exp.cnf
|
||||
#.INCLUDE ./x509af_dummy.cnf
|
||||
|
||||
#.EXPORTS
|
||||
|
||||
AlgorithmIdentifier
|
||||
AttributeCertificate
|
||||
AttributeCertificateAssertion
|
||||
AttributeCertificationPath
|
||||
|
@ -37,7 +38,6 @@ CertificateList B "2.5.4.59" "id-at-attributeCertificateRevocationList"
|
|||
|
||||
#.NO_EMIT
|
||||
|
||||
AlgorithmIdentifier
|
||||
Extension
|
||||
|
||||
#.TYPE_RENAME
|
||||
|
@ -57,4 +57,10 @@ IssuerSerial/issuer issuerName
|
|||
CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate revokedUserCertificate
|
||||
#.END
|
||||
|
||||
#.FN_BODY AlgorithmIdentifier/algorithmId
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_x509af_algorithm_id, algorithm_id);
|
||||
|
||||
#.FN_BODY AlgorithmIdentifier/parameters
|
||||
offset=call_ber_oid_callback(algorithm_id, tvb, offset, pinfo, tree);
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# this dummy is to handle Any type until compiler knows
|
||||
# about ANY
|
||||
|
||||
#.IMPORT_TAG
|
||||
Any BER_CLASS_ANY 0
|
|
@ -8,7 +8,7 @@
|
|||
/* packet-x509af.c
|
||||
* Routines for X.509 Authentication Framework packet dissection
|
||||
*
|
||||
* $Id: packet-x509af-template.c 12245 2004-10-08 20:28:04Z guy $
|
||||
* $Id: packet-x509af-template.c 12392 2004-10-26 13:04:09Z sahlberg $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -75,6 +75,8 @@ static int hf_x509af_subjectUniqueIdentifier = -1; /* UniqueIdentifier */
|
|||
static int hf_x509af_extensions = -1; /* Extensions */
|
||||
static int hf_x509af_algorithmIdentifier = -1; /* AlgorithmIdentifier */
|
||||
static int hf_x509af_encrypted = -1; /* BIT_STRING */
|
||||
static int hf_x509af_algorithmId = -1; /* T_algorithmId */
|
||||
static int hf_x509af_parameters = -1; /* T_parameters */
|
||||
static int hf_x509af_notBefore = -1; /* Time */
|
||||
static int hf_x509af_notAfter = -1; /* Time */
|
||||
static int hf_x509af_algorithm = -1; /* AlgorithmIdentifier */
|
||||
|
@ -164,6 +166,8 @@ static gint ett_x509af_SET_OF_AttributeType = -1;
|
|||
/*--- End of included file: packet-x509af-ett.c ---*/
|
||||
|
||||
|
||||
static char algorithm_id[64]; /*64 chars should be long enough? */
|
||||
|
||||
|
||||
static char extension_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
|
@ -207,38 +211,6 @@ dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, p
|
|||
return offset;
|
||||
}
|
||||
|
||||
static char algorithm_id[64]; /*64 chars should be long enough? */
|
||||
static int
|
||||
dissect_hf_x509af_algorithm_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_x509af_algorithm_id, algorithm_id);
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_hf_x509af_algorithm_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
|
||||
{
|
||||
offset=call_ber_oid_callback(algorithm_id, tvb, offset, pinfo, tree);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/* Algorithm Identifier can not yet be handled by the compiler */
|
||||
static const ber_sequence AlgorithmIdentifier_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_x509af_algorithm_id },
|
||||
{ BER_CLASS_ANY, 0, 0, dissect_hf_x509af_algorithm_type },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
AlgorithmIdentifier_sequence, hf_index, ett_x509af_AlgorithmIdentifier);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/*--- Included file: packet-x509af-fn.c ---*/
|
||||
|
||||
|
@ -318,6 +290,44 @@ static int dissect_serial(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, i
|
|||
return dissect_x509af_CertificateSerialNumber(FALSE, tvb, offset, pinfo, tree, hf_x509af_serial);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_x509af_T_algorithmId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
|
||||
hf_x509af_algorithm_id, algorithm_id);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_algorithmId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_x509af_T_algorithmId(FALSE, tvb, offset, pinfo, tree, hf_x509af_algorithmId);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dissect_x509af_T_parameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset=call_ber_oid_callback(algorithm_id, tvb, offset, pinfo, tree);
|
||||
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_parameters(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_x509af_T_parameters(FALSE, tvb, offset, pinfo, tree, hf_x509af_parameters);
|
||||
}
|
||||
|
||||
static const ber_sequence AlgorithmIdentifier_sequence[] = {
|
||||
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_algorithmId },
|
||||
{ BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_parameters },
|
||||
{ 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
|
||||
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
|
||||
AlgorithmIdentifier_sequence, hf_index, ett_x509af_AlgorithmIdentifier);
|
||||
|
||||
return offset;
|
||||
}
|
||||
static int dissect_signature(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
|
||||
return dissect_x509af_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_x509af_signature);
|
||||
}
|
||||
|
@ -1012,6 +1022,14 @@ void proto_register_x509af(void) {
|
|||
{ "encrypted", "x509af.encrypted",
|
||||
FT_BYTES, BASE_HEX, NULL, 0,
|
||||
"", HFILL }},
|
||||
{ &hf_x509af_algorithmId,
|
||||
{ "algorithmId", "x509af.algorithmId",
|
||||
FT_STRING, BASE_NONE, NULL, 0,
|
||||
"AlgorithmIdentifier/algorithmId", HFILL }},
|
||||
{ &hf_x509af_parameters,
|
||||
{ "parameters", "x509af.parameters",
|
||||
FT_NONE, BASE_NONE, NULL, 0,
|
||||
"AlgorithmIdentifier/parameters", HFILL }},
|
||||
{ &hf_x509af_notBefore,
|
||||
{ "notBefore", "x509af.notBefore",
|
||||
FT_UINT32, BASE_DEC, VALS(Time_vals), 0,
|
||||
|
@ -1257,13 +1275,20 @@ void proto_register_x509af(void) {
|
|||
|
||||
/*--- proto_reg_handoff_x509af -------------------------------------------*/
|
||||
void proto_reg_handoff_x509af(void) {
|
||||
register_ber_oid_dissector("2.5.4.36", dissect_Certificate_PDU, proto_x509af, "id-at-userCertificate");
|
||||
register_ber_oid_dissector("2.5.4.37", dissect_Certificate_PDU, proto_x509af, "id-at-cAcertificate");
|
||||
register_ber_oid_dissector("2.5.4.38", dissect_CertificateList_PDU, proto_x509af, "id-at-authorityRevocationList");
|
||||
register_ber_oid_dissector("2.5.4.39", dissect_CertificateList_PDU, proto_x509af, "id-at-certificateRevocationList");
|
||||
register_ber_oid_dissector("2.5.4.40", dissect_CertificatePair_PDU, proto_x509af, "id-at-crossCertificatePair");
|
||||
register_ber_oid_dissector("2.5.4.58", dissect_AttributeCertificate_PDU, proto_x509af, "id-at-attributeCertificate");
|
||||
register_ber_oid_dissector("2.5.4.59", dissect_CertificateList_PDU, proto_x509af, "id-at-attributeCertificateRevocationList");
|
||||
|
||||
/*--- Included file: packet-x509af-dis-tab.c ---*/
|
||||
|
||||
register_ber_oid_dissector("2.5.4.36", dissect_Certificate_PDU, proto_x509af, "id-at-userCertificate");
|
||||
register_ber_oid_dissector("2.5.4.37", dissect_Certificate_PDU, proto_x509af, "id-at-cAcertificate");
|
||||
register_ber_oid_dissector("2.5.4.38", dissect_CertificateList_PDU, proto_x509af, "id-at-authorityRevocationList");
|
||||
register_ber_oid_dissector("2.5.4.39", dissect_CertificateList_PDU, proto_x509af, "id-at-certificateRevocationList");
|
||||
register_ber_oid_dissector("2.5.4.40", dissect_CertificatePair_PDU, proto_x509af, "id-at-crossCertificatePair");
|
||||
register_ber_oid_dissector("2.5.4.58", dissect_AttributeCertificate_PDU, proto_x509af, "id-at-attributeCertificate");
|
||||
register_ber_oid_dissector("2.5.4.59", dissect_CertificateList_PDU, proto_x509af, "id-at-attributeCertificateRevocationList");
|
||||
|
||||
|
||||
/*--- End of included file: packet-x509af-dis-tab.c ---*/
|
||||
|
||||
|
||||
/*XXX these should really go to a better place but since that
|
||||
I have not that ITU standard, ill put it here for the time
|
||||
|
|
|
@ -32,13 +32,12 @@
|
|||
#ifndef PACKET_X509AF_H
|
||||
#define PACKET_X509AF_H
|
||||
|
||||
int dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index);
|
||||
|
||||
|
||||
/*--- Included file: packet-x509af-exp.h ---*/
|
||||
|
||||
int dissect_x509af_Certificate(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_x509af_CertificateSerialNumber(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_x509af_SubjectPublicKeyInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_x509af_Certificates(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
int dissect_x509af_CertificationPath(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index);
|
||||
|
|
Loading…
Reference in New Issue