vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 1 | |
| 2 | /*** <<< INCLUDES [Certificate] >>> ***/ |
| 3 | |
| 4 | #include <OBJECT_IDENTIFIER.h> |
| 5 | #include <BIT_STRING.h> |
| 6 | #include <INTEGER.h> |
| 7 | #include <Name.h> |
| 8 | #include <constr_SEQUENCE.h> |
| 9 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 10 | /*** <<< TYPE-DECLS [Certificate] >>> ***/ |
| 11 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 12 | typedef struct Certificate { |
| 13 | struct toBeSigned { |
| 14 | INTEGER_t version; |
| 15 | OBJECT_IDENTIFIER_t signature; |
| 16 | Name_t issuer; |
| 17 | |
| 18 | /* Context for parsing across buffer boundaries */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 19 | asn_struct_ctx_t _asn_ctx; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 20 | } toBeSigned; |
| 21 | OBJECT_IDENTIFIER_t algorithm; |
| 22 | BIT_STRING_t signature; |
| 23 | |
| 24 | /* Context for parsing across buffer boundaries */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 25 | asn_struct_ctx_t _asn_ctx; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 26 | } Certificate_t; |
| 27 | |
vlm | 0b567bf | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 28 | /*** <<< FUNC-DECLS [Certificate] >>> ***/ |
| 29 | |
| 30 | extern asn_TYPE_descriptor_t asn_DEF_Certificate; |
| 31 | |
vlm | ff3a677 | 2004-09-05 10:37:18 +0000 | [diff] [blame] | 32 | /*** <<< CODE [Certificate] >>> ***/ |
| 33 | |
| 34 | static int |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 35 | memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | ff3a677 | 2004-09-05 10:37:18 +0000 | [diff] [blame] | 36 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 37 | const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; |
vlm | ff3a677 | 2004-09-05 10:37:18 +0000 | [diff] [blame] | 38 | size_t size; |
| 39 | |
| 40 | if(!sptr) { |
| 41 | _ASN_ERRLOG(app_errlog, app_key, |
| 42 | "%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 */ |
| 49 | size = 8 * (st->size - 1) - (st->buf[0] & 0x7); |
| 50 | } else { |
| 51 | size = 0; |
| 52 | } |
| 53 | |
| 54 | if((size <= 256)) { |
| 55 | /* Constraint check succeeded */ |
| 56 | return 0; |
| 57 | } else { |
| 58 | _ASN_ERRLOG(app_errlog, app_key, |
| 59 | "%s: constraint failed (%s:%d)", |
| 60 | td->name, __FILE__, __LINE__); |
| 61 | return -1; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 66 | /*** <<< STAT-DEFS [Certificate] >>> ***/ |
| 67 | |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 68 | static asn_TYPE_member_t asn_MBR_toBeSigned_2[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 69 | { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, version), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 70 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), |
| 71 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 72 | .type = &asn_DEF_INTEGER, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 73 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 74 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 75 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 76 | .name = "version" |
| 77 | }, |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 78 | { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 79 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), |
| 80 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 81 | .type = &asn_DEF_OBJECT_IDENTIFIER, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 82 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 83 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 84 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 85 | .name = "signature" |
| 86 | }, |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 87 | { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 88 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 89 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 90 | .type = &asn_DEF_Name, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 91 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 92 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 93 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 94 | .name = "issuer" |
| 95 | }, |
| 96 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 97 | static ber_tlv_tag_t asn_DEF_toBeSigned_tags_2[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 98 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 99 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 100 | static asn_TYPE_tag2member_t asn_MAP_toBeSigned_tag2el_2[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 101 | { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* version at 21 */ |
| 102 | { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* signature at 22 */ |
vlm | 7f061a7 | 2005-02-25 08:19:34 +0000 | [diff] [blame] | 103 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* issuer at 24 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 104 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 105 | static asn_SEQUENCE_specifics_t asn_SPC_toBeSigned_specs_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 106 | sizeof(struct toBeSigned), |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 107 | offsetof(struct toBeSigned, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 108 | asn_MAP_toBeSigned_tag2el_2, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 109 | 3, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 110 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 111 | -1, /* Start extensions */ |
| 112 | -1 /* Stop extensions */ |
| 113 | }; |
vlm | 1dc848e | 2004-09-07 06:44:29 +0000 | [diff] [blame] | 114 | static /* Use -fall-defs-global to expose */ |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 115 | asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 116 | "toBeSigned", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 117 | "toBeSigned", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 118 | SEQUENCE_free, |
| 119 | SEQUENCE_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 120 | SEQUENCE_constraint, |
| 121 | SEQUENCE_decode_ber, |
| 122 | SEQUENCE_encode_der, |
vlm | 2dbab7c | 2004-10-23 15:07:45 +0000 | [diff] [blame] | 123 | SEQUENCE_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 124 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 125 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 126 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 127 | asn_DEF_toBeSigned_tags_2, |
| 128 | sizeof(asn_DEF_toBeSigned_tags_2) |
| 129 | /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */ |
| 130 | asn_DEF_toBeSigned_tags_2, /* Same as above */ |
| 131 | sizeof(asn_DEF_toBeSigned_tags_2) |
| 132 | /sizeof(asn_DEF_toBeSigned_tags_2[0]), /* 1 */ |
| 133 | 0, /* No PER visible constraints */ |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 134 | asn_MBR_toBeSigned_2, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 135 | 3, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 136 | &asn_SPC_toBeSigned_specs_2 /* Additional specs */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 137 | }; |
| 138 | |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 139 | static asn_TYPE_member_t asn_MBR_Certificate_1[] = { |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 140 | { ATF_NOFLAGS, 0, offsetof(struct Certificate, toBeSigned), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 141 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), |
| 142 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 143 | .type = &asn_DEF_toBeSigned_2, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 144 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 145 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 146 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 147 | .name = "toBeSigned" |
| 148 | }, |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 149 | { ATF_NOFLAGS, 0, offsetof(struct Certificate, algorithm), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 150 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), |
| 151 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 152 | .type = &asn_DEF_OBJECT_IDENTIFIER, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 153 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 154 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 155 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 156 | .name = "algorithm" |
| 157 | }, |
vlm | ddd5a7d | 2004-09-10 09:18:20 +0000 | [diff] [blame] | 158 | { ATF_NOFLAGS, 0, offsetof(struct Certificate, signature), |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 159 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), |
| 160 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 161 | .type = &asn_DEF_BIT_STRING, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 162 | .memb_constraints = memb_signature_constraint_1, |
| 163 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 164 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 165 | .name = "signature" |
| 166 | }, |
| 167 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 168 | static ber_tlv_tag_t asn_DEF_Certificate_tags_1[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 169 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 170 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 171 | static asn_TYPE_tag2member_t asn_MAP_Certificate_tag2el_1[] = { |
vlm | ff3a677 | 2004-09-05 10:37:18 +0000 | [diff] [blame] | 172 | { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 0 }, /* signature at 17 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 173 | { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* algorithm at 16 */ |
vlm | 7f061a7 | 2005-02-25 08:19:34 +0000 | [diff] [blame] | 174 | { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* toBeSigned at 21 */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 175 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 176 | static asn_SEQUENCE_specifics_t asn_SPC_Certificate_specs_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 177 | sizeof(struct Certificate), |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 178 | offsetof(struct Certificate, _asn_ctx), |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 179 | asn_MAP_Certificate_tag2el_1, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 180 | 3, /* Count of tags in the map */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 181 | 0, 0, 0, /* Optional elements (not needed) */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 182 | -1, /* Start extensions */ |
| 183 | -1 /* Stop extensions */ |
| 184 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 185 | asn_TYPE_descriptor_t asn_DEF_Certificate = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 186 | "Certificate", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 187 | "Certificate", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 188 | SEQUENCE_free, |
| 189 | SEQUENCE_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 190 | SEQUENCE_constraint, |
| 191 | SEQUENCE_decode_ber, |
| 192 | SEQUENCE_encode_der, |
vlm | 2dbab7c | 2004-10-23 15:07:45 +0000 | [diff] [blame] | 193 | SEQUENCE_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 194 | SEQUENCE_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 195 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 196 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 197 | asn_DEF_Certificate_tags_1, |
| 198 | sizeof(asn_DEF_Certificate_tags_1) |
| 199 | /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */ |
| 200 | asn_DEF_Certificate_tags_1, /* Same as above */ |
| 201 | sizeof(asn_DEF_Certificate_tags_1) |
| 202 | /sizeof(asn_DEF_Certificate_tags_1[0]), /* 1 */ |
| 203 | 0, /* No PER visible constraints */ |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 204 | asn_MBR_Certificate_1, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 205 | 3, /* Elements count */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 206 | &asn_SPC_Certificate_specs_1 /* Additional specs */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 207 | }; |
| 208 | |
| 209 | |
| 210 | /*** <<< INCLUDES [Name] >>> ***/ |
| 211 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 212 | #include <asn_SEQUENCE_OF.h> |
| 213 | #include <constr_SEQUENCE_OF.h> |
| 214 | |
vlm | 0b567bf | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 215 | /*** <<< FWD-DECLS [Name] >>> ***/ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 216 | |
vlm | 5feb752 | 2005-03-04 23:50:56 +0000 | [diff] [blame] | 217 | struct RelativeDistinguishedName; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 218 | |
| 219 | /*** <<< TYPE-DECLS [Name] >>> ***/ |
| 220 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 221 | typedef struct Name { |
vlm | 0b567bf | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 222 | A_SEQUENCE_OF(struct RelativeDistinguishedName) list; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 223 | |
| 224 | /* Context for parsing across buffer boundaries */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 225 | asn_struct_ctx_t _asn_ctx; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 226 | } Name_t; |
| 227 | |
vlm | 0b567bf | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 228 | /*** <<< FUNC-DECLS [Name] >>> ***/ |
| 229 | |
| 230 | extern asn_TYPE_descriptor_t asn_DEF_Name; |
| 231 | |
| 232 | /*** <<< POST-INCLUDE [Name] >>> ***/ |
| 233 | |
| 234 | #include <RelativeDistinguishedName.h> |
| 235 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 236 | /*** <<< STAT-DEFS [Name] >>> ***/ |
| 237 | |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 238 | static asn_TYPE_member_t asn_MBR_Name_1[] = { |
vlm | 2cebdf3 | 2005-08-16 16:57:17 +0000 | [diff] [blame] | 239 | { ATF_POINTER, 0, 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 240 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), |
| 241 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 242 | .type = &asn_DEF_RelativeDistinguishedName, |
vlm | 0a9af51 | 2005-01-17 12:20:19 +0000 | [diff] [blame] | 243 | .memb_constraints = 0, /* Defer constraints checking to the member type */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 244 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 245 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 246 | .name = "" |
| 247 | }, |
| 248 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 249 | static ber_tlv_tag_t asn_DEF_Name_tags_1[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 250 | (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) |
| 251 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 252 | static asn_SET_OF_specifics_t asn_SPC_Name_specs_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 253 | sizeof(struct Name), |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 254 | offsetof(struct Name, _asn_ctx), |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 255 | 0, /* XER encoding is XMLDelimitedItemList */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 256 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 257 | asn_TYPE_descriptor_t asn_DEF_Name = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 258 | "Name", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 259 | "Name", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 260 | SEQUENCE_OF_free, |
| 261 | SEQUENCE_OF_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 262 | SEQUENCE_OF_constraint, |
| 263 | SEQUENCE_OF_decode_ber, |
| 264 | SEQUENCE_OF_encode_der, |
vlm | 9de212e | 2005-02-14 20:31:31 +0000 | [diff] [blame] | 265 | SEQUENCE_OF_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 266 | SEQUENCE_OF_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 267 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 268 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 269 | asn_DEF_Name_tags_1, |
| 270 | sizeof(asn_DEF_Name_tags_1) |
| 271 | /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */ |
| 272 | asn_DEF_Name_tags_1, /* Same as above */ |
| 273 | sizeof(asn_DEF_Name_tags_1) |
| 274 | /sizeof(asn_DEF_Name_tags_1[0]), /* 1 */ |
| 275 | 0, /* No PER visible constraints */ |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 276 | asn_MBR_Name_1, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 277 | 1, /* Single element */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 278 | &asn_SPC_Name_specs_1 /* Additional specs */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 279 | }; |
| 280 | |
| 281 | |
| 282 | /*** <<< INCLUDES [RelativeDistinguishedName] >>> ***/ |
| 283 | |
| 284 | #include <IA5String.h> |
| 285 | #include <asn_SET_OF.h> |
| 286 | #include <constr_SET_OF.h> |
| 287 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 288 | /*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/ |
| 289 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 290 | typedef struct RelativeDistinguishedName { |
| 291 | A_SET_OF(IA5String_t) list; |
| 292 | |
| 293 | /* Context for parsing across buffer boundaries */ |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 294 | asn_struct_ctx_t _asn_ctx; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 295 | } RelativeDistinguishedName_t; |
| 296 | |
vlm | 0b567bf | 2005-03-04 22:18:20 +0000 | [diff] [blame] | 297 | /*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/ |
| 298 | |
| 299 | extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName; |
| 300 | |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 301 | /*** <<< CTABLES [RelativeDistinguishedName] >>> ***/ |
| 302 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 303 | static int permitted_alphabet_table_2[256] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 304 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 305 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ |
| 306 | 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0, /* ,-. */ |
| 307 | 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, /* 0 9 */ |
| 308 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ |
| 309 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ |
| 310 | 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ |
| 311 | 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ |
| 312 | }; |
| 313 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 314 | static int check_permitted_alphabet_2(const void *sptr) { |
| 315 | int *table = permitted_alphabet_table_2; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 316 | /* The underlying type is IA5String */ |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 317 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 824aefc | 2004-08-22 03:19:00 +0000 | [diff] [blame] | 318 | const uint8_t *ch = st->buf; |
| 319 | const uint8_t *end = ch + st->size; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 320 | |
| 321 | for(; ch < end; ch++) { |
| 322 | uint8_t cv = *ch; |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 323 | if(!table[cv]) return -1; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 324 | } |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 325 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | |
| 329 | /*** <<< CODE [RelativeDistinguishedName] >>> ***/ |
| 330 | |
| 331 | static int |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 332 | memb_IA5String_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 333 | asn_app_consume_bytes_f *app_errlog, void *app_key) { |
vlm | db87f2e | 2005-02-15 03:40:07 +0000 | [diff] [blame] | 334 | const IA5String_t *st = (const IA5String_t *)sptr; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 335 | |
| 336 | if(!sptr) { |
| 337 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 338 | "%s: value not given (%s:%d)", |
| 339 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 340 | return -1; |
| 341 | } |
| 342 | |
| 343 | |
vlm | 67d57fe | 2005-03-06 09:29:03 +0000 | [diff] [blame] | 344 | if(!check_permitted_alphabet_2(st)) { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 345 | /* Constraint check succeeded */ |
vlm | cdf661b | 2004-08-22 12:47:03 +0000 | [diff] [blame] | 346 | return 0; |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 347 | } else { |
| 348 | _ASN_ERRLOG(app_errlog, app_key, |
vlm | 758530a | 2004-08-22 13:47:59 +0000 | [diff] [blame] | 349 | "%s: constraint failed (%s:%d)", |
| 350 | td->name, __FILE__, __LINE__); |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 351 | return -1; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | |
| 356 | /*** <<< STAT-DEFS [RelativeDistinguishedName] >>> ***/ |
| 357 | |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 358 | static asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[] = { |
vlm | 2cebdf3 | 2005-08-16 16:57:17 +0000 | [diff] [blame] | 359 | { ATF_POINTER, 0, 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 360 | .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), |
| 361 | .tag_mode = 0, |
vlm | e0fea71 | 2005-08-29 10:31:14 +0000 | [diff] [blame] | 362 | .type = &asn_DEF_IA5String, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 363 | .memb_constraints = memb_IA5String_constraint_1, |
| 364 | .per_constraints = 0, /* PER is not compiled, use -gen-PER */ |
| 365 | .default_value = 0, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 366 | .name = "" |
| 367 | }, |
| 368 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 369 | static ber_tlv_tag_t asn_DEF_RelativeDistinguishedName_tags_1[] = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 370 | (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) |
| 371 | }; |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 372 | static asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1 = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 373 | sizeof(struct RelativeDistinguishedName), |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 374 | offsetof(struct RelativeDistinguishedName, _asn_ctx), |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 375 | 0, /* XER encoding is XMLDelimitedItemList */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 376 | }; |
vlm | 0229643 | 2004-09-29 13:19:37 +0000 | [diff] [blame] | 377 | asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = { |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 378 | "RelativeDistinguishedName", |
vlm | 9de248e | 2004-10-20 15:50:55 +0000 | [diff] [blame] | 379 | "RelativeDistinguishedName", |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 380 | SET_OF_free, |
| 381 | SET_OF_print, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 382 | SET_OF_constraint, |
| 383 | SET_OF_decode_ber, |
| 384 | SET_OF_encode_der, |
vlm | 9de212e | 2005-02-14 20:31:31 +0000 | [diff] [blame] | 385 | SET_OF_decode_xer, |
vlm | 39ba4c4 | 2004-09-22 16:06:28 +0000 | [diff] [blame] | 386 | SET_OF_encode_xer, |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 387 | 0, /* No PER decoder, -gen-PER to enable */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 388 | 0, /* Use generic outmost tag fetcher */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 389 | asn_DEF_RelativeDistinguishedName_tags_1, |
| 390 | sizeof(asn_DEF_RelativeDistinguishedName_tags_1) |
| 391 | /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */ |
| 392 | asn_DEF_RelativeDistinguishedName_tags_1, /* Same as above */ |
| 393 | sizeof(asn_DEF_RelativeDistinguishedName_tags_1) |
| 394 | /sizeof(asn_DEF_RelativeDistinguishedName_tags_1[0]), /* 1 */ |
| 395 | 0, /* No PER visible constraints */ |
vlm | 44fe49a | 2005-03-04 11:26:08 +0000 | [diff] [blame] | 396 | asn_MBR_RelativeDistinguishedName_1, |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 397 | 1, /* Single element */ |
vlm | 337167e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 398 | &asn_SPC_RelativeDistinguishedName_specs_1 /* Additional specs */ |
vlm | 7d576b3 | 2004-08-20 13:37:45 +0000 | [diff] [blame] | 399 | }; |
| 400 | |