Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_util.h>
#include <rz_cons.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
Functions | |
RZ_API void | asn1_setformat (int fmt) |
static ut32 | asn1_ber_indefinite (const ut8 *buffer, ut32 length) |
static RASN1Object * | asn1_parse_header (const ut8 *buffer, ut32 length, const ut8 *start_pointer) |
static ut32 | rz_asn1_count_objects (const ut8 *buffer, ut32 length) |
RZ_API RASN1Object * | rz_asn1_create_object (const ut8 *buffer, ut32 length, const ut8 *start_pointer) |
RZ_API RASN1Binary * | rz_asn1_create_binary (const ut8 *buffer, ut32 length) |
RZ_API void | rz_asn1_print_hex (RASN1Object *object, char *buffer, ut32 size, ut32 depth) |
static void | rz_asn1_print_padded (RzStrBuf *sb, RASN1Object *object, int depth, const char *k, const char *v) |
static RASN1String * | rz_asn1_print_hexdump_padded (RASN1Object *object, ut32 depth) |
RZ_API char * | rz_asn1_to_string (RASN1Object *object, ut32 depth, RzStrBuf *sb) |
RZ_API void | rz_asn1_free_object (RASN1Object *object) |
RZ_API void | rz_asn1_free_binary (RASN1Binary *bin) |
Variables | |
static int | ASN1_STD_FORMAT = 1 |
Definition at line 16 of file asn1.c.
References ASN1_FORM, test_evm::end, FORM_CONSTRUCTED, and length.
Referenced by asn1_parse_header().
|
static |
Definition at line 39 of file asn1.c.
References asn1_ber_indefinite(), ASN1_CLASS, ASN1_FORM, ASN1_LENLONG, ASN1_LENSHORT, ASN1_TAG, free(), test-lz4-versions::head, rz_asn1_object_t::length, length, NULL, buffer::offset, RZ_NEW0, rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_BITSTRING, and ut64().
Referenced by rz_asn1_count_objects(), and rz_asn1_create_object().
Definition at line 12 of file asn1.c.
References ASN1_STD_FORMAT.
Referenced by cmd_print_fromage().
Definition at line 97 of file asn1.c.
References asn1_parse_header(), counter, test_evm::end, length, NULL, RZ_FREE, and rz_asn1_object_t::sector.
Referenced by rz_asn1_create_object().
RZ_API RASN1Binary* rz_asn1_create_binary | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 152 of file asn1.c.
References calloc(), free(), length, memcpy(), NULL, and RZ_NEW0.
Referenced by rz_pkcs7_parse_attribute(), rz_pkcs7_parse_contentinfo(), rz_pkcs7_parse_issuerandserialnumber(), rz_pkcs7_parse_signerinfo(), rz_pkcs7_parse_spcdata(), rz_pkcs7_parse_spcmessagedigest(), rz_x509_parse_certificate(), rz_x509_parse_crlentry(), rz_x509_parse_extension(), rz_x509_parse_subjectpublickeyinfo(), and rz_x509_parse_tbscertificate().
RZ_API RASN1Object* rz_asn1_create_object | ( | const ut8 * | buffer, |
ut32 | length, | ||
const ut8 * | start_pointer | ||
) |
Definition at line 120 of file asn1.c.
References asn1_parse_header(), count, test_evm::end, rz_asn1_object_t::form, FORM_CONSTRUCTED, free(), i, rz_asn1_object_t::length, length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_count_objects(), rz_asn1_create_object(), rz_asn1_free_object(), RZ_NEWS0, rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_BITSTRING, and TAG_OCTETSTRING.
Referenced by cmd_print_fromage(), rz_asn1_create_object(), rz_pkcs7_parse_cms(), rz_pkcs7_parse_spcinfo(), and rz_x509_parse_certificate2().
RZ_API void rz_asn1_free_binary | ( | RASN1Binary * | bin | ) |
Definition at line 463 of file asn1.c.
References free().
Referenced by rz_pkcs7_free_attribute(), rz_pkcs7_free_contentinfo(), rz_pkcs7_free_issuerandserialnumber(), rz_pkcs7_free_signerinfo(), rz_pkcs7_free_spcdata(), rz_pkcs7_free_spcmessagedigest(), rz_x509_free_certificate(), rz_x509_free_crlentry(), rz_x509_free_extension(), rz_x509_free_subjectpublickeyinfo(), and rz_x509_free_tbscertificate().
RZ_API void rz_asn1_free_object | ( | RASN1Object * | object | ) |
Definition at line 445 of file asn1.c.
References free(), i, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_free_object(), and RZ_FREE.
Referenced by cmd_print_fromage(), rz_asn1_create_object(), rz_asn1_free_object(), rz_pkcs7_parse_cms(), rz_pkcs7_parse_spcinfo(), and rz_x509_parse_certificate().
RZ_API void rz_asn1_print_hex | ( | RASN1Object * | object, |
char * | buffer, | ||
ut32 | size, | ||
ut32 | depth | ||
) |
Definition at line 171 of file asn1.c.
References ASN1_STD_FORMAT, test_evm::end, i, p, pad(), rz_str_pad(), rz_asn1_object_t::sector, and snprintf.
Referenced by rz_asn1_to_string().
|
static |
Definition at line 219 of file asn1.c.
References ASN1_STD_FORMAT, c, free(), i, IS_PRINTABLE, rz_asn1_object_t::length, memset(), NULL, pad(), rz_asn1_create_string(), rz_str_pad(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), sb, rz_asn1_object_t::sector, and create_tags_rz::text.
Referenced by rz_asn1_to_string().
|
static |
Definition at line 194 of file asn1.c.
References rz_asn1_object_t::form, k, pad(), rz_str_pad(), rz_str_trim_head_ro(), rz_strbuf_appendf(), sb, rz_asn1_object_t::tag, TAG_BITSTRING, TAG_EOC, TAG_INTEGER, TAG_NULL, TAG_REAL, and v.
Referenced by rz_asn1_to_string().
RZ_API char* rz_asn1_to_string | ( | RASN1Object * | object, |
ut32 | depth, | ||
RzStrBuf * | sb | ||
) |
Definition at line 259 of file asn1.c.
References ASN1_STD_FORMAT, CLASS_APPLICATION, CLASS_CONTEXT, CLASS_PRIVATE, CLASS_UNIVERSAL, rz_asn1_object_t::form, i, rz_asn1_object_t::klass, rz_asn1_object_t::length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_object_t::offset, PFMT64d, root, rz_asn1_free_string(), rz_asn1_print_hex(), rz_asn1_print_hexdump_padded(), rz_asn1_print_padded(), rz_asn1_stringify_oid(), rz_asn1_stringify_string(), rz_asn1_stringify_time(), rz_asn1_stringify_utctime(), rz_asn1_to_string(), rz_str_is_printable_limited(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), sb, rz_asn1_object_t::sector, snprintf, rz_asn1_string_t::string, rz_asn1_object_t::tag, TAG_BITSTRING, TAG_BMPSTRING, TAG_BOOLEAN, TAG_EMBEDDED_PDV, TAG_ENUMERATED, TAG_EOC, TAG_EXTERNAL, TAG_GENERALIZEDTIME, TAG_GENERALSTRING, TAG_GRAPHICSTRING, TAG_IA5STRING, TAG_INTEGER, TAG_NULL, TAG_NUMERICSTRING, TAG_OBJDESCRIPTOR, TAG_OCTETSTRING, TAG_OID, TAG_PRINTABLESTRING, TAG_REAL, TAG_SEQUENCE, TAG_SET, TAG_T61STRING, TAG_UNIVERSALSTRING, TAG_UTCTIME, TAG_UTF8STRING, TAG_VIDEOTEXSTRING, and TAG_VISIBLESTRING.
Referenced by cmd_print_fromage(), and rz_asn1_to_string().
|
static |
Definition at line 10 of file asn1.c.
Referenced by asn1_setformat(), rz_asn1_print_hex(), rz_asn1_print_hexdump_padded(), and rz_asn1_to_string().