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