Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Display certificate as UINT64 and add support for a 64bits unsigned value in BER dissector

svn path=/trunk/; revision=50096
  • Loading branch information
pquantin committed Jun 20, 2013
1 parent 1b69a2b commit de10bc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions asn1/ocsp/ocsp.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions epan/dissectors/packet-ber.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions epan/dissectors/packet-ocsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit de10bc6

Please sign in to comment.