From 736840cce776f05fb9402dad94ecf805fe1c7f02 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Thu, 15 Nov 2018 18:14:45 +0200 Subject: [PATCH] fix integer representation --- client/crypto/asn1dump.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/crypto/asn1dump.c b/client/crypto/asn1dump.c index 26d2ba737..60799fc8c 100644 --- a/client/crypto/asn1dump.c +++ b/client/crypto/asn1dump.c @@ -216,11 +216,19 @@ static void asn1_tag_dump_boolean(const struct tlv *tlv, const struct asn1_tag * static void asn1_tag_dump_integer(const struct tlv *tlv, const struct asn1_tag *tag, FILE *f, int level) { PRINT_INDENT(level); + if (tlv->len == 4) { + int32_t val = 0; + for (int i = 0; i < tlv->len; i++) + val = (val << 8) + tlv->value[i]; + fprintf(f, "\tvalue4b: %d\n", val); + return; + } fprintf(f, "\tvalue: %lu\n", asn1_value_integer(tlv, 0, tlv->len * 2)); } static char *asn1_oid_description(const char *oid, bool with_group_desc) { json_error_t error; + json_t *root = NULL; char fname[300] = {0}; static char res[300]; memset(res, 0x00, sizeof(res)); @@ -236,7 +244,7 @@ static char *asn1_oid_description(const char *oid, bool with_group_desc) { } // load `oids.json` - json_t *root = json_load_file(fname, 0, &error); + root = json_load_file(fname, 0, &error); if (!root || !json_is_object(root)) { goto error;