Commit much improved ASN.1 compiler from joda-choice-branch.
Highlighs for the compiler is support for CHOICE and in general better support for tags. This compiler support most of what is needed for PK-INIT, LDAP, X.509, PKCS-12 and many other protocols. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15617 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -6,6 +6,12 @@
|
||||
#ifndef __asn1_common_definitions__
|
||||
#define __asn1_common_definitions__
|
||||
|
||||
typedef struct heim_integer {
|
||||
size_t length;
|
||||
void *data;
|
||||
int negative;
|
||||
} heim_integer;
|
||||
|
||||
typedef struct heim_octet_string {
|
||||
size_t length;
|
||||
void *data;
|
||||
@@ -13,10 +19,44 @@ typedef struct heim_octet_string {
|
||||
|
||||
typedef char *heim_general_string;
|
||||
typedef char *heim_utf8_string;
|
||||
typedef char *heim_printable_string;
|
||||
typedef char *heim_ia5_string;
|
||||
|
||||
typedef struct heim_bmp_string {
|
||||
size_t length;
|
||||
uint16_t *data;
|
||||
} heim_bmp_string;
|
||||
|
||||
typedef struct heim_universal_string {
|
||||
size_t length;
|
||||
uint32_t *data;
|
||||
} heim_universal_string;
|
||||
|
||||
|
||||
typedef struct heim_oid {
|
||||
size_t length;
|
||||
unsigned *components;
|
||||
} heim_oid;
|
||||
|
||||
typedef struct heim_bit_string {
|
||||
size_t length;
|
||||
void *data;
|
||||
} heim_bit_string;
|
||||
|
||||
#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \
|
||||
do { \
|
||||
(BL) = length_##T((S)); \
|
||||
(B) = malloc((BL)); \
|
||||
if((B) == NULL) { \
|
||||
(R) = ENOMEM; \
|
||||
} else { \
|
||||
(R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \
|
||||
(S), (L)); \
|
||||
if((R) != 0) { \
|
||||
free((B)); \
|
||||
(B) = NULL; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user