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