diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-14 14:56:46 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-14 14:56:46 +0000 |
commit | 2acffc0a85c1c2397ecb7e56b217b32b18c0146b (patch) | |
tree | 88eb692222ab9afb7527912217342abfbd9d481b | |
parent | e34a73a960593389bfa01e939665bdde95398e9a (diff) |
Expand ASN1_CHOICE*, ASN1_SEQUENCE* and associated macros, making the
data structures visible and easier to review, without having to wade
through layers and layers of asn1t.h macros.
Change has been scripted and there is no change to the generated assembly.
Discussed with beck@ miod@ tedu@
-rw-r--r-- | lib/libcrypto/asn1/x_attrib.c | 62 |
1 files changed, 53 insertions, 9 deletions
diff --git a/lib/libcrypto/asn1/x_attrib.c b/lib/libcrypto/asn1/x_attrib.c index 9c00906dedc..bb74a1b6c71 100644 --- a/lib/libcrypto/asn1/x_attrib.c +++ b/lib/libcrypto/asn1/x_attrib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_attrib.c,v 1.12 2015/02/10 05:25:45 jsing Exp $ */ +/* $OpenBSD: x_attrib.c,v 1.13 2015/02/14 14:56:45 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -82,16 +82,60 @@ * SET OF structure. */ -ASN1_CHOICE(X509_ATTRIBUTE_SET) = { - ASN1_SET_OF(X509_ATTRIBUTE, value.set, ASN1_ANY), - ASN1_SIMPLE(X509_ATTRIBUTE, value.single, ASN1_ANY) -} ASN1_CHOICE_END_selector(X509_ATTRIBUTE, X509_ATTRIBUTE_SET, single) +static const ASN1_TEMPLATE X509_ATTRIBUTE_SET_ch_tt[] = { + { + .flags = ASN1_TFLG_SET_OF, + .tag = 0, + .offset = offsetof(X509_ATTRIBUTE, value.set), + .field_name = "value.set", + .item = &ASN1_ANY_it, + }, + { + .flags = 0, + .tag = 0, + .offset = offsetof(X509_ATTRIBUTE, value.single), + .field_name = "value.single", + .item = &ASN1_ANY_it, + }, +}; -ASN1_SEQUENCE(X509_ATTRIBUTE) = { - ASN1_SIMPLE(X509_ATTRIBUTE, object, ASN1_OBJECT), +const ASN1_ITEM X509_ATTRIBUTE_SET_it = { + .itype = ASN1_ITYPE_CHOICE, + .utype = offsetof(X509_ATTRIBUTE, single), + .templates = X509_ATTRIBUTE_SET_ch_tt, + .tcount = sizeof(X509_ATTRIBUTE_SET_ch_tt) / sizeof(ASN1_TEMPLATE), + .funcs = NULL, + .size = sizeof(X509_ATTRIBUTE), + .sname = "X509_ATTRIBUTE", +}; + +static const ASN1_TEMPLATE X509_ATTRIBUTE_seq_tt[] = { + { + .flags = 0, + .tag = 0, + .offset = offsetof(X509_ATTRIBUTE, object), + .field_name = "object", + .item = &ASN1_OBJECT_it, + }, /* CHOICE type merged with parent */ - ASN1_EX_COMBINE(0, 0, X509_ATTRIBUTE_SET) -} ASN1_SEQUENCE_END(X509_ATTRIBUTE) + { + .flags = 0 | ASN1_TFLG_COMBINE, + .tag = 0, + .offset = 0, + .field_name = NULL, + .item = &X509_ATTRIBUTE_SET_it, + }, +}; + +const ASN1_ITEM X509_ATTRIBUTE_it = { + .itype = ASN1_ITYPE_SEQUENCE, + .utype = V_ASN1_SEQUENCE, + .templates = X509_ATTRIBUTE_seq_tt, + .tcount = sizeof(X509_ATTRIBUTE_seq_tt) / sizeof(ASN1_TEMPLATE), + .funcs = NULL, + .size = sizeof(X509_ATTRIBUTE), + .sname = "X509_ATTRIBUTE", +}; X509_ATTRIBUTE * |