| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
from __future__ import absolute_import, division, print_function |
| 6 |
|
| 7 |
INCLUDES = """ |
| 8 |
#include <openssl/asn1.h> |
| 9 |
""" |
| 10 |
|
| 11 |
TYPES = """ |
| 12 |
typedef int... time_t; |
| 13 |
|
| 14 |
typedef ... ASN1_INTEGER; |
| 15 |
|
| 16 |
struct asn1_string_st { |
| 17 |
int length; |
| 18 |
int type; |
| 19 |
unsigned char *data; |
| 20 |
long flags; |
| 21 |
}; |
| 22 |
|
| 23 |
typedef struct asn1_string_st ASN1_OCTET_STRING; |
| 24 |
typedef struct asn1_string_st ASN1_IA5STRING; |
| 25 |
typedef struct asn1_string_st ASN1_BIT_STRING; |
| 26 |
typedef struct asn1_string_st ASN1_TIME; |
| 27 |
typedef ... ASN1_OBJECT; |
| 28 |
typedef struct asn1_string_st ASN1_STRING; |
| 29 |
typedef struct asn1_string_st ASN1_UTF8STRING; |
| 30 |
typedef ... ASN1_TYPE; |
| 31 |
typedef ... ASN1_GENERALIZEDTIME; |
| 32 |
typedef ... ASN1_ENUMERATED; |
| 33 |
typedef ... ASN1_ITEM; |
| 34 |
typedef ... ASN1_VALUE; |
| 35 |
|
| 36 |
typedef ... ASN1_ITEM_EXP; |
| 37 |
typedef ... ASN1_NULL; |
| 38 |
|
| 39 |
static const int V_ASN1_GENERALIZEDTIME; |
| 40 |
|
| 41 |
static const int MBSTRING_UTF8; |
| 42 |
""" |
| 43 |
|
| 44 |
FUNCTIONS = """ |
| 45 |
void ASN1_OBJECT_free(ASN1_OBJECT *); |
| 46 |
|
| 47 |
/* ASN1 STRING */ |
| 48 |
const unsigned char *ASN1_STRING_get0_data(ASN1_STRING *); |
| 49 |
int ASN1_STRING_set(ASN1_STRING *, const void *, int); |
| 50 |
|
| 51 |
/* ASN1 OCTET STRING */ |
| 52 |
ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void); |
| 53 |
void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *); |
| 54 |
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *, const unsigned char *, int); |
| 55 |
|
| 56 |
/* ASN1 IA5STRING */ |
| 57 |
ASN1_IA5STRING *ASN1_IA5STRING_new(void); |
| 58 |
|
| 59 |
/* ASN1 INTEGER */ |
| 60 |
void ASN1_INTEGER_free(ASN1_INTEGER *); |
| 61 |
int ASN1_INTEGER_set(ASN1_INTEGER *, long); |
| 62 |
|
| 63 |
/* ASN1 TIME */ |
| 64 |
ASN1_TIME *ASN1_TIME_new(void); |
| 65 |
void ASN1_TIME_free(ASN1_TIME *); |
| 66 |
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *, time_t); |
| 67 |
int ASN1_TIME_set_string(ASN1_TIME *, const char *); |
| 68 |
|
| 69 |
/* ASN1 GENERALIZEDTIME */ |
| 70 |
ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *, time_t); |
| 71 |
void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *); |
| 72 |
|
| 73 |
/* ASN1 ENUMERATED */ |
| 74 |
ASN1_ENUMERATED *ASN1_ENUMERATED_new(void); |
| 75 |
void ASN1_ENUMERATED_free(ASN1_ENUMERATED *); |
| 76 |
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *, long); |
| 77 |
|
| 78 |
ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **, const unsigned char **, long, |
| 79 |
const ASN1_ITEM *); |
| 80 |
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *, int, int); |
| 81 |
/* These became const ASN1_* in 1.1.0 */ |
| 82 |
int ASN1_STRING_type(ASN1_STRING *); |
| 83 |
int ASN1_STRING_to_UTF8(unsigned char **, ASN1_STRING *); |
| 84 |
long ASN1_ENUMERATED_get(ASN1_ENUMERATED *); |
| 85 |
int i2a_ASN1_INTEGER(BIO *, ASN1_INTEGER *); |
| 86 |
|
| 87 |
/* This became const ASN1_TIME in 1.1.0f */ |
| 88 |
ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *, |
| 89 |
ASN1_GENERALIZEDTIME **); |
| 90 |
|
| 91 |
ASN1_UTF8STRING *ASN1_UTF8STRING_new(void); |
| 92 |
void ASN1_UTF8STRING_free(ASN1_UTF8STRING *); |
| 93 |
|
| 94 |
ASN1_BIT_STRING *ASN1_BIT_STRING_new(void); |
| 95 |
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *); |
| 96 |
const ASN1_ITEM *ASN1_ITEM_ptr(ASN1_ITEM_EXP *); |
| 97 |
|
| 98 |
/* This is not a macro, but is const on some versions of OpenSSL */ |
| 99 |
int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *, int); |
| 100 |
|
| 101 |
int ASN1_TIME_print(BIO *, ASN1_TIME *); |
| 102 |
int ASN1_STRING_length(ASN1_STRING *); |
| 103 |
int ASN1_STRING_set_default_mask_asc(char *); |
| 104 |
|
| 105 |
BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *, BIGNUM *); |
| 106 |
ASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *, ASN1_INTEGER *); |
| 107 |
|
| 108 |
int i2d_ASN1_TYPE(ASN1_TYPE *, unsigned char **); |
| 109 |
ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **, const unsigned char **, long); |
| 110 |
|
| 111 |
ASN1_NULL *ASN1_NULL_new(void); |
| 112 |
""" |
| 113 |
|
| 114 |
CUSTOMIZATIONS = """ |
| 115 |
""" |