summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh
diff options
context:
space:
mode:
authorjsing <>2015-02-14 15:06:55 +0000
committerjsing <>2015-02-14 15:06:55 +0000
commit50c0f75baaf19556bde13d9ac8eeac270daa913b (patch)
tree93d9f5d18362f93abc7e5fc8236fd6b1b970e861 /src/lib/libcrypto/dh
parentc387e24e94fef92558fef5076ed87a7b41608800 (diff)
downloadopenbsd-50c0f75baaf19556bde13d9ac8eeac270daa913b.tar.gz
openbsd-50c0f75baaf19556bde13d9ac8eeac270daa913b.tar.bz2
openbsd-50c0f75baaf19556bde13d9ac8eeac270daa913b.zip
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 'src/lib/libcrypto/dh')
-rw-r--r--src/lib/libcrypto/dh/dh_asn1.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/lib/libcrypto/dh/dh_asn1.c b/src/lib/libcrypto/dh/dh_asn1.c
index 9d76974659..7060130ed8 100644
--- a/src/lib/libcrypto/dh/dh_asn1.c
+++ b/src/lib/libcrypto/dh/dh_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_asn1.c,v 1.7 2015/02/10 05:12:23 jsing Exp $ */ 1/* $OpenBSD: dh_asn1.c,v 1.8 2015/02/14 15:06:55 jsing 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 */
@@ -80,11 +80,47 @@ dh_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg)
80 return 1; 80 return 1;
81} 81}
82 82
83ASN1_SEQUENCE_cb(DHparams, dh_cb) = { 83static const ASN1_AUX DHparams_aux = {
84 ASN1_SIMPLE(DH, p, BIGNUM), 84 .app_data = NULL,
85 ASN1_SIMPLE(DH, g, BIGNUM), 85 .flags = 0,
86 ASN1_OPT(DH, length, ZLONG), 86 .ref_offset = 0,
87} ASN1_SEQUENCE_END_cb(DH, DHparams) 87 .ref_lock = 0,
88 .asn1_cb = dh_cb,
89 .enc_offset = 0,
90};
91static const ASN1_TEMPLATE DHparams_seq_tt[] = {
92 {
93 .flags = 0,
94 .tag = 0,
95 .offset = offsetof(DH, p),
96 .field_name = "p",
97 .item = &BIGNUM_it,
98 },
99 {
100 .flags = 0,
101 .tag = 0,
102 .offset = offsetof(DH, g),
103 .field_name = "g",
104 .item = &BIGNUM_it,
105 },
106 {
107 .flags = ASN1_TFLG_OPTIONAL,
108 .tag = 0,
109 .offset = offsetof(DH, length),
110 .field_name = "length",
111 .item = &ZLONG_it,
112 },
113};
114
115const ASN1_ITEM DHparams_it = {
116 .itype = ASN1_ITYPE_SEQUENCE,
117 .utype = V_ASN1_SEQUENCE,
118 .templates = DHparams_seq_tt,
119 .tcount = sizeof(DHparams_seq_tt) / sizeof(ASN1_TEMPLATE),
120 .funcs = &DHparams_aux,
121 .size = sizeof(DH),
122 .sname = "DH",
123};
88 124
89 125
90DH * 126DH *