blob: 6fbda3d9c7efab28c0698a8b129910ff4f046782 [file] [log] [blame]
Lev Walkin006de1c2004-08-20 13:37:45 +00001
Lev Walkina00d6b32006-03-21 03:40:38 +00002/*** <<< INCLUDES [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +00003
4#include <OBJECT_IDENTIFIER.h>
5#include <BIT_STRING.h>
6#include <INTEGER.h>
Lev Walkin22b5ed42006-09-13 02:51:20 +00007#include "Name.h"
Lev Walkin006de1c2004-08-20 13:37:45 +00008#include <constr_SEQUENCE.h>
9
Lev Walkina00d6b32006-03-21 03:40:38 +000010/*** <<< TYPE-DECLS [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +000011
Lev Walkina00d6b32006-03-21 03:40:38 +000012typedef struct SIGNED_15P0 {
Lev Walkin006de1c2004-08-20 13:37:45 +000013 struct toBeSigned {
14 INTEGER_t version;
15 OBJECT_IDENTIFIER_t signature;
16 Name_t issuer;
17
18 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +000019 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +000020 } toBeSigned;
21 OBJECT_IDENTIFIER_t algorithm;
22 BIT_STRING_t signature;
23
24 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +000025 asn_struct_ctx_t _asn_ctx;
Lev Walkina00d6b32006-03-21 03:40:38 +000026} SIGNED_15P0_t;
Lev Walkin006de1c2004-08-20 13:37:45 +000027
Lev Walkina00d6b32006-03-21 03:40:38 +000028/*** <<< FUNC-DECLS [SIGNED] >>> ***/
Lev Walkinc8285712005-03-04 22:18:20 +000029
Lev Walkina00d6b32006-03-21 03:40:38 +000030extern asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0;
Lev Walkinc8285712005-03-04 22:18:20 +000031
Lev Walkina00d6b32006-03-21 03:40:38 +000032/*** <<< CODE [SIGNED] >>> ***/
Lev Walkindaa7d2b2004-09-05 10:37:18 +000033
34static int
Lev Walkin59b176e2005-11-26 11:25:14 +000035memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +000036 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +000037 const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
Lev Walkindaa7d2b2004-09-05 10:37:18 +000038 size_t size;
39
40 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -070041 ASN__CTFAIL(app_key, td, sptr,
Lev Walkindaa7d2b2004-09-05 10:37:18 +000042 "%s: value not given (%s:%d)",
43 td->name, __FILE__, __LINE__);
44 return -1;
45 }
46
47 if(st->size > 0) {
48 /* Size in bits */
Lev Walkin1b1c5fc2006-09-08 19:38:11 +000049 size = 8 * st->size - (st->bits_unused & 0x07);
Lev Walkindaa7d2b2004-09-05 10:37:18 +000050 } else {
51 size = 0;
52 }
53
54 if((size <= 256)) {
55 /* Constraint check succeeded */
56 return 0;
57 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -070058 ASN__CTFAIL(app_key, td, sptr,
Lev Walkindaa7d2b2004-09-05 10:37:18 +000059 "%s: constraint failed (%s:%d)",
60 td->name, __FILE__, __LINE__);
61 return -1;
62 }
63}
64
65
Lev Walkina00d6b32006-03-21 03:40:38 +000066/*** <<< STAT-DEFS [SIGNED] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +000067
Lev Walkine0272aa2005-03-04 11:26:08 +000068static asn_TYPE_member_t asn_MBR_toBeSigned_2[] = {
Lev Walkincc93b0f2004-09-10 09:18:20 +000069 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, version),
Lev Walkin006de1c2004-08-20 13:37:45 +000070 .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
71 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000072 .type = &asn_DEF_INTEGER,
Lev Walkinba58e1b2005-01-17 12:20:19 +000073 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +040074 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +000075 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
76 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000077 .name = "version"
78 },
Lev Walkincc93b0f2004-09-10 09:18:20 +000079 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature),
Lev Walkin006de1c2004-08-20 13:37:45 +000080 .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
81 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000082 .type = &asn_DEF_OBJECT_IDENTIFIER,
Lev Walkinba58e1b2005-01-17 12:20:19 +000083 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +040084 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +000085 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
86 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000087 .name = "signature"
88 },
Lev Walkincc93b0f2004-09-10 09:18:20 +000089 { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer),
Lev Walkin006de1c2004-08-20 13:37:45 +000090 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
91 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +000092 .type = &asn_DEF_Name,
Lev Walkinba58e1b2005-01-17 12:20:19 +000093 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +040094 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +000095 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
96 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +000097 .name = "issuer"
98 },
99};
Lev Walkina7591b52014-10-12 18:37:35 -0700100static const ber_tlv_tag_t asn_DEF_toBeSigned_tags_2[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000101 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
102};
Lev Walkina7591b52014-10-12 18:37:35 -0700103static const asn_TYPE_tag2member_t asn_MAP_toBeSigned_tag2el_2[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700104 { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* version */
105 { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* signature */
106 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* issuer */
Lev Walkin006de1c2004-08-20 13:37:45 +0000107};
Lev Walkin59b176e2005-11-26 11:25:14 +0000108static asn_SEQUENCE_specifics_t asn_SPC_toBeSigned_specs_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000109 sizeof(struct toBeSigned),
Lev Walkindfae9752004-09-29 13:19:37 +0000110 offsetof(struct toBeSigned, _asn_ctx),
Lev Walkin59b176e2005-11-26 11:25:14 +0000111 asn_MAP_toBeSigned_tag2el_2,
Lev Walkin006de1c2004-08-20 13:37:45 +0000112 3, /* Count of tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +0000113 0, 0, 0, /* Optional elements (not needed) */
Lev Walkin006de1c2004-08-20 13:37:45 +0000114 -1, /* Start extensions */
115 -1 /* Stop extensions */
116};
Lev Walkind04430c2004-09-07 06:44:29 +0000117static /* Use -fall-defs-global to expose */
Lev Walkine0272aa2005-03-04 11:26:08 +0000118asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000119 "toBeSigned",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000120 "toBeSigned",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000121 SEQUENCE_free,
122 SEQUENCE_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000123 SEQUENCE_constraint,
124 SEQUENCE_decode_ber,
125 SEQUENCE_encode_der,
Lev Walkin61b40d82004-10-23 15:07:45 +0000126 SEQUENCE_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000127 SEQUENCE_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700128 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400129 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000130 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000131 asn_DEF_toBeSigned_tags_2,
132 sizeof(asn_DEF_toBeSigned_tags_2)
133 /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */
134 asn_DEF_toBeSigned_tags_2, /* Same as above */
135 sizeof(asn_DEF_toBeSigned_tags_2)
136 /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400137 0, /* No OER visible constraints */
Lev Walkin59b176e2005-11-26 11:25:14 +0000138 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000139 asn_MBR_toBeSigned_2,
Lev Walkin006de1c2004-08-20 13:37:45 +0000140 3, /* Elements count */
Lev Walkin59b176e2005-11-26 11:25:14 +0000141 &asn_SPC_toBeSigned_specs_2 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000142};
143
Lev Walkina00d6b32006-03-21 03:40:38 +0000144static asn_TYPE_member_t asn_MBR_SIGNED_15P0_1[] = {
145 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, toBeSigned),
Lev Walkin006de1c2004-08-20 13:37:45 +0000146 .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
147 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000148 .type = &asn_DEF_toBeSigned_2,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000149 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +0400150 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +0000151 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
152 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000153 .name = "toBeSigned"
154 },
Lev Walkina00d6b32006-03-21 03:40:38 +0000155 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, algorithm),
Lev Walkin006de1c2004-08-20 13:37:45 +0000156 .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
157 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000158 .type = &asn_DEF_OBJECT_IDENTIFIER,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000159 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +0400160 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +0000161 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
162 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000163 .name = "algorithm"
164 },
Lev Walkina00d6b32006-03-21 03:40:38 +0000165 { ATF_NOFLAGS, 0, offsetof(struct SIGNED_15P0, signature),
Lev Walkin006de1c2004-08-20 13:37:45 +0000166 .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)),
167 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000168 .type = &asn_DEF_BIT_STRING,
Lev Walkin59b176e2005-11-26 11:25:14 +0000169 .memb_constraints = memb_signature_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400170 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +0000171 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
172 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000173 .name = "signature"
174 },
175};
Lev Walkina7591b52014-10-12 18:37:35 -0700176static const ber_tlv_tag_t asn_DEF_SIGNED_15P0_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000177 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
178};
Lev Walkina7591b52014-10-12 18:37:35 -0700179static const asn_TYPE_tag2member_t asn_MAP_SIGNED_15P0_tag2el_1[] = {
Lev Walkin4062b012013-10-11 14:29:38 -0700180 { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 0 }, /* signature */
181 { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* algorithm */
182 { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* toBeSigned */
Lev Walkin006de1c2004-08-20 13:37:45 +0000183};
Lev Walkina00d6b32006-03-21 03:40:38 +0000184static asn_SEQUENCE_specifics_t asn_SPC_SIGNED_15P0_specs_1 = {
185 sizeof(struct SIGNED_15P0),
186 offsetof(struct SIGNED_15P0, _asn_ctx),
187 asn_MAP_SIGNED_15P0_tag2el_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000188 3, /* Count of tags in the map */
Lev Walkin59b176e2005-11-26 11:25:14 +0000189 0, 0, 0, /* Optional elements (not needed) */
Lev Walkin006de1c2004-08-20 13:37:45 +0000190 -1, /* Start extensions */
191 -1 /* Stop extensions */
192};
Lev Walkina00d6b32006-03-21 03:40:38 +0000193asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0 = {
194 "SIGNED",
195 "SIGNED",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000196 SEQUENCE_free,
197 SEQUENCE_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000198 SEQUENCE_constraint,
199 SEQUENCE_decode_ber,
200 SEQUENCE_encode_der,
Lev Walkin61b40d82004-10-23 15:07:45 +0000201 SEQUENCE_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000202 SEQUENCE_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700203 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400204 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000205 0, /* Use generic outmost tag fetcher */
Lev Walkina00d6b32006-03-21 03:40:38 +0000206 asn_DEF_SIGNED_15P0_tags_1,
207 sizeof(asn_DEF_SIGNED_15P0_tags_1)
208 /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */
209 asn_DEF_SIGNED_15P0_tags_1, /* Same as above */
210 sizeof(asn_DEF_SIGNED_15P0_tags_1)
211 /sizeof(asn_DEF_SIGNED_15P0_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400212 0, /* No OER visible constraints */
Lev Walkina00d6b32006-03-21 03:40:38 +0000213 0, /* No PER visible constraints */
214 asn_MBR_SIGNED_15P0_1,
215 3, /* Elements count */
216 &asn_SPC_SIGNED_15P0_specs_1 /* Additional specs */
217};
218
219
220/*** <<< INCLUDES [Certificate] >>> ***/
221
Lev Walkin22b5ed42006-09-13 02:51:20 +0000222#include "SIGNED.h"
Lev Walkina00d6b32006-03-21 03:40:38 +0000223
224/*** <<< TYPE-DECLS [Certificate] >>> ***/
225
226typedef SIGNED_15P0_t Certificate_t;
227
228/*** <<< FUNC-DECLS [Certificate] >>> ***/
229
230extern asn_TYPE_descriptor_t asn_DEF_Certificate;
231asn_struct_free_f Certificate_free;
232asn_struct_print_f Certificate_print;
233asn_constr_check_f Certificate_constraint;
234ber_type_decoder_f Certificate_decode_ber;
235der_type_encoder_f Certificate_encode_der;
236xer_type_decoder_f Certificate_decode_xer;
237xer_type_encoder_f Certificate_encode_xer;
238
239/*** <<< CODE [Certificate] >>> ***/
240
241int
242Certificate_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000243 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkina00d6b32006-03-21 03:40:38 +0000244 /* Replace with underlying type checker */
245 td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints;
Lev Walkin1eded352006-07-13 11:19:01 +0000246 return td->check_constraints(td, sptr, ctfailcb, app_key);
Lev Walkina00d6b32006-03-21 03:40:38 +0000247}
248
249/*
250 * This type is implemented using SIGNED_15P0,
251 * so here we adjust the DEF accordingly.
252 */
253static void
254Certificate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
255 td->free_struct = asn_DEF_SIGNED_15P0.free_struct;
256 td->print_struct = asn_DEF_SIGNED_15P0.print_struct;
Lev Walkin6169b8d2013-12-07 11:02:44 -0800257 td->check_constraints = asn_DEF_SIGNED_15P0.check_constraints;
Lev Walkina00d6b32006-03-21 03:40:38 +0000258 td->ber_decoder = asn_DEF_SIGNED_15P0.ber_decoder;
259 td->der_encoder = asn_DEF_SIGNED_15P0.der_encoder;
260 td->xer_decoder = asn_DEF_SIGNED_15P0.xer_decoder;
261 td->xer_encoder = asn_DEF_SIGNED_15P0.xer_encoder;
262 td->uper_decoder = asn_DEF_SIGNED_15P0.uper_decoder;
Lev Walkin9f5bb3a2006-08-18 01:46:46 +0000263 td->uper_encoder = asn_DEF_SIGNED_15P0.uper_encoder;
Lev Walkinba68c912017-07-06 07:52:39 -0700264 td->oer_decoder = asn_DEF_SIGNED_15P0.oer_decoder;
265 td->oer_encoder = asn_DEF_SIGNED_15P0.oer_encoder;
Lev Walkinb33425f2017-07-14 14:59:52 +0400266 if(!td->oer_constraints)
267 td->oer_constraints = asn_DEF_SIGNED_15P0.oer_constraints;
Lev Walkina00d6b32006-03-21 03:40:38 +0000268 if(!td->per_constraints)
269 td->per_constraints = asn_DEF_SIGNED_15P0.per_constraints;
270 td->elements = asn_DEF_SIGNED_15P0.elements;
271 td->elements_count = asn_DEF_SIGNED_15P0.elements_count;
272 td->specifics = asn_DEF_SIGNED_15P0.specifics;
273}
274
275void
276Certificate_free(asn_TYPE_descriptor_t *td,
277 void *struct_ptr, int contents_only) {
278 Certificate_1_inherit_TYPE_descriptor(td);
279 td->free_struct(td, struct_ptr, contents_only);
280}
281
282int
283Certificate_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
284 int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
285 Certificate_1_inherit_TYPE_descriptor(td);
286 return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
287}
288
289asn_dec_rval_t
290Certificate_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
291 void **structure, const void *bufptr, size_t size, int tag_mode) {
292 Certificate_1_inherit_TYPE_descriptor(td);
293 return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
294}
295
296asn_enc_rval_t
297Certificate_encode_der(asn_TYPE_descriptor_t *td,
298 void *structure, int tag_mode, ber_tlv_tag_t tag,
299 asn_app_consume_bytes_f *cb, void *app_key) {
300 Certificate_1_inherit_TYPE_descriptor(td);
301 return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
302}
303
304asn_dec_rval_t
305Certificate_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
306 void **structure, const char *opt_mname, const void *bufptr, size_t size) {
307 Certificate_1_inherit_TYPE_descriptor(td);
308 return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
309}
310
311asn_enc_rval_t
312Certificate_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
313 int ilevel, enum xer_encoder_flags_e flags,
314 asn_app_consume_bytes_f *cb, void *app_key) {
315 Certificate_1_inherit_TYPE_descriptor(td);
316 return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
317}
318
319
320/*** <<< STAT-DEFS [Certificate] >>> ***/
321
Lev Walkina7591b52014-10-12 18:37:35 -0700322static const ber_tlv_tag_t asn_DEF_Certificate_tags_1[] = {
Lev Walkina00d6b32006-03-21 03:40:38 +0000323 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
324};
325asn_TYPE_descriptor_t asn_DEF_Certificate = {
326 "Certificate",
327 "Certificate",
328 Certificate_free,
329 Certificate_print,
330 Certificate_constraint,
331 Certificate_decode_ber,
332 Certificate_encode_der,
333 Certificate_decode_xer,
334 Certificate_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700335 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400336 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkina00d6b32006-03-21 03:40:38 +0000337 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000338 asn_DEF_Certificate_tags_1,
339 sizeof(asn_DEF_Certificate_tags_1)
340 /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
341 asn_DEF_Certificate_tags_1, /* Same as above */
342 sizeof(asn_DEF_Certificate_tags_1)
343 /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400344 0, /* No OER visible constraints */
Lev Walkin59b176e2005-11-26 11:25:14 +0000345 0, /* No PER visible constraints */
Lev Walkina00d6b32006-03-21 03:40:38 +0000346 0, 0, /* Defined elsewhere */
347 0 /* No specifics */
Lev Walkin006de1c2004-08-20 13:37:45 +0000348};
349
350
351/*** <<< INCLUDES [Name] >>> ***/
352
Lev Walkin006de1c2004-08-20 13:37:45 +0000353#include <asn_SEQUENCE_OF.h>
354#include <constr_SEQUENCE_OF.h>
355
Lev Walkinc8285712005-03-04 22:18:20 +0000356/*** <<< FWD-DECLS [Name] >>> ***/
Lev Walkin006de1c2004-08-20 13:37:45 +0000357
Lev Walkinbf56d542005-03-04 23:50:56 +0000358struct RelativeDistinguishedName;
Lev Walkin006de1c2004-08-20 13:37:45 +0000359
360/*** <<< TYPE-DECLS [Name] >>> ***/
361
Lev Walkin006de1c2004-08-20 13:37:45 +0000362typedef struct Name {
Lev Walkinc8285712005-03-04 22:18:20 +0000363 A_SEQUENCE_OF(struct RelativeDistinguishedName) list;
Lev Walkin006de1c2004-08-20 13:37:45 +0000364
365 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +0000366 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +0000367} Name_t;
368
Lev Walkinc8285712005-03-04 22:18:20 +0000369/*** <<< FUNC-DECLS [Name] >>> ***/
370
371extern asn_TYPE_descriptor_t asn_DEF_Name;
372
373/*** <<< POST-INCLUDE [Name] >>> ***/
374
Lev Walkin22b5ed42006-09-13 02:51:20 +0000375#include "RelativeDistinguishedName.h"
Lev Walkinc8285712005-03-04 22:18:20 +0000376
Lev Walkin006de1c2004-08-20 13:37:45 +0000377/*** <<< STAT-DEFS [Name] >>> ***/
378
Lev Walkine0272aa2005-03-04 11:26:08 +0000379static asn_TYPE_member_t asn_MBR_Name_1[] = {
Lev Walkin8eb4b572005-08-16 16:57:17 +0000380 { ATF_POINTER, 0, 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000381 .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
382 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000383 .type = &asn_DEF_RelativeDistinguishedName,
Lev Walkinba58e1b2005-01-17 12:20:19 +0000384 .memb_constraints = 0, /* Defer constraints checking to the member type */
Lev Walkinb33425f2017-07-14 14:59:52 +0400385 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +0000386 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
387 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000388 .name = ""
389 },
390};
Lev Walkina7591b52014-10-12 18:37:35 -0700391static const ber_tlv_tag_t asn_DEF_Name_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000392 (ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
393};
Lev Walkin59b176e2005-11-26 11:25:14 +0000394static asn_SET_OF_specifics_t asn_SPC_Name_specs_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000395 sizeof(struct Name),
Lev Walkindfae9752004-09-29 13:19:37 +0000396 offsetof(struct Name, _asn_ctx),
Lev Walkina9cc46e2004-09-22 16:06:28 +0000397 0, /* XER encoding is XMLDelimitedItemList */
Lev Walkin006de1c2004-08-20 13:37:45 +0000398};
Lev Walkindfae9752004-09-29 13:19:37 +0000399asn_TYPE_descriptor_t asn_DEF_Name = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000400 "Name",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000401 "Name",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000402 SEQUENCE_OF_free,
403 SEQUENCE_OF_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000404 SEQUENCE_OF_constraint,
405 SEQUENCE_OF_decode_ber,
406 SEQUENCE_OF_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000407 SEQUENCE_OF_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000408 SEQUENCE_OF_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700409 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400410 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000411 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000412 asn_DEF_Name_tags_1,
413 sizeof(asn_DEF_Name_tags_1)
414 /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */
415 asn_DEF_Name_tags_1, /* Same as above */
416 sizeof(asn_DEF_Name_tags_1)
417 /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400418 0, /* No OER visible constraints */
Lev Walkin59b176e2005-11-26 11:25:14 +0000419 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000420 asn_MBR_Name_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000421 1, /* Single element */
Lev Walkin59b176e2005-11-26 11:25:14 +0000422 &asn_SPC_Name_specs_1 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000423};
424
425
426/*** <<< INCLUDES [RelativeDistinguishedName] >>> ***/
427
428#include <IA5String.h>
429#include <asn_SET_OF.h>
430#include <constr_SET_OF.h>
431
Lev Walkin006de1c2004-08-20 13:37:45 +0000432/*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/
433
Lev Walkin006de1c2004-08-20 13:37:45 +0000434typedef struct RelativeDistinguishedName {
435 A_SET_OF(IA5String_t) list;
436
437 /* Context for parsing across buffer boundaries */
Lev Walkindfae9752004-09-29 13:19:37 +0000438 asn_struct_ctx_t _asn_ctx;
Lev Walkin006de1c2004-08-20 13:37:45 +0000439} RelativeDistinguishedName_t;
440
Lev Walkinc8285712005-03-04 22:18:20 +0000441/*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/
442
443extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName;
444
Lev Walkin006de1c2004-08-20 13:37:45 +0000445/*** <<< CTABLES [RelativeDistinguishedName] >>> ***/
446
Lev Walkina7591b52014-10-12 18:37:35 -0700447static const int permitted_alphabet_table_2[256] = {
Lev Walkin5b62ca82006-09-21 01:52:07 +0000448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
450 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, /* ,-. */
451 4, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, /* 0 9 */
452 0, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20, /* ABCDEFGHIJKLMNO */
45321,22,23,24,25,26,27,28,29,30,31, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
454 0,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, /* abcdefghijklmno */
45547,48,49,50,51,52,53,54,55,56,57, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
Lev Walkin006de1c2004-08-20 13:37:45 +0000456};
457
Lev Walkine8318b82005-03-06 09:29:03 +0000458static int check_permitted_alphabet_2(const void *sptr) {
Lev Walkina7591b52014-10-12 18:37:35 -0700459 const int *table = permitted_alphabet_table_2;
Lev Walkin006de1c2004-08-20 13:37:45 +0000460 /* The underlying type is IA5String */
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000461 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkina09e5da2004-08-22 03:19:00 +0000462 const uint8_t *ch = st->buf;
463 const uint8_t *end = ch + st->size;
Lev Walkin006de1c2004-08-20 13:37:45 +0000464
465 for(; ch < end; ch++) {
466 uint8_t cv = *ch;
Lev Walkin775885e2004-08-22 12:47:03 +0000467 if(!table[cv]) return -1;
Lev Walkin006de1c2004-08-20 13:37:45 +0000468 }
Lev Walkin775885e2004-08-22 12:47:03 +0000469 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000470}
471
472
473/*** <<< CODE [RelativeDistinguishedName] >>> ***/
474
475static int
Lev Walkin59b176e2005-11-26 11:25:14 +0000476memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
Lev Walkin1eded352006-07-13 11:19:01 +0000477 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
Lev Walkin8a7af0e2005-02-15 03:40:07 +0000478 const IA5String_t *st = (const IA5String_t *)sptr;
Lev Walkin006de1c2004-08-20 13:37:45 +0000479
480 if(!sptr) {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700481 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000482 "%s: value not given (%s:%d)",
483 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000484 return -1;
485 }
486
487
Lev Walkine8318b82005-03-06 09:29:03 +0000488 if(!check_permitted_alphabet_2(st)) {
Lev Walkin006de1c2004-08-20 13:37:45 +0000489 /* Constraint check succeeded */
Lev Walkin775885e2004-08-22 12:47:03 +0000490 return 0;
Lev Walkin006de1c2004-08-20 13:37:45 +0000491 } else {
Lev Walkin7c1dc052016-03-14 03:08:15 -0700492 ASN__CTFAIL(app_key, td, sptr,
Lev Walkin16835b62004-08-22 13:47:59 +0000493 "%s: constraint failed (%s:%d)",
494 td->name, __FILE__, __LINE__);
Lev Walkin006de1c2004-08-20 13:37:45 +0000495 return -1;
496 }
497}
498
499
500/*** <<< STAT-DEFS [RelativeDistinguishedName] >>> ***/
501
Lev Walkine0272aa2005-03-04 11:26:08 +0000502static asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[] = {
Lev Walkin8eb4b572005-08-16 16:57:17 +0000503 { ATF_POINTER, 0, 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000504 .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)),
505 .tag_mode = 0,
Lev Walkinae7bf3f2005-08-29 10:31:14 +0000506 .type = &asn_DEF_IA5String,
Lev Walkin59b176e2005-11-26 11:25:14 +0000507 .memb_constraints = memb_IA5String_constraint_1,
Lev Walkinb33425f2017-07-14 14:59:52 +0400508 .oer_constraints = 0, /* OER is not compiled, use -gen-OER */
Lev Walkin59b176e2005-11-26 11:25:14 +0000509 .per_constraints = 0, /* PER is not compiled, use -gen-PER */
510 .default_value = 0,
Lev Walkin006de1c2004-08-20 13:37:45 +0000511 .name = ""
512 },
513};
Lev Walkina7591b52014-10-12 18:37:35 -0700514static const ber_tlv_tag_t asn_DEF_RelativeDistinguishedName_tags_1[] = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000515 (ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
516};
Lev Walkin59b176e2005-11-26 11:25:14 +0000517static asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1 = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000518 sizeof(struct RelativeDistinguishedName),
Lev Walkindfae9752004-09-29 13:19:37 +0000519 offsetof(struct RelativeDistinguishedName, _asn_ctx),
Lev Walkina9cc46e2004-09-22 16:06:28 +0000520 0, /* XER encoding is XMLDelimitedItemList */
Lev Walkin006de1c2004-08-20 13:37:45 +0000521};
Lev Walkindfae9752004-09-29 13:19:37 +0000522asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = {
Lev Walkin006de1c2004-08-20 13:37:45 +0000523 "RelativeDistinguishedName",
Lev Walkindc06f6b2004-10-20 15:50:55 +0000524 "RelativeDistinguishedName",
Lev Walkina9cc46e2004-09-22 16:06:28 +0000525 SET_OF_free,
526 SET_OF_print,
Lev Walkin006de1c2004-08-20 13:37:45 +0000527 SET_OF_constraint,
528 SET_OF_decode_ber,
529 SET_OF_encode_der,
Lev Walkinb2230802005-02-14 20:31:31 +0000530 SET_OF_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000531 SET_OF_encode_xer,
Lev Walkinba68c912017-07-06 07:52:39 -0700532 0, 0, /* No OER support, use "-gen-OER" to enable */
Lev Walkinb33425f2017-07-14 14:59:52 +0400533 0, 0, /* No PER support, use "-gen-PER" to enable */
Lev Walkin006de1c2004-08-20 13:37:45 +0000534 0, /* Use generic outmost tag fetcher */
Lev Walkin59b176e2005-11-26 11:25:14 +0000535 asn_DEF_RelativeDistinguishedName_tags_1,
536 sizeof(asn_DEF_RelativeDistinguishedName_tags_1)
537 /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */
538 asn_DEF_RelativeDistinguishedName_tags_1, /* Same as above */
539 sizeof(asn_DEF_RelativeDistinguishedName_tags_1)
540 /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */
Lev Walkinb33425f2017-07-14 14:59:52 +0400541 0, /* No OER visible constraints */
Lev Walkin59b176e2005-11-26 11:25:14 +0000542 0, /* No PER visible constraints */
Lev Walkine0272aa2005-03-04 11:26:08 +0000543 asn_MBR_RelativeDistinguishedName_1,
Lev Walkin006de1c2004-08-20 13:37:45 +0000544 1, /* Single element */
Lev Walkin59b176e2005-11-26 11:25:14 +0000545 &asn_SPC_RelativeDistinguishedName_specs_1 /* Additional specs */
Lev Walkin006de1c2004-08-20 13:37:45 +0000546};
547