libksba
1.6.0
About: KSBA is a library to make the tasks of working with X.509 certificates, CMS data and related objects more easy.
![]() ![]() |
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "util.h"
#include "asn1-func.h"
#include "convert.h"
#include "ber-help.h"
Go to the source code of this file.
Functions | |
static int | read_byte (ksba_reader_t reader) |
static int | premature_eof (struct tag_info *ti) |
static gpg_error_t | eof_or_error (ksba_reader_t reader, struct tag_info *ti, int premature) |
gpg_error_t | _ksba_ber_read_tl (ksba_reader_t reader, struct tag_info *ti) |
gpg_error_t | _ksba_ber_parse_tl (unsigned char const **buffer, size_t *size, struct tag_info *ti) |
gpg_error_t | _ksba_ber_write_tl (ksba_writer_t writer, unsigned long tag, enum tag_class class, int constructed, unsigned long length) |
size_t | _ksba_ber_encode_tl (unsigned char *buffer, unsigned long tag, enum tag_class class, int constructed, unsigned long length) |
size_t | _ksba_ber_count_tl (unsigned long tag, enum tag_class class, int constructed, unsigned long length) |
gpg_error_t | _ksba_parse_sequence (unsigned char const **buf, size_t *len, struct tag_info *ti) |
gpg_error_t | _ksba_parse_context_tag (unsigned char const **buf, size_t *len, struct tag_info *ti, int tag) |
gpg_error_t | _ksba_parse_enumerated (unsigned char const **buf, size_t *len, struct tag_info *ti, size_t maxlen) |
gpg_error_t | _ksba_parse_integer (unsigned char const **buf, size_t *len, struct tag_info *ti) |
gpg_error_t | _ksba_parse_octet_string (unsigned char const **buf, size_t *len, struct tag_info *ti) |
gpg_error_t | _ksba_parse_optional_boolean (unsigned char const **buf, size_t *len, int *r_bool) |
gpg_error_t | _ksba_parse_optional_null (unsigned char const **buf, size_t *len, int *r_seen) |
gpg_error_t | _ksba_parse_object_id_into_str (unsigned char const **buf, size_t *len, char **oid) |
gpg_error_t | _ksba_parse_asntime_into_isotime (unsigned char const **buf, size_t *len, ksba_isotime_t isotime) |
size_t _ksba_ber_count_tl | ( | unsigned long | tag, |
enum tag_class | class, | ||
int | constructed, | ||
unsigned long | length | ||
) |
Definition at line 434 of file ber-help.c.
References TYPE_NULL.
Referenced by _ksba_certreq_add_subject(), _ksba_certreq_set_sig_val(), add_general_names_to_extn(), and parse_rdn().
size_t _ksba_ber_encode_tl | ( | unsigned char * | buffer, |
unsigned long | tag, | ||
enum tag_class | class, | ||
int | constructed, | ||
unsigned long | length | ||
) |
Definition at line 376 of file ber-help.c.
References TYPE_NULL.
Referenced by _ksba_certreq_add_subject(), _ksba_certreq_set_sig_val(), and add_general_names_to_extn().
gpg_error_t _ksba_ber_parse_tl | ( | unsigned char const ** | buffer, |
size_t * | size, | ||
struct tag_info * | ti | ||
) |
Definition at line 200 of file ber-help.c.
References tag_info::buf, tag_info::class, CLASS_UNIVERSAL, DIM, tag_info::err_string, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::ndef, tag_info::nhdr, tag_info::non_der, premature_eof(), and tag_info::tag.
Referenced by _ksba_cert_get_auth_key_id(), _ksba_cert_get_cert_policies(), _ksba_cert_get_crl_dist_point(), _ksba_cert_get_ext_key_usages(), _ksba_cert_get_key_usage(), _ksba_cert_is_ca(), _ksba_cms_identify(), _ksba_crl_get_auth_key_id(), _ksba_name_new_from_der(), _ksba_parse_asntime_into_isotime(), _ksba_parse_context_tag(), _ksba_parse_enumerated(), _ksba_parse_integer(), _ksba_parse_object_id_into_str(), _ksba_parse_octet_string(), _ksba_parse_optional_boolean(), _ksba_parse_optional_null(), _ksba_parse_sequence(), get_info_access(), get_name(), get_simple_octet_string_ext(), parse_distribution_point(), parse_one_extension(), parse_response(), parse_response_data(), and parse_single_response().
gpg_error_t _ksba_ber_read_tl | ( | ksba_reader_t | reader, |
struct tag_info * | ti | ||
) |
Definition at line 93 of file ber-help.c.
References tag_info::buf, tag_info::class, CLASS_UNIVERSAL, DIM, eof_or_error(), tag_info::err_string, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::ndef, tag_info::nhdr, tag_info::non_der, read_byte(), and tag_info::tag.
Referenced by _ksba_cms_parse_enveloped_data_part_1(), _ksba_cms_parse_enveloped_data_part_2(), _ksba_cms_parse_signed_data_part_1(), _ksba_cms_parse_signed_data_part_2(), decoder_next(), parse_cms_version(), parse_content_info(), parse_crl_entry(), parse_crl_extensions(), parse_encrypted_content_info(), parse_signature(), parse_to_next_update(), read_and_hash_cont(), and read_encrypted_cont().
gpg_error_t _ksba_ber_write_tl | ( | ksba_writer_t | writer, |
unsigned long | tag, | ||
enum tag_class | class, | ||
int | constructed, | ||
unsigned long | length | ||
) |
Definition at line 316 of file ber-help.c.
References gpg_error, ksba_writer_write(), and TYPE_NULL.
Referenced by _ksba_der_write_algorithm_identifier(), _ksba_dn_from_str(), _ksba_ocsp_prepare_request(), _ksba_writer_write_octet_string(), build_cri(), build_enveloped_data_header(), build_extensions(), build_signed_data_attributes(), build_signed_data_header(), build_signed_data_rest(), ct_build_enveloped_data(), ct_build_signed_data(), parse_rdn(), write_encrypted_cont(), and write_request_extensions().
gpg_error_t _ksba_parse_asntime_into_isotime | ( | unsigned char const ** | buf, |
size_t * | len, | ||
ksba_isotime_t | isotime | ||
) |
Definition at line 693 of file ber-help.c.
References _ksba_asntime_to_iso(), _ksba_ber_parse_tl(), tag_info::buf, tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, parse_skip(), tag_info::tag, TYPE_GENERALIZED_TIME, and TYPE_UTC_TIME.
gpg_error_t _ksba_parse_context_tag | ( | unsigned char const ** | buf, |
size_t * | len, | ||
struct tag_info * | ti, | ||
int | tag | ||
) |
Definition at line 507 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::class, CLASS_CONTEXT, gpg_error, tag_info::is_constructed, tag_info::length, and tag_info::tag.
gpg_error_t _ksba_parse_enumerated | ( | unsigned char const ** | buf, |
size_t * | len, | ||
struct tag_info * | ti, | ||
size_t | maxlen | ||
) |
Definition at line 527 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::tag, and TYPE_ENUMERATED.
gpg_error_t _ksba_parse_integer | ( | unsigned char const ** | buf, |
size_t * | len, | ||
struct tag_info * | ti | ||
) |
Definition at line 550 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::tag, and TYPE_INTEGER.
gpg_error_t _ksba_parse_object_id_into_str | ( | unsigned char const ** | buf, |
size_t * | len, | ||
char ** | oid | ||
) |
Definition at line 664 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::buf, tag_info::class, CLASS_UNIVERSAL, gpg_error, gpg_error_from_syserror, tag_info::is_constructed, ksba_oid_to_str(), tag_info::length, oid, tag_info::tag, and TYPE_OBJECT_ID.
gpg_error_t _ksba_parse_octet_string | ( | unsigned char const ** | buf, |
size_t * | len, | ||
struct tag_info * | ti | ||
) |
Definition at line 571 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::tag, and TYPE_OCTET_STRING.
gpg_error_t _ksba_parse_optional_boolean | ( | unsigned char const ** | buf, |
size_t * | len, | ||
int * | r_bool | ||
) |
Definition at line 596 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::buf, tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::nhdr, parse_skip(), tag_info::tag, and TYPE_BOOLEAN.
gpg_error_t _ksba_parse_optional_null | ( | unsigned char const ** | buf, |
size_t * | len, | ||
int * | r_seen | ||
) |
Definition at line 630 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::buf, tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::nhdr, parse_skip(), tag_info::tag, and TYPE_NULL.
gpg_error_t _ksba_parse_sequence | ( | unsigned char const ** | buf, |
size_t * | len, | ||
struct tag_info * | ti | ||
) |
Definition at line 486 of file ber-help.c.
References _ksba_ber_parse_tl(), tag_info::class, CLASS_UNIVERSAL, gpg_error, tag_info::is_constructed, tag_info::length, tag_info::tag, and TYPE_SEQUENCE.
|
static |
Definition at line 71 of file ber-help.c.
References tag_info::err_string, gpg_error, ksba_reader_error(), and premature_eof().
Referenced by _ksba_ber_read_tl().
|
static |
Definition at line 61 of file ber-help.c.
References tag_info::err_string, and gpg_error.
Referenced by _ksba_ber_parse_tl(), and eof_or_error().
|
static |
Definition at line 47 of file ber-help.c.
References ksba_reader_read().
Referenced by _ksba_ber_read_tl().