/*** <<< INCLUDES [Certificate] >>> ***/ #include #include #include #include #include /*** <<< TYPE-DECLS [Certificate] >>> ***/ typedef struct Certificate { struct toBeSigned { INTEGER_t version; OBJECT_IDENTIFIER_t signature; Name_t issuer; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } toBeSigned; OBJECT_IDENTIFIER_t algorithm; BIT_STRING_t signature; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Certificate_t; /*** <<< FUNC-DECLS [Certificate] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Certificate; /*** <<< CODE [Certificate] >>> ***/ static int memb_signature_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *app_errlog, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(st->size > 0) { /* Size in bits */ size = 8 * (st->size - 1) - (st->buf[0] & 0x7); } else { size = 0; } if((size <= 256)) { /* Constraint check succeeded */ return 0; } else { _ASN_ERRLOG(app_errlog, app_key, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [Certificate] >>> ***/ static asn_TYPE_member_t asn_MBR_toBeSigned_2[] = { { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, version), .tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_INTEGER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "version" }, { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, signature), .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_OBJECT_IDENTIFIER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "signature" }, { ATF_NOFLAGS, 0, offsetof(struct toBeSigned, issuer), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_Name, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "issuer" }, }; static ber_tlv_tag_t asn_DEF_toBeSigned_2_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_TYPE_tag2member_t asn_MAP_toBeSigned_2_tag2el[] = { { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* version at 21 */ { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* signature at 22 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, 0, 0 } /* issuer at 24 */ }; static asn_SEQUENCE_specifics_t asn_SPC_toBeSigned_2_specs = { sizeof(struct toBeSigned), offsetof(struct toBeSigned, _asn_ctx), asn_MAP_toBeSigned_2_tag2el, 3, /* Count of tags in the map */ -1, /* Start extensions */ -1 /* Stop extensions */ }; static /* Use -fall-defs-global to expose */ asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = { "toBeSigned", "toBeSigned", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_toBeSigned_2_tags, sizeof(asn_DEF_toBeSigned_2_tags) /sizeof(asn_DEF_toBeSigned_2_tags[0]), /* 1 */ asn_DEF_toBeSigned_2_tags, /* Same as above */ sizeof(asn_DEF_toBeSigned_2_tags) /sizeof(asn_DEF_toBeSigned_2_tags[0]), /* 1 */ asn_MBR_toBeSigned_2, 3, /* Elements count */ &asn_SPC_toBeSigned_2_specs /* Additional specs */ }; static asn_TYPE_member_t asn_MBR_Certificate_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Certificate, toBeSigned), .tag = (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_toBeSigned_2, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "toBeSigned" }, { ATF_NOFLAGS, 0, offsetof(struct Certificate, algorithm), .tag = (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_OBJECT_IDENTIFIER, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "algorithm" }, { ATF_NOFLAGS, 0, offsetof(struct Certificate, signature), .tag = (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_BIT_STRING, .memb_constraints = memb_signature_1_constraint, .name = "signature" }, }; static ber_tlv_tag_t asn_DEF_Certificate_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_TYPE_tag2member_t asn_MAP_Certificate_1_tag2el[] = { { (ASN_TAG_CLASS_UNIVERSAL | (3 << 2)), 2, 0, 0 }, /* signature at 17 */ { (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 1, 0, 0 }, /* algorithm at 16 */ { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 0 } /* toBeSigned at 21 */ }; static asn_SEQUENCE_specifics_t asn_SPC_Certificate_1_specs = { sizeof(struct Certificate), offsetof(struct Certificate, _asn_ctx), asn_MAP_Certificate_1_tag2el, 3, /* Count of tags in the map */ -1, /* Start extensions */ -1 /* Stop extensions */ }; asn_TYPE_descriptor_t asn_DEF_Certificate = { "Certificate", "Certificate", SEQUENCE_free, SEQUENCE_print, SEQUENCE_constraint, SEQUENCE_decode_ber, SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_Certificate_1_tags, sizeof(asn_DEF_Certificate_1_tags) /sizeof(asn_DEF_Certificate_1_tags[0]), /* 1 */ asn_DEF_Certificate_1_tags, /* Same as above */ sizeof(asn_DEF_Certificate_1_tags) /sizeof(asn_DEF_Certificate_1_tags[0]), /* 1 */ asn_MBR_Certificate_1, 3, /* Elements count */ &asn_SPC_Certificate_1_specs /* Additional specs */ }; /*** <<< INCLUDES [Name] >>> ***/ #include #include /*** <<< FWD-DECLS [Name] >>> ***/ struct RelativeDistinguishedName; /*** <<< TYPE-DECLS [Name] >>> ***/ typedef struct Name { A_SEQUENCE_OF(struct RelativeDistinguishedName) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } Name_t; /*** <<< FUNC-DECLS [Name] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_Name; /*** <<< POST-INCLUDE [Name] >>> ***/ #include /*** <<< STAT-DEFS [Name] >>> ***/ static asn_TYPE_member_t asn_MBR_Name_1[] = { { ATF_NOFLAGS, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_RelativeDistinguishedName, .memb_constraints = 0, /* Defer constraints checking to the member type */ .name = "" }, }; static ber_tlv_tag_t asn_DEF_Name_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_Name_1_specs = { sizeof(struct Name), offsetof(struct Name, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_Name = { "Name", "Name", SEQUENCE_OF_free, SEQUENCE_OF_print, SEQUENCE_OF_constraint, SEQUENCE_OF_decode_ber, SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_Name_1_tags, sizeof(asn_DEF_Name_1_tags) /sizeof(asn_DEF_Name_1_tags[0]), /* 1 */ asn_DEF_Name_1_tags, /* Same as above */ sizeof(asn_DEF_Name_1_tags) /sizeof(asn_DEF_Name_1_tags[0]), /* 1 */ asn_MBR_Name_1, 1, /* Single element */ &asn_SPC_Name_1_specs /* Additional specs */ }; /*** <<< INCLUDES [RelativeDistinguishedName] >>> ***/ #include #include #include /*** <<< TYPE-DECLS [RelativeDistinguishedName] >>> ***/ typedef struct RelativeDistinguishedName { A_SET_OF(IA5String_t) list; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } RelativeDistinguishedName_t; /*** <<< FUNC-DECLS [RelativeDistinguishedName] >>> ***/ extern asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName; /*** <<< CTABLES [RelativeDistinguishedName] >>> ***/ static int permitted_alphabet_table_2[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */ 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0, /* ,-. */ 1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, /* 0 9 */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ABCDEFGHIJKLMNO */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* PQRSTUVWXYZ */ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* abcdefghijklmno */ 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */ }; static int check_permitted_alphabet_2(const void *sptr) { int *table = permitted_alphabet_table_2; /* The underlying type is IA5String */ const IA5String_t *st = (const IA5String_t *)sptr; const uint8_t *ch = st->buf; const uint8_t *end = ch + st->size; for(; ch < end; ch++) { uint8_t cv = *ch; if(!table[cv]) return -1; } return 0; } /*** <<< CODE [RelativeDistinguishedName] >>> ***/ static int memb_IA5String_1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_consume_bytes_f *app_errlog, void *app_key) { const IA5String_t *st = (const IA5String_t *)sptr; if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(!check_permitted_alphabet_2(st)) { /* Constraint check succeeded */ return 0; } else { _ASN_ERRLOG(app_errlog, app_key, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } /*** <<< STAT-DEFS [RelativeDistinguishedName] >>> ***/ static asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[] = { { ATF_NOFLAGS, 0, 0, .tag = (ASN_TAG_CLASS_UNIVERSAL | (22 << 2)), .tag_mode = 0, .type = (void *)&asn_DEF_IA5String, .memb_constraints = memb_IA5String_1_constraint, .name = "" }, }; static ber_tlv_tag_t asn_DEF_RelativeDistinguishedName_1_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)) }; static asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_1_specs = { sizeof(struct RelativeDistinguishedName), offsetof(struct RelativeDistinguishedName, _asn_ctx), 0, /* XER encoding is XMLDelimitedItemList */ }; asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = { "RelativeDistinguishedName", "RelativeDistinguishedName", SET_OF_free, SET_OF_print, SET_OF_constraint, SET_OF_decode_ber, SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, 0, /* Use generic outmost tag fetcher */ asn_DEF_RelativeDistinguishedName_1_tags, sizeof(asn_DEF_RelativeDistinguishedName_1_tags) /sizeof(asn_DEF_RelativeDistinguishedName_1_tags[0]), /* 1 */ asn_DEF_RelativeDistinguishedName_1_tags, /* Same as above */ sizeof(asn_DEF_RelativeDistinguishedName_1_tags) /sizeof(asn_DEF_RelativeDistinguishedName_1_tags[0]), /* 1 */ asn_MBR_RelativeDistinguishedName_1, 1, /* Single element */ &asn_SPC_RelativeDistinguishedName_1_specs /* Additional specs */ };