From 86b6b49cef190d05eca213e45e70dbc9832f0362 Mon Sep 17 00:00:00 2001 From: CinderSocket Date: Fri, 27 Mar 2026 23:14:43 -0700 Subject: [PATCH] Revert "asn1: move metadata tables out of RAM" This reverts commit ea35ecf3a57cabc36c1c778aae0bf9fd65d6f32d. --- lib/asn1/INTEGER.h | 2 +- lib/asn1/OCTET_STRING.h | 2 +- lib/asn1/constr_CHOICE.c | 2 +- lib/asn1/constr_CHOICE.h | 2 +- lib/asn1/constr_SEQUENCE.c | 2 +- lib/asn1/constr_SEQUENCE.h | 2 +- lib/asn1/constr_TYPE.h | 14 +++++++------- lib/asn1/per_opentype.c | 4 ++-- lib/asn1/per_support.h | 4 ++-- lib/asn1_skeletons/INTEGER.h | 2 +- lib/asn1_skeletons/NativeReal.h | 2 +- lib/asn1_skeletons/OCTET_STRING.h | 2 +- lib/asn1_skeletons/constr_CHOICE.c | 2 +- lib/asn1_skeletons/constr_CHOICE.h | 2 +- lib/asn1_skeletons/constr_SEQUENCE.c | 2 +- lib/asn1_skeletons/constr_SEQUENCE.h | 2 +- lib/asn1_skeletons/constr_SET.h | 2 +- lib/asn1_skeletons/constr_SET_OF.h | 2 +- lib/asn1_skeletons/constr_TYPE.h | 14 +++++++------- lib/asn1_skeletons/per_opentype.c | 4 ++-- lib/asn1_skeletons/per_support.h | 4 ++-- 21 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/asn1/INTEGER.h b/lib/asn1/INTEGER.h index f03a858..d080b46 100644 --- a/lib/asn1/INTEGER.h +++ b/lib/asn1/INTEGER.h @@ -25,7 +25,7 @@ typedef struct asn_INTEGER_enum_map_s { } asn_INTEGER_enum_map_t; /* This type describes an enumeration for INTEGER and ENUMERATED types */ -typedef const struct asn_INTEGER_specifics_s { +typedef struct asn_INTEGER_specifics_s { const asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ const unsigned int *enum2value; /* "tag" => N; sorted by tag */ int map_count; /* Elements in either map */ diff --git a/lib/asn1/OCTET_STRING.h b/lib/asn1/OCTET_STRING.h index f16c99f..458408e 100644 --- a/lib/asn1/OCTET_STRING.h +++ b/lib/asn1/OCTET_STRING.h @@ -73,7 +73,7 @@ OCTET_STRING_t *OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td, * Internally useful stuff. * ****************************/ -typedef const struct asn_OCTET_STRING_specifics_s { +typedef struct asn_OCTET_STRING_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1/constr_CHOICE.c b/lib/asn1/constr_CHOICE.c index f5c34f1..6e64b93 100644 --- a/lib/asn1/constr_CHOICE.c +++ b/lib/asn1/constr_CHOICE.c @@ -190,7 +190,7 @@ CHOICE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, do { const asn_TYPE_tag2member_t *t2m; - struct asn_TYPE_tag2member_s key; + asn_TYPE_tag2member_t key; key.el_tag = tlv_tag; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, diff --git a/lib/asn1/constr_CHOICE.h b/lib/asn1/constr_CHOICE.h index 5e1fb7a..7649480 100644 --- a/lib/asn1/constr_CHOICE.h +++ b/lib/asn1/constr_CHOICE.h @@ -11,7 +11,7 @@ extern "C" { #endif -typedef const struct asn_CHOICE_specifics_s { +typedef struct asn_CHOICE_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1/constr_SEQUENCE.c b/lib/asn1/constr_SEQUENCE.c index b1ad061..c750898 100644 --- a/lib/asn1/constr_SEQUENCE.c +++ b/lib/asn1/constr_SEQUENCE.c @@ -304,7 +304,7 @@ SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, * sorted array of tags. */ const asn_TYPE_tag2member_t *t2m; - struct asn_TYPE_tag2member_s key = {0, 0, 0, 0}; + asn_TYPE_tag2member_t key = {0, 0, 0, 0}; key.el_tag = tlv_tag; key.el_no = edx; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, diff --git a/lib/asn1/constr_SEQUENCE.h b/lib/asn1/constr_SEQUENCE.h index 161d11f..f9dd4e5 100644 --- a/lib/asn1/constr_SEQUENCE.h +++ b/lib/asn1/constr_SEQUENCE.h @@ -11,7 +11,7 @@ extern "C" { #endif -typedef const struct asn_SEQUENCE_specifics_s { +typedef struct asn_SEQUENCE_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1/constr_TYPE.h b/lib/asn1/constr_TYPE.h index 6793b29..10bb0f3 100644 --- a/lib/asn1/constr_TYPE.h +++ b/lib/asn1/constr_TYPE.h @@ -141,7 +141,7 @@ typedef asn_type_selector_result_t(asn_type_selector_f)( * Generalized functions for dealing with the speciic type. * May be directly invoked by applications. */ -typedef const struct asn_TYPE_operation_s { +typedef struct asn_TYPE_operation_s { asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_struct_compare_f *compare_struct; /* Compare two structures */ @@ -169,7 +169,7 @@ typedef struct asn_encoding_constraints_s { /* * The definitive description of the destination language's structure. */ -typedef const struct asn_TYPE_descriptor_s { +typedef struct asn_TYPE_descriptor_s { const char *name; /* A name of the ASN.1 type. "" in some cases. */ const char *xml_tag; /* Name used in XML tag */ @@ -177,7 +177,7 @@ typedef const struct asn_TYPE_descriptor_s { * Generalized functions for dealing with the specific type. * May be directly invoked by applications. */ - const asn_TYPE_operation_t *op; + asn_TYPE_operation_t *op; /*********************************************************************** * Internally useful members. Not to be used by applications directly. * @@ -197,7 +197,7 @@ typedef const struct asn_TYPE_descriptor_s { /* * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). */ - const struct asn_TYPE_member_s *elements; + struct asn_TYPE_member_s *elements; unsigned elements_count; /* @@ -217,13 +217,13 @@ typedef const struct asn_TYPE_descriptor_s { ATF_OPEN_TYPE = 0x02, /* Open Type */ ATF_ANY_TYPE = 0x04 /* ANY type (deprecated!) */ }; -typedef const struct asn_TYPE_member_s { +typedef struct asn_TYPE_member_s { enum asn_TYPE_flags_e flags; /* Element's presentation flags */ unsigned optional; /* Following optional members, including current */ unsigned memb_offset; /* Offset of the element */ ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ - const asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ asn_type_selector_f *type_selector; /* IoS runtime type selector */ asn_encoding_constraints_t encoding_constraints; int (*default_value_cmp)(const void *sptr); /* Compare DEFAULT */ @@ -234,7 +234,7 @@ typedef const struct asn_TYPE_member_s { /* * BER tag to element number mapping. */ -typedef const struct asn_TYPE_tag2member_s { +typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ unsigned el_no; /* Index of the associated member, base 0 */ int toff_first; /* First occurence of the el_tag, relative */ diff --git a/lib/asn1/per_opentype.c b/lib/asn1/per_opentype.c index 99fe0fc..f86dad7 100644 --- a/lib/asn1/per_opentype.c +++ b/lib/asn1/per_opentype.c @@ -265,8 +265,8 @@ uper_open_type_get(const asn_codec_ctx_t *ctx, const asn_TYPE_descriptor_t *td, int uper_open_type_skip(const asn_codec_ctx_t *ctx, asn_per_data_t *pd) { - struct asn_TYPE_descriptor_s s_td = {0}; - struct asn_TYPE_operation_s s_op = {0}; + asn_TYPE_descriptor_t s_td; + asn_TYPE_operation_t s_op; asn_dec_rval_t rv; s_td.name = ""; diff --git a/lib/asn1/per_support.h b/lib/asn1/per_support.h index a421919..3e905a8 100644 --- a/lib/asn1/per_support.h +++ b/lib/asn1/per_support.h @@ -15,7 +15,7 @@ extern "C" { /* * Pre-computed PER constraints. */ -typedef const struct asn_per_constraint_s { +typedef struct asn_per_constraint_s { enum asn_per_constraint_flags { APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ @@ -27,7 +27,7 @@ typedef const struct asn_per_constraint_s { long lower_bound; /* "lb" value */ long upper_bound; /* "ub" value */ } asn_per_constraint_t; -typedef const struct asn_per_constraints_s { +typedef struct asn_per_constraints_s { asn_per_constraint_t value; asn_per_constraint_t size; int (*value2code)(unsigned int value); diff --git a/lib/asn1_skeletons/INTEGER.h b/lib/asn1_skeletons/INTEGER.h index f03a858..d080b46 100644 --- a/lib/asn1_skeletons/INTEGER.h +++ b/lib/asn1_skeletons/INTEGER.h @@ -25,7 +25,7 @@ typedef struct asn_INTEGER_enum_map_s { } asn_INTEGER_enum_map_t; /* This type describes an enumeration for INTEGER and ENUMERATED types */ -typedef const struct asn_INTEGER_specifics_s { +typedef struct asn_INTEGER_specifics_s { const asn_INTEGER_enum_map_t *value2enum; /* N -> "tag"; sorted by N */ const unsigned int *enum2value; /* "tag" => N; sorted by tag */ int map_count; /* Elements in either map */ diff --git a/lib/asn1_skeletons/NativeReal.h b/lib/asn1_skeletons/NativeReal.h index f279f1a..b6d16d6 100644 --- a/lib/asn1_skeletons/NativeReal.h +++ b/lib/asn1_skeletons/NativeReal.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef const struct asn_NativeReal_specifics_s { +typedef struct asn_NativeReal_specifics_s { unsigned float_size; /* sizeof(float) or sizeof(double) */ } asn_NativeReal_specifics_t; diff --git a/lib/asn1_skeletons/OCTET_STRING.h b/lib/asn1_skeletons/OCTET_STRING.h index f16c99f..458408e 100644 --- a/lib/asn1_skeletons/OCTET_STRING.h +++ b/lib/asn1_skeletons/OCTET_STRING.h @@ -73,7 +73,7 @@ OCTET_STRING_t *OCTET_STRING_new_fromBuf(const asn_TYPE_descriptor_t *td, * Internally useful stuff. * ****************************/ -typedef const struct asn_OCTET_STRING_specifics_s { +typedef struct asn_OCTET_STRING_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1_skeletons/constr_CHOICE.c b/lib/asn1_skeletons/constr_CHOICE.c index f5c34f1..6e64b93 100644 --- a/lib/asn1_skeletons/constr_CHOICE.c +++ b/lib/asn1_skeletons/constr_CHOICE.c @@ -190,7 +190,7 @@ CHOICE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, do { const asn_TYPE_tag2member_t *t2m; - struct asn_TYPE_tag2member_s key; + asn_TYPE_tag2member_t key; key.el_tag = tlv_tag; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, diff --git a/lib/asn1_skeletons/constr_CHOICE.h b/lib/asn1_skeletons/constr_CHOICE.h index 5e1fb7a..7649480 100644 --- a/lib/asn1_skeletons/constr_CHOICE.h +++ b/lib/asn1_skeletons/constr_CHOICE.h @@ -11,7 +11,7 @@ extern "C" { #endif -typedef const struct asn_CHOICE_specifics_s { +typedef struct asn_CHOICE_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1_skeletons/constr_SEQUENCE.c b/lib/asn1_skeletons/constr_SEQUENCE.c index b1ad061..c750898 100644 --- a/lib/asn1_skeletons/constr_SEQUENCE.c +++ b/lib/asn1_skeletons/constr_SEQUENCE.c @@ -304,7 +304,7 @@ SEQUENCE_decode_ber(const asn_codec_ctx_t *opt_codec_ctx, * sorted array of tags. */ const asn_TYPE_tag2member_t *t2m; - struct asn_TYPE_tag2member_s key = {0, 0, 0, 0}; + asn_TYPE_tag2member_t key = {0, 0, 0, 0}; key.el_tag = tlv_tag; key.el_no = edx; t2m = (const asn_TYPE_tag2member_t *)bsearch(&key, diff --git a/lib/asn1_skeletons/constr_SEQUENCE.h b/lib/asn1_skeletons/constr_SEQUENCE.h index 161d11f..f9dd4e5 100644 --- a/lib/asn1_skeletons/constr_SEQUENCE.h +++ b/lib/asn1_skeletons/constr_SEQUENCE.h @@ -11,7 +11,7 @@ extern "C" { #endif -typedef const struct asn_SEQUENCE_specifics_s { +typedef struct asn_SEQUENCE_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1_skeletons/constr_SET.h b/lib/asn1_skeletons/constr_SET.h index ee663a1..d64a00f 100644 --- a/lib/asn1_skeletons/constr_SET.h +++ b/lib/asn1_skeletons/constr_SET.h @@ -12,7 +12,7 @@ extern "C" { #endif -typedef const struct asn_SET_specifics_s { +typedef struct asn_SET_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1_skeletons/constr_SET_OF.h b/lib/asn1_skeletons/constr_SET_OF.h index 8992812..f32e607 100644 --- a/lib/asn1_skeletons/constr_SET_OF.h +++ b/lib/asn1_skeletons/constr_SET_OF.h @@ -11,7 +11,7 @@ extern "C" { #endif -typedef const struct asn_SET_OF_specifics_s { +typedef struct asn_SET_OF_specifics_s { /* * Target structure description. */ diff --git a/lib/asn1_skeletons/constr_TYPE.h b/lib/asn1_skeletons/constr_TYPE.h index 6793b29..10bb0f3 100644 --- a/lib/asn1_skeletons/constr_TYPE.h +++ b/lib/asn1_skeletons/constr_TYPE.h @@ -141,7 +141,7 @@ typedef asn_type_selector_result_t(asn_type_selector_f)( * Generalized functions for dealing with the speciic type. * May be directly invoked by applications. */ -typedef const struct asn_TYPE_operation_s { +typedef struct asn_TYPE_operation_s { asn_struct_free_f *free_struct; /* Free the structure */ asn_struct_print_f *print_struct; /* Human readable output */ asn_struct_compare_f *compare_struct; /* Compare two structures */ @@ -169,7 +169,7 @@ typedef struct asn_encoding_constraints_s { /* * The definitive description of the destination language's structure. */ -typedef const struct asn_TYPE_descriptor_s { +typedef struct asn_TYPE_descriptor_s { const char *name; /* A name of the ASN.1 type. "" in some cases. */ const char *xml_tag; /* Name used in XML tag */ @@ -177,7 +177,7 @@ typedef const struct asn_TYPE_descriptor_s { * Generalized functions for dealing with the specific type. * May be directly invoked by applications. */ - const asn_TYPE_operation_t *op; + asn_TYPE_operation_t *op; /*********************************************************************** * Internally useful members. Not to be used by applications directly. * @@ -197,7 +197,7 @@ typedef const struct asn_TYPE_descriptor_s { /* * An ASN.1 production type members (members of SEQUENCE, SET, CHOICE). */ - const struct asn_TYPE_member_s *elements; + struct asn_TYPE_member_s *elements; unsigned elements_count; /* @@ -217,13 +217,13 @@ typedef const struct asn_TYPE_descriptor_s { ATF_OPEN_TYPE = 0x02, /* Open Type */ ATF_ANY_TYPE = 0x04 /* ANY type (deprecated!) */ }; -typedef const struct asn_TYPE_member_s { +typedef struct asn_TYPE_member_s { enum asn_TYPE_flags_e flags; /* Element's presentation flags */ unsigned optional; /* Following optional members, including current */ unsigned memb_offset; /* Offset of the element */ ber_tlv_tag_t tag; /* Outmost (most immediate) tag */ int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */ - const asn_TYPE_descriptor_t *type; /* Member type descriptor */ + asn_TYPE_descriptor_t *type; /* Member type descriptor */ asn_type_selector_f *type_selector; /* IoS runtime type selector */ asn_encoding_constraints_t encoding_constraints; int (*default_value_cmp)(const void *sptr); /* Compare DEFAULT */ @@ -234,7 +234,7 @@ typedef const struct asn_TYPE_member_s { /* * BER tag to element number mapping. */ -typedef const struct asn_TYPE_tag2member_s { +typedef struct asn_TYPE_tag2member_s { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ unsigned el_no; /* Index of the associated member, base 0 */ int toff_first; /* First occurence of the el_tag, relative */ diff --git a/lib/asn1_skeletons/per_opentype.c b/lib/asn1_skeletons/per_opentype.c index 99fe0fc..f86dad7 100644 --- a/lib/asn1_skeletons/per_opentype.c +++ b/lib/asn1_skeletons/per_opentype.c @@ -265,8 +265,8 @@ uper_open_type_get(const asn_codec_ctx_t *ctx, const asn_TYPE_descriptor_t *td, int uper_open_type_skip(const asn_codec_ctx_t *ctx, asn_per_data_t *pd) { - struct asn_TYPE_descriptor_s s_td = {0}; - struct asn_TYPE_operation_s s_op = {0}; + asn_TYPE_descriptor_t s_td; + asn_TYPE_operation_t s_op; asn_dec_rval_t rv; s_td.name = ""; diff --git a/lib/asn1_skeletons/per_support.h b/lib/asn1_skeletons/per_support.h index a421919..3e905a8 100644 --- a/lib/asn1_skeletons/per_support.h +++ b/lib/asn1_skeletons/per_support.h @@ -15,7 +15,7 @@ extern "C" { /* * Pre-computed PER constraints. */ -typedef const struct asn_per_constraint_s { +typedef struct asn_per_constraint_s { enum asn_per_constraint_flags { APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */ APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */ @@ -27,7 +27,7 @@ typedef const struct asn_per_constraint_s { long lower_bound; /* "lb" value */ long upper_bound; /* "ub" value */ } asn_per_constraint_t; -typedef const struct asn_per_constraints_s { +typedef struct asn_per_constraints_s { asn_per_constraint_t value; asn_per_constraint_t size; int (*value2code)(unsigned int value);