diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-14 15:06:56 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-14 15:06:56 +0000 |
commit | 30a48f07f231afbb13c863d4256e76c9cb127fa3 (patch) | |
tree | 1cd5a78aaaeaf768e5c3b1640632562120e3a842 /lib/libcrypto/dh | |
parent | 2acffc0a85c1c2397ecb7e56b217b32b18c0146b (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@
Diffstat (limited to 'lib/libcrypto/dh')
-rw-r--r-- | lib/libcrypto/dh/dh_asn1.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/lib/libcrypto/dh/dh_asn1.c b/lib/libcrypto/dh/dh_asn1.c index 9d769746595..7060130ed86 100644 --- a/lib/libcrypto/dh/dh_asn1.c +++ b/lib/libcrypto/dh/dh_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_asn1.c,v 1.7 2015/02/10 05:12:23 jsing Exp $ */ +/* $OpenBSD: dh_asn1.c,v 1.8 2015/02/14 15:06:55 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -80,11 +80,47 @@ dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) return 1; } -ASN1_SEQUENCE_cb(DHparams, dh_cb) = { - ASN1_SIMPLE(DH, p, BIGNUM), - ASN1_SIMPLE(DH, g, BIGNUM), - ASN1_OPT(DH, length, ZLONG), -} ASN1_SEQUENCE_END_cb(DH, DHparams) +static const ASN1_AUX DHparams_aux = { + .app_data = NULL, + .flags = 0, + .ref_offset = 0, + .ref_lock = 0, + .asn1_cb = dh_cb, + .enc_offset = 0, +}; +static const ASN1_TEMPLATE DHparams_seq_tt[] = { + { + .flags = 0, + .tag = 0, + .offset = offsetof(DH, p), + .field_name = "p", + .item = &BIGNUM_it, + }, + { + .flags = 0, + .tag = 0, + .offset = offsetof(DH, g), + .field_name = "g", + .item = &BIGNUM_it, + }, + { + .flags = ASN1_TFLG_OPTIONAL, + .tag = 0, + .offset = offsetof(DH, length), + .field_name = "length", + .item = &ZLONG_it, + }, +}; + +const ASN1_ITEM DHparams_it = { + .itype = ASN1_ITYPE_SEQUENCE, + .utype = V_ASN1_SEQUENCE, + .templates = DHparams_seq_tt, + .tcount = sizeof(DHparams_seq_tt) / sizeof(ASN1_TEMPLATE), + .funcs = &DHparams_aux, + .size = sizeof(DH), + .sname = "DH", +}; DH * |