diff options
Diffstat (limited to 'src/lib/libcrypto/asn1')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1t.h | 350 |
1 files changed, 195 insertions, 155 deletions
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h index 655e01ab6a..da66858a1f 100644 --- a/src/lib/libcrypto/asn1/asn1t.h +++ b/src/lib/libcrypto/asn1/asn1t.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1t.h,v 1.26 2026/01/09 03:34:30 tb Exp $ */ | 1 | /* $OpenBSD: asn1t.h,v 1.27 2026/01/09 03:46:44 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -78,44 +78,44 @@ extern "C" { | |||
| 78 | 78 | ||
| 79 | /* Macros for start and end of ASN1_ITEM definition */ | 79 | /* Macros for start and end of ASN1_ITEM definition */ |
| 80 | 80 | ||
| 81 | #define ASN1_ITEM_start(itname) \ | 81 | #define ASN1_ITEM_start(itname) \ |
| 82 | const ASN1_ITEM itname##_it = { | 82 | const ASN1_ITEM itname##_it = { |
| 83 | 83 | ||
| 84 | #define static_ASN1_ITEM_start(itname) \ | 84 | #define static_ASN1_ITEM_start(itname) \ |
| 85 | static const ASN1_ITEM itname##_it = { | 85 | static const ASN1_ITEM itname##_it = { |
| 86 | 86 | ||
| 87 | #define ASN1_ITEM_end(itname) \ | 87 | #define ASN1_ITEM_end(itname) \ |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | /* Macros to aid ASN1 template writing */ | 92 | /* Macros to aid ASN1 template writing */ |
| 93 | 93 | ||
| 94 | #define ASN1_ITEM_TEMPLATE(tname) \ | 94 | #define ASN1_ITEM_TEMPLATE(tname) \ |
| 95 | static const ASN1_TEMPLATE tname##_item_tt | 95 | static const ASN1_TEMPLATE tname##_item_tt |
| 96 | 96 | ||
| 97 | #define ASN1_ITEM_TEMPLATE_END(tname) \ | 97 | #define ASN1_ITEM_TEMPLATE_END(tname) \ |
| 98 | ;\ | 98 | ; \ |
| 99 | ASN1_ITEM_start(tname) \ | 99 | ASN1_ITEM_start(tname) \ |
| 100 | ASN1_ITYPE_PRIMITIVE,\ | 100 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 101 | -1,\ | 101 | .utype = -1, \ |
| 102 | &tname##_item_tt,\ | 102 | .templates = &tname##_item_tt, \ |
| 103 | 0,\ | 103 | .tcount = 0, \ |
| 104 | NULL,\ | 104 | .funcs = NULL, \ |
| 105 | 0,\ | 105 | .size = 0, \ |
| 106 | #tname \ | 106 | .sname = #tname, \ |
| 107 | ASN1_ITEM_end(tname) | 107 | ASN1_ITEM_end(tname) |
| 108 | 108 | ||
| 109 | #define static_ASN1_ITEM_TEMPLATE_END(tname) \ | 109 | #define static_ASN1_ITEM_TEMPLATE_END(tname) \ |
| 110 | ;\ | 110 | ; \ |
| 111 | static_ASN1_ITEM_start(tname) \ | 111 | static_ASN1_ITEM_start(tname) \ |
| 112 | ASN1_ITYPE_PRIMITIVE,\ | 112 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 113 | -1,\ | 113 | .utype = -1, \ |
| 114 | &tname##_item_tt,\ | 114 | .templates = &tname##_item_tt, \ |
| 115 | 0,\ | 115 | .tcount = 0, \ |
| 116 | NULL,\ | 116 | .funcs = NULL, \ |
| 117 | 0,\ | 117 | .size = 0, \ |
| 118 | #tname \ | 118 | .sname = #tname, \ |
| 119 | ASN1_ITEM_end(tname) | 119 | ASN1_ITEM_end(tname) |
| 120 | 120 | ||
| 121 | 121 | ||
| @@ -142,77 +142,98 @@ extern "C" { | |||
| 142 | * a structure called stname. | 142 | * a structure called stname. |
| 143 | */ | 143 | */ |
| 144 | 144 | ||
| 145 | #define ASN1_SEQUENCE(tname) \ | 145 | #define ASN1_SEQUENCE(tname) \ |
| 146 | static const ASN1_TEMPLATE tname##_seq_tt[] | 146 | static const ASN1_TEMPLATE tname##_seq_tt[] |
| 147 | 147 | ||
| 148 | #define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) | 148 | #define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname) |
| 149 | 149 | ||
| 150 | #define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) | 150 | #define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname) |
| 151 | 151 | ||
| 152 | #define ASN1_SEQUENCE_END_name(stname, tname) \ | 152 | #define ASN1_SEQUENCE_END_name(stname, tname) \ |
| 153 | ;\ | 153 | ; \ |
| 154 | ASN1_ITEM_start(tname) \ | 154 | ASN1_ITEM_start(tname) \ |
| 155 | ASN1_ITYPE_SEQUENCE,\ | 155 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 156 | V_ASN1_SEQUENCE,\ | 156 | .utype = V_ASN1_SEQUENCE, \ |
| 157 | tname##_seq_tt,\ | 157 | .templates = tname##_seq_tt, \ |
| 158 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 158 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 159 | NULL,\ | 159 | .funcs = NULL, \ |
| 160 | sizeof(stname),\ | 160 | .size = sizeof(stname), \ |
| 161 | #stname \ | 161 | .sname = #stname, \ |
| 162 | ASN1_ITEM_end(tname) | 162 | ASN1_ITEM_end(tname) |
| 163 | 163 | ||
| 164 | #define static_ASN1_SEQUENCE_END_name(stname, tname) \ | 164 | #define static_ASN1_SEQUENCE_END_name(stname, tname) \ |
| 165 | ;\ | 165 | ; \ |
| 166 | static_ASN1_ITEM_start(tname) \ | 166 | static_ASN1_ITEM_start(tname) \ |
| 167 | ASN1_ITYPE_SEQUENCE,\ | 167 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 168 | V_ASN1_SEQUENCE,\ | 168 | .utype = V_ASN1_SEQUENCE, \ |
| 169 | tname##_seq_tt,\ | 169 | .templates = tname##_seq_tt, \ |
| 170 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 170 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 171 | NULL,\ | 171 | .funcs = NULL, \ |
| 172 | sizeof(stname),\ | 172 | .size = sizeof(stname), \ |
| 173 | #stname \ | 173 | .sname = #stname, \ |
| 174 | ASN1_ITEM_end(tname) | 174 | ASN1_ITEM_end(tname) |
| 175 | 175 | ||
| 176 | #define ASN1_NDEF_SEQUENCE(tname) \ | 176 | #define ASN1_NDEF_SEQUENCE(tname) \ |
| 177 | ASN1_SEQUENCE(tname) | 177 | ASN1_SEQUENCE(tname) |
| 178 | 178 | ||
| 179 | #define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ | 179 | #define ASN1_NDEF_SEQUENCE_cb(tname, cb) \ |
| 180 | ASN1_SEQUENCE_cb(tname, cb) | 180 | ASN1_SEQUENCE_cb(tname, cb) |
| 181 | 181 | ||
| 182 | #define ASN1_SEQUENCE_cb(tname, cb) \ | 182 | #define ASN1_SEQUENCE_cb(tname, cb) \ |
| 183 | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ | 183 | static const ASN1_AUX tname##_aux = { \ |
| 184 | .app_data = NULL, \ | ||
| 185 | .flags = 0, \ | ||
| 186 | .ref_offset = 0, \ | ||
| 187 | .ref_lock = 0, \ | ||
| 188 | .asn1_cb = cb, \ | ||
| 189 | .enc_offset = 0, \ | ||
| 190 | }; \ | ||
| 184 | ASN1_SEQUENCE(tname) | 191 | ASN1_SEQUENCE(tname) |
| 185 | 192 | ||
| 186 | #define ASN1_SEQUENCE_ref(tname, cb, lck) \ | 193 | #define ASN1_SEQUENCE_ref(tname, cb, lck) \ |
| 187 | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \ | 194 | static const ASN1_AUX tname##_aux = { \ |
| 195 | .app_data = NULL, \ | ||
| 196 | .flags = ASN1_AFLG_REFCOUNT, \ | ||
| 197 | .ref_offset = offsetof(tname, references), \ | ||
| 198 | .ref_lock = lck, \ | ||
| 199 | .asn1_cb = cb, \ | ||
| 200 | .enc_offset = 0, \ | ||
| 201 | }; \ | ||
| 188 | ASN1_SEQUENCE(tname) | 202 | ASN1_SEQUENCE(tname) |
| 189 | 203 | ||
| 190 | #define ASN1_SEQUENCE_enc(tname, enc, cb) \ | 204 | #define ASN1_SEQUENCE_enc(tname, enc, cb) \ |
| 191 | static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \ | 205 | static const ASN1_AUX tname##_aux = { \ |
| 206 | .app_data = NULL, \ | ||
| 207 | .flags = ASN1_AFLG_ENCODING, \ | ||
| 208 | .ref_offset = 0, \ | ||
| 209 | .ref_lock = 0, \ | ||
| 210 | .asn1_cb = cb, \ | ||
| 211 | .enc_offset = offsetof(tname, enc), \ | ||
| 212 | }; \ | ||
| 192 | ASN1_SEQUENCE(tname) | 213 | ASN1_SEQUENCE(tname) |
| 193 | 214 | ||
| 194 | #define ASN1_NDEF_SEQUENCE_END(tname) \ | 215 | #define ASN1_NDEF_SEQUENCE_END(tname) \ |
| 195 | ;\ | 216 | ; \ |
| 196 | ASN1_ITEM_start(tname) \ | 217 | ASN1_ITEM_start(tname) \ |
| 197 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 218 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 198 | V_ASN1_SEQUENCE,\ | 219 | .utype = V_ASN1_SEQUENCE, \ |
| 199 | tname##_seq_tt,\ | 220 | .templates = tname##_seq_tt, \ |
| 200 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 221 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 201 | NULL,\ | 222 | .funcs = NULL, \ |
| 202 | sizeof(tname),\ | 223 | .size = sizeof(tname), \ |
| 203 | #tname \ | 224 | .sname = #tname, \ |
| 204 | ASN1_ITEM_end(tname) | 225 | ASN1_ITEM_end(tname) |
| 205 | 226 | ||
| 206 | #define static_ASN1_NDEF_SEQUENCE_END(tname) \ | 227 | #define static_ASN1_NDEF_SEQUENCE_END(tname) \ |
| 207 | ;\ | 228 | ; \ |
| 208 | static_ASN1_ITEM_start(tname) \ | 229 | static_ASN1_ITEM_start(tname) \ |
| 209 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 230 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 210 | V_ASN1_SEQUENCE,\ | 231 | .utype = V_ASN1_SEQUENCE, \ |
| 211 | tname##_seq_tt,\ | 232 | .templates = tname##_seq_tt, \ |
| 212 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 233 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 213 | NULL,\ | 234 | .funcs = NULL, \ |
| 214 | sizeof(tname),\ | 235 | .size = sizeof(tname), \ |
| 215 | #tname \ | 236 | .sname = #tname, \ |
| 216 | ASN1_ITEM_end(tname) | 237 | ASN1_ITEM_end(tname) |
| 217 | 238 | ||
| 218 | #define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) | 239 | #define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname) |
| @@ -221,40 +242,40 @@ extern "C" { | |||
| 221 | 242 | ||
| 222 | #define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) | 243 | #define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname) |
| 223 | 244 | ||
| 224 | #define ASN1_SEQUENCE_END_ref(stname, tname) \ | 245 | #define ASN1_SEQUENCE_END_ref(stname, tname) \ |
| 225 | ;\ | 246 | ; \ |
| 226 | ASN1_ITEM_start(tname) \ | 247 | ASN1_ITEM_start(tname) \ |
| 227 | ASN1_ITYPE_SEQUENCE,\ | 248 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 228 | V_ASN1_SEQUENCE,\ | 249 | .utype = V_ASN1_SEQUENCE, \ |
| 229 | tname##_seq_tt,\ | 250 | .templates = tname##_seq_tt, \ |
| 230 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 251 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 231 | &tname##_aux,\ | 252 | .funcs = &tname##_aux, \ |
| 232 | sizeof(stname),\ | 253 | .size = sizeof(stname), \ |
| 233 | #stname \ | 254 | .sname = #stname, \ |
| 234 | ASN1_ITEM_end(tname) | 255 | ASN1_ITEM_end(tname) |
| 235 | 256 | ||
| 236 | #define static_ASN1_SEQUENCE_END_ref(stname, tname) \ | 257 | #define static_ASN1_SEQUENCE_END_ref(stname, tname) \ |
| 237 | ;\ | 258 | ; \ |
| 238 | static_ASN1_ITEM_start(tname) \ | 259 | static_ASN1_ITEM_start(tname) \ |
| 239 | ASN1_ITYPE_SEQUENCE,\ | 260 | .itype = ASN1_ITYPE_SEQUENCE, \ |
| 240 | V_ASN1_SEQUENCE,\ | 261 | .utype = V_ASN1_SEQUENCE, \ |
| 241 | tname##_seq_tt,\ | 262 | .templates = tname##_seq_tt, \ |
| 242 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 263 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 243 | &tname##_aux,\ | 264 | .funcs = &tname##_aux, \ |
| 244 | sizeof(stname),\ | 265 | .size = sizeof(stname), \ |
| 245 | #stname \ | 266 | .sname = #stname, \ |
| 246 | ASN1_ITEM_end(tname) | 267 | ASN1_ITEM_end(tname) |
| 247 | 268 | ||
| 248 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ | 269 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ |
| 249 | ;\ | 270 | ; \ |
| 250 | ASN1_ITEM_start(tname) \ | 271 | ASN1_ITEM_start(tname) \ |
| 251 | ASN1_ITYPE_NDEF_SEQUENCE,\ | 272 | .itype = ASN1_ITYPE_NDEF_SEQUENCE, \ |
| 252 | V_ASN1_SEQUENCE,\ | 273 | .utype = V_ASN1_SEQUENCE, \ |
| 253 | tname##_seq_tt,\ | 274 | .templates = tname##_seq_tt, \ |
| 254 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | 275 | .tcount = sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ |
| 255 | &tname##_aux,\ | 276 | .funcs = &tname##_aux, \ |
| 256 | sizeof(stname),\ | 277 | .size = sizeof(stname), \ |
| 257 | #stname \ | 278 | .sname = #stname, \ |
| 258 | ASN1_ITEM_end(tname) | 279 | ASN1_ITEM_end(tname) |
| 259 | 280 | ||
| 260 | 281 | ||
| @@ -281,11 +302,18 @@ extern "C" { | |||
| 281 | * ASN1_CHOICE_END_selector() version. | 302 | * ASN1_CHOICE_END_selector() version. |
| 282 | */ | 303 | */ |
| 283 | 304 | ||
| 284 | #define ASN1_CHOICE(tname) \ | 305 | #define ASN1_CHOICE(tname) \ |
| 285 | static const ASN1_TEMPLATE tname##_ch_tt[] | 306 | static const ASN1_TEMPLATE tname##_ch_tt[] |
| 286 | 307 | ||
| 287 | #define ASN1_CHOICE_cb(tname, cb) \ | 308 | #define ASN1_CHOICE_cb(tname, cb) \ |
| 288 | static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \ | 309 | static const ASN1_AUX tname##_aux = { \ |
| 310 | .app_data = NULL, \ | ||
| 311 | .flags = 0, \ | ||
| 312 | .ref_offset = 0, \ | ||
| 313 | .ref_lock = 0, \ | ||
| 314 | .asn1_cb = cb, \ | ||
| 315 | .enc_offset = 0, \ | ||
| 316 | }; \ | ||
| 289 | ASN1_CHOICE(tname) | 317 | ASN1_CHOICE(tname) |
| 290 | 318 | ||
| 291 | #define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) | 319 | #define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname) |
| @@ -296,40 +324,40 @@ extern "C" { | |||
| 296 | 324 | ||
| 297 | #define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) | 325 | #define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type) |
| 298 | 326 | ||
| 299 | #define ASN1_CHOICE_END_selector(stname, tname, selname) \ | 327 | #define ASN1_CHOICE_END_selector(stname, tname, selname) \ |
| 300 | ;\ | 328 | ; \ |
| 301 | ASN1_ITEM_start(tname) \ | 329 | ASN1_ITEM_start(tname) \ |
| 302 | ASN1_ITYPE_CHOICE,\ | 330 | .itype = ASN1_ITYPE_CHOICE, \ |
| 303 | offsetof(stname,selname) ,\ | 331 | .utype = offsetof(stname,selname), \ |
| 304 | tname##_ch_tt,\ | 332 | .templates = tname##_ch_tt, \ |
| 305 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 333 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 306 | NULL,\ | 334 | .funcs = NULL, \ |
| 307 | sizeof(stname),\ | 335 | .size = sizeof(stname), \ |
| 308 | #stname \ | 336 | .sname = #stname, \ |
| 309 | ASN1_ITEM_end(tname) | 337 | ASN1_ITEM_end(tname) |
| 310 | 338 | ||
| 311 | #define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ | 339 | #define static_ASN1_CHOICE_END_selector(stname, tname, selname) \ |
| 312 | ;\ | 340 | ; \ |
| 313 | static_ASN1_ITEM_start(tname) \ | 341 | static_ASN1_ITEM_start(tname) \ |
| 314 | ASN1_ITYPE_CHOICE,\ | 342 | .itype = ASN1_ITYPE_CHOICE, \ |
| 315 | offsetof(stname,selname) ,\ | 343 | .utype = offsetof(stname,selname), \ |
| 316 | tname##_ch_tt,\ | 344 | .templates = tname##_ch_tt, \ |
| 317 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 345 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 318 | NULL,\ | 346 | .funcs = NULL, \ |
| 319 | sizeof(stname),\ | 347 | .size = sizeof(stname), \ |
| 320 | #stname \ | 348 | .sname = #stname, \ |
| 321 | ASN1_ITEM_end(tname) | 349 | ASN1_ITEM_end(tname) |
| 322 | 350 | ||
| 323 | #define ASN1_CHOICE_END_cb(stname, tname, selname) \ | 351 | #define ASN1_CHOICE_END_cb(stname, tname, selname) \ |
| 324 | ;\ | 352 | ; \ |
| 325 | ASN1_ITEM_start(tname) \ | 353 | ASN1_ITEM_start(tname) \ |
| 326 | ASN1_ITYPE_CHOICE,\ | 354 | .itype = ASN1_ITYPE_CHOICE, \ |
| 327 | offsetof(stname,selname) ,\ | 355 | .utype = offsetof(stname,selname), \ |
| 328 | tname##_ch_tt,\ | 356 | .templates = tname##_ch_tt, \ |
| 329 | sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ | 357 | .tcount = sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\ |
| 330 | &tname##_aux,\ | 358 | .funcs = &tname##_aux, \ |
| 331 | sizeof(stname),\ | 359 | .size = sizeof(stname), \ |
| 332 | #stname \ | 360 | .sname = #stname, \ |
| 333 | ASN1_ITEM_end(tname) | 361 | ASN1_ITEM_end(tname) |
| 334 | 362 | ||
| 335 | /* This helps with the template wrapper form of ASN1_ITEM */ | 363 | /* This helps with the template wrapper form of ASN1_ITEM */ |
| @@ -760,25 +788,37 @@ typedef struct ASN1_STREAM_ARG_st { | |||
| 760 | 788 | ||
| 761 | /* Macro to implement a primitive type */ | 789 | /* Macro to implement a primitive type */ |
| 762 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) | 790 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) |
| 763 | #define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ | 791 | #define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \ |
| 764 | ASN1_ITEM_start(itname) \ | 792 | ASN1_ITEM_start(itname) \ |
| 765 | ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \ | 793 | .itype = ASN1_ITYPE_PRIMITIVE, \ |
| 766 | ASN1_ITEM_end(itname) | 794 | .utype = V_##vname, \ |
| 795 | .templates = NULL, \ | ||
| 796 | .tcount = 0, \ | ||
| 797 | .funcs = NULL, \ | ||
| 798 | .size = ex, \ | ||
| 799 | .sname = #itname, \ | ||
| 800 | ASN1_ITEM_end(itname) | ||
| 767 | 801 | ||
| 768 | /* Macro to implement a multi string type */ | 802 | /* Macro to implement a multi string type */ |
| 769 | #define IMPLEMENT_ASN1_MSTRING(itname, mask) \ | 803 | #define IMPLEMENT_ASN1_MSTRING(itname, mask) \ |
| 770 | ASN1_ITEM_start(itname) \ | 804 | ASN1_ITEM_start(itname) \ |
| 771 | ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \ | 805 | .itype = ASN1_ITYPE_MSTRING, \ |
| 772 | ASN1_ITEM_end(itname) | 806 | .utype = mask, \ |
| 773 | #define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ | 807 | .templates = NULL, \ |
| 774 | ASN1_ITEM_start(sname) \ | 808 | .tcount = 0, \ |
| 775 | ASN1_ITYPE_EXTERN, \ | 809 | .funcs = NULL, \ |
| 776 | tag, \ | 810 | .size = sizeof(ASN1_STRING), \ |
| 777 | NULL, \ | 811 | .sname = #itname, \ |
| 778 | 0, \ | 812 | ASN1_ITEM_end(itname) |
| 779 | &fptrs, \ | 813 | #define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \ |
| 780 | 0, \ | 814 | ASN1_ITEM_start(sname) \ |
| 781 | #sname \ | 815 | .itype = ASN1_ITYPE_EXTERN, \ |
| 816 | .utype = tag, \ | ||
| 817 | .templates = NULL, \ | ||
| 818 | .tcount = 0, \ | ||
| 819 | .funcs = &fptrs, \ | ||
| 820 | .size = 0, \ | ||
| 821 | .sname = #sname, \ | ||
| 782 | ASN1_ITEM_end(sname) | 822 | ASN1_ITEM_end(sname) |
| 783 | 823 | ||
| 784 | /* Macro to implement standard functions in terms of ASN1_ITEM structures */ | 824 | /* Macro to implement standard functions in terms of ASN1_ITEM structures */ |
