#include <int.h>
#include "parser_aux.h"
#include <gstr.h>
#include "element.h"
#include <structure.h>
Go to the source code of this file.
Defines | |
#define | MAX_TAG_LEN 16 |
Functions | |
static void | MHD__asn1_error_description_value_not_found (node_asn *node, char *ErrorDescription) |
void | MHD__asn1_length_der (unsigned long int len, unsigned char *ans, int *ans_len) |
static void | MHD__asn1_tag_der (unsigned char class, unsigned int tag_value, unsigned char *ans, int *ans_len) |
void | MHD__asn1_octet_der (const unsigned char *str, int str_len, unsigned char *der, int *der_len) |
static MHD__asn1_retCode | MHD__asn1_time_der (unsigned char *str, unsigned char *der, int *der_len) |
static MHD__asn1_retCode | MHD__asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len) |
void | MHD__asn1_bit_der (const unsigned char *str, int bit_len, unsigned char *der, int *der_len) |
static MHD__asn1_retCode | MHD__asn1_complete_explicit_tag (node_asn *node, unsigned char *der, int *counter, int *max_len) |
static MHD__asn1_retCode | MHD__asn1_insert_tag_der (node_asn *node, unsigned char *der, int *counter, int *max_len) |
static void | MHD__asn1_ordering_set (unsigned char *der, int der_len, node_asn *node) |
static void | MHD__asn1_ordering_set_of (unsigned char *der, int der_len, node_asn *node) |
: the name of the structure you want to encode (it must be | |
MHD__asn1_der_coding - Creates the DER encoding for the NAME structure : pointer to an ASN1 element inside *POINTER). : vector that will contain the DER encoding. DER must be a pointer to memory cells already allocated. : number of bytes of *: [0]..[len-1], Initialy holds the sizeof of der vector. : return the error description or an empty string if success. Creates the DER encoding for the NAME structure (inside *POINTER structure). Returns: ASN1_SUCCESS: DER encoding OK. ASN1_ELEMENT_NOT_FOUND: NAME is not a valid element. ASN1_VALUE_NOT_FOUND: There is an element without a value. ASN1_MEM_ERROR: vector isn't big enough. Also in this case LEN will contain the length needed. | |
MHD__asn1_retCode | MHD__asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len, char *ErrorDescription) |
Variables | |
const char | MHD_bit_mask [] |
#define MAX_TAG_LEN 16 |
Definition at line 36 of file coding.c.
Referenced by MHD__asn1_insert_tag_der().
void MHD__asn1_bit_der | ( | const unsigned char * | str, | |
int | bit_len, | |||
unsigned char * | der, | |||
int * | der_len | |||
) |
MHD__asn1_bit_der: : BIT string. : number of meaningful bits in STR. : string returned. : number of meaningful bytes of DER (der[0]..der[ans_len-1]).
Creates the DER coding for a BIT STRING type (length and pad included).
Definition at line 303 of file coding.c.
References MHD__asn1_length_der(), and MHD_bit_mask.
Referenced by MHD__asn1_write_value().
static MHD__asn1_retCode MHD__asn1_complete_explicit_tag | ( | node_asn * | node, | |
unsigned char * | der, | |||
int * | counter, | |||
int * | max_len | |||
) | [static] |
Definition at line 339 of file coding.c.
References ASN1_MEM_ERROR, ASN1_SUCCESS, CONST_EXPLICIT, CONST_TAG, node_asn_struct::down, node_asn_struct::left, MHD__asn1_length_der(), MHD__asn1_set_name(), node_asn_struct::name, node_asn_struct::right, SIZEOF_UNSIGNED_INT, node_asn_struct::type, type_field, and TYPE_TAG.
Referenced by MHD__asn1_der_coding().
MHD__asn1_retCode MHD__asn1_der_coding | ( | ASN1_TYPE | element, | |
const char * | name, | |||
void * | ider, | |||
int * | len, | |||
char * | ErrorDescription | |||
) |
Definition at line 849 of file coding.c.
References ASN1_DER_ERROR, ASN1_ELEMENT_NOT_FOUND, ASN1_MEM_ERROR, ASN1_SUCCESS, ASN1_VALUE_NOT_FOUND, CONST_DEFAULT, node_asn_struct::down, DOWN, MHD__asn1_complete_explicit_tag(), MHD__asn1_copy_structure3(), MHD__asn1_delete_structure(), MHD__asn1_error_description_value_not_found(), MHD__asn1_find_node(), MHD__asn1_find_up(), MHD__asn1_get_length_der(), MHD__asn1_insert_tag_der(), MHD__asn1_length_der(), MHD__asn1_ltostr(), MHD__asn1_objectid_der(), MHD__asn1_ordering_set(), MHD__asn1_ordering_set_of(), MHD__asn1_set_value(), MHD__asn1_time_der(), node_asn_struct::right, RIGHT, SIZEOF_UNSIGNED_LONG_INT, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_SIZE, TYPE_TAG, TYPE_TIME, UP, node_asn_struct::value, and node_asn_struct::value_len.
Referenced by MHD__gnutls_x509_der_encode(), and MHD__gnutls_x509_export_int().
static void MHD__asn1_error_description_value_not_found | ( | node_asn * | node, | |
char * | ErrorDescription | |||
) | [static] |
Definition at line 48 of file coding.c.
References Estrcat, Estrcpy, MAX_ERROR_DESCRIPTION_SIZE, and MHD__asn1_hierarchical_name().
Referenced by MHD__asn1_der_coding().
static MHD__asn1_retCode MHD__asn1_insert_tag_der | ( | node_asn * | node, | |
unsigned char * | der, | |||
int * | counter, | |||
int * | max_len | |||
) | [static] |
Definition at line 412 of file coding.c.
References ASN1_CLASS_APPLICATION, ASN1_CLASS_CONTEXT_SPECIFIC, ASN1_CLASS_PRIVATE, ASN1_CLASS_STRUCTURED, ASN1_CLASS_UNIVERSAL, ASN1_GENERIC_ERROR, ASN1_MEM_ERROR, ASN1_SUCCESS, ASN1_TAG_BIT_STRING, ASN1_TAG_BOOLEAN, ASN1_TAG_ENUMERATED, ASN1_TAG_GENERALIZEDTime, ASN1_TAG_GENERALSTRING, ASN1_TAG_INTEGER, ASN1_TAG_NULL, ASN1_TAG_OBJECT_ID, ASN1_TAG_OCTET_STRING, ASN1_TAG_SEQUENCE, ASN1_TAG_SET, ASN1_TAG_UTCTime, CONST_APPLICATION, CONST_EXPLICIT, CONST_PRIVATE, CONST_TAG, CONST_UNIVERSAL, CONST_UTC, node_asn_struct::down, MAX_TAG_LEN, MHD__asn1_ltostr(), MHD__asn1_set_name(), MHD__asn1_tag_der(), node_asn_struct::right, SIZEOF_UNSIGNED_INT, node_asn_struct::type, TYPE_ANY, TYPE_BIT_STRING, TYPE_BOOLEAN, TYPE_CHOICE, TYPE_ENUMERATED, type_field, TYPE_GENERALSTRING, TYPE_INTEGER, TYPE_NULL, TYPE_OBJECT_ID, TYPE_OCTET_STRING, TYPE_SEQUENCE, TYPE_SEQUENCE_OF, TYPE_SET, TYPE_SET_OF, TYPE_TAG, TYPE_TIME, and node_asn_struct::value.
Referenced by MHD__asn1_der_coding().
void MHD__asn1_length_der | ( | unsigned long int | len, | |
unsigned char * | ans, | |||
int * | ans_len | |||
) |
MHD__asn1_length_der: : value to convert. : string returned. : number of meaningful bytes of ANS (ans[0]..ans[ans_len-1]).
Creates the DER coding for the LEN parameter (only the length). The buffer is pre-allocated and must have room for the output.
Definition at line 73 of file coding.c.
References SIZEOF_UNSIGNED_LONG_INT.
Referenced by MHD__asn1_bit_der(), MHD__asn1_complete_explicit_tag(), MHD__asn1_der_coding(), MHD__asn1_der_decoding(), MHD__asn1_get_octet_string(), MHD__asn1_objectid_der(), MHD__asn1_octet_der(), MHD__asn1_time_der(), and MHD__asn1_write_value().
static MHD__asn1_retCode MHD__asn1_objectid_der | ( | unsigned char * | str, | |
unsigned char * | der, | |||
int * | der_len | |||
) | [static] |
Definition at line 218 of file coding.c.
References ASN1_MEM_ALLOC_ERROR, ASN1_MEM_ERROR, ASN1_SUCCESS, MHD__asn1_afree, MHD__asn1_alloca, and MHD__asn1_length_der().
Referenced by MHD__asn1_der_coding().
void MHD__asn1_octet_der | ( | const unsigned char * | str, | |
int | str_len, | |||
unsigned char * | der, | |||
int * | der_len | |||
) |
MHD__asn1_octet_der: : OCTET string. : STR length (str[0]..str[str_len-1]). : string returned. : number of meaningful bytes of DER (der[0]..der[ans_len-1]).
Creates the DER coding for an OCTET type (length included).
Definition at line 156 of file coding.c.
References MHD__asn1_length_der().
Referenced by MHD__asn1_change_integer_value(), MHD__asn1_der_decoding(), and MHD__asn1_write_value().
static void MHD__asn1_ordering_set | ( | unsigned char * | der, | |
int | der_len, | |||
node_asn * | node | |||
) | [static] |
Definition at line 578 of file coding.c.
References ASN1_SUCCESS, node_asn_struct::down, MHD__asn1_afree, MHD__asn1_alloca, MHD__asn1_get_length_der(), MHD__asn1_get_tag_der(), node_asn_struct::right, node_asn_struct::type, type_field, TYPE_SET, TYPE_SIZE, and TYPE_TAG.
Referenced by MHD__asn1_der_coding().
static void MHD__asn1_ordering_set_of | ( | unsigned char * | der, | |
int | der_len, | |||
node_asn * | node | |||
) | [static] |
Definition at line 695 of file coding.c.
References ASN1_SUCCESS, node_asn_struct::down, MHD__asn1_afree, MHD__asn1_alloca, MHD__asn1_get_length_der(), MHD__asn1_get_tag_der(), node_asn_struct::right, node_asn_struct::type, type_field, TYPE_SET_OF, TYPE_SIZE, and TYPE_TAG.
Referenced by MHD__asn1_der_coding().
static void MHD__asn1_tag_der | ( | unsigned char | class, | |
unsigned int | tag_value, | |||
unsigned char * | ans, | |||
int * | ans_len | |||
) | [static] |
Definition at line 117 of file coding.c.
References SIZEOF_UNSIGNED_INT.
Referenced by MHD__asn1_insert_tag_der().
static MHD__asn1_retCode MHD__asn1_time_der | ( | unsigned char * | str, | |
unsigned char * | der, | |||
int * | der_len | |||
) | [static] |
Definition at line 183 of file coding.c.
References ASN1_MEM_ERROR, ASN1_SUCCESS, and MHD__asn1_length_der().
Referenced by MHD__asn1_der_coding().
const char MHD_bit_mask[] |
{ 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80 }
Definition at line 288 of file coding.c.
Referenced by MHD__asn1_bit_der().