1/* $Id$ */ 2 3#include <stddef.h> 4#include <time.h> 5#include <krb5-types.h> 6 7#ifndef __asn1_common_definitions__ 8#define __asn1_common_definitions__ 9 10#ifndef __HEIM_BASE_DATA__ 11#define __HEIM_BASE_DATA__ 1 12struct heim_base_data { 13 size_t length; 14 void *data; 15}; 16#endif 17 18typedef struct heim_integer { 19 size_t length; 20 void *data; 21 int negative; 22} heim_integer; 23 24typedef struct heim_base_data heim_octet_string; 25 26typedef char *heim_general_string; 27typedef char *heim_utf8_string; 28typedef struct heim_base_data heim_printable_string; 29typedef struct heim_base_data heim_ia5_string; 30 31typedef struct heim_bmp_string { 32 size_t length; 33 uint16_t *data; 34} heim_bmp_string; 35 36typedef struct heim_universal_string { 37 size_t length; 38 uint32_t *data; 39} heim_universal_string; 40 41typedef char *heim_visible_string; 42 43typedef struct heim_oid { 44 size_t length; 45 unsigned *components; 46} heim_oid; 47 48typedef struct heim_bit_string { 49 size_t length; 50 void *data; 51} heim_bit_string; 52 53typedef struct heim_base_data heim_any; 54typedef struct heim_base_data heim_any_set; 55 56#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ 57 do { \ 58 (BL) = length_##T((S)); \ 59 (B) = malloc((BL)); \ 60 if((B) == NULL) { \ 61 (R) = ENOMEM; \ 62 } else { \ 63 (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ 64 (S), (L)); \ 65 if((R) != 0) { \ 66 free((B)); \ 67 (B) = NULL; \ 68 } \ 69 } \ 70 } while (0) 71 72#ifdef _WIN32 73#ifndef ASN1_LIB 74#define ASN1EXP __declspec(dllimport) 75#else 76#define ASN1EXP 77#endif 78#define ASN1CALL __stdcall 79#else 80#define ASN1EXP 81#define ASN1CALL 82#endif 83 84#endif 85