Display certificate as UINT64 and add support for a 64bits unsigned value in BER dissector

svn path=/trunk/; revision=50096
This commit is contained in:
Pascal Quantin 2013-06-20 23:37:16 +00:00
parent 1b69a2b3c8
commit de10bc6b5e
3 changed files with 12 additions and 5 deletions

View File

@ -3,6 +3,11 @@
# $Id$
#.TYPE_ATTR
# pkix1explicit also exports the type CertificateSerialNumber. This makes sure asn2wrs uses the locally defined version.
CertificateSerialNumber TYPE = FT_UINT64 DISPLAY = BASE_DEC STRINGS = NULL BITMASK = 0
#.END
#.MODULE_IMPORT
PKIX1Implicit88 pkix1implicit
PKIX1Explicit88 pkix1explicit

View File

@ -1664,6 +1664,7 @@ dissect_ber_integer64(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree,
gint64 val;
guint32 i;
gboolean used_too_many_bytes = FALSE;
guint8 first;
#ifdef DEBUG_BER
{
const char *name;
@ -1695,8 +1696,10 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im
len = remaining>0 ? remaining : 0;
}
first = tvb_get_guint8(tvb, offset);
/* we can't handle integers > 64 bits */
if (len > 8) {
/* take into account the use case of a 64bits unsigned integer: you will have a 9th byte set to 0 */
if ((len > 9) || ((len == 9) && (first != 0))) {
header_field_info *hfinfo;
proto_item *pi = NULL;
@ -1718,7 +1721,6 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im
val=0;
if (len > 0) {
/* extend sign bit for signed fields */
guint8 first = tvb_get_guint8(tvb, offset);
enum ftenum type = FT_INT32; /* Default to signed, is this correct? */
if (hf_id >= 0) {
type = proto_registrar_get_ftype(hf_id);
@ -1743,7 +1745,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n", name, im
if (hf_id >= 0) {
/* */
if ((len < 1) || (len > 8)) {
if ((len < 1) || (len > 9) || ((len == 9) && (first != 0))) {
proto_item *pi = proto_tree_add_string_format(
tree, hf_ber_error, tvb, offset-len, len, "invalid length",
"BER Error: Can't handle integer length: %u",

View File

@ -319,7 +319,7 @@ dissect_ocsp_T_responseType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_ocsp_T_response(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 38 "../../asn1/ocsp/ocsp.cnf"
#line 43 "../../asn1/ocsp/ocsp.cnf"
gint8 appclass;
gboolean pc, ind;
gint32 tag;
@ -794,7 +794,7 @@ void proto_register_ocsp(void) {
"OCTET_STRING", HFILL }},
{ &hf_ocsp_serialNumber,
{ "serialNumber", "ocsp.serialNumber",
FT_INT32, BASE_DEC, NULL, 0,
FT_UINT64, BASE_DEC, NULL, 0,
"CertificateSerialNumber", HFILL }},
{ &hf_ocsp_responseStatus,
{ "responseStatus", "ocsp.responseStatus",