summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/p5_pbev2.c
diff options
context:
space:
mode:
authorjsing <>2015-02-11 03:39:51 +0000
committerjsing <>2015-02-11 03:39:51 +0000
commitb07f4d1849544c2c966cb30d49bdb02358dc608d (patch)
treed942bf9cb3a1b441f2c996072292ae69b1aa83d2 /src/lib/libcrypto/asn1/p5_pbev2.c
parente816a1ec1d4411707051912b945e8eab7a5a94e8 (diff)
downloadopenbsd-b07f4d1849544c2c966cb30d49bdb02358dc608d.tar.gz
openbsd-b07f4d1849544c2c966cb30d49bdb02358dc608d.tar.bz2
openbsd-b07f4d1849544c2c966cb30d49bdb02358dc608d.zip
Expand most of the 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 the generated assembly only differs by changes to line numbers. Discussed with beck@ miod@ tedu@
Diffstat (limited to 'src/lib/libcrypto/asn1/p5_pbev2.c')
-rw-r--r--src/lib/libcrypto/asn1/p5_pbev2.c78
1 files changed, 67 insertions, 11 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c
index 1189e7e26b..f967f25d3d 100644
--- a/src/lib/libcrypto/asn1/p5_pbev2.c
+++ b/src/lib/libcrypto/asn1/p5_pbev2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p5_pbev2.c,v 1.19 2015/02/09 15:05:59 jsing Exp $ */ 1/* $OpenBSD: p5_pbev2.c,v 1.20 2015/02/11 03:39:51 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 1999-2004. 3 * project 1999-2004.
4 */ 4 */
@@ -66,10 +66,32 @@
66 66
67/* PKCS#5 v2.0 password based encryption structures */ 67/* PKCS#5 v2.0 password based encryption structures */
68 68
69ASN1_SEQUENCE(PBE2PARAM) = { 69static const ASN1_TEMPLATE PBE2PARAM_seq_tt[] = {
70 ASN1_SIMPLE(PBE2PARAM, keyfunc, X509_ALGOR), 70 {
71 ASN1_SIMPLE(PBE2PARAM, encryption, X509_ALGOR) 71 .flags = 0,
72} ASN1_SEQUENCE_END(PBE2PARAM) 72 .tag = 0,
73 .offset = offsetof(PBE2PARAM, keyfunc),
74 .field_name = "keyfunc",
75 .item = &X509_ALGOR_it,
76 },
77 {
78 .flags = 0,
79 .tag = 0,
80 .offset = offsetof(PBE2PARAM, encryption),
81 .field_name = "encryption",
82 .item = &X509_ALGOR_it,
83 },
84};
85
86const ASN1_ITEM PBE2PARAM_it = {
87 .itype = ASN1_ITYPE_SEQUENCE,
88 .utype = V_ASN1_SEQUENCE,
89 .templates = PBE2PARAM_seq_tt,
90 .tcount = sizeof(PBE2PARAM_seq_tt) / sizeof(ASN1_TEMPLATE),
91 .funcs = NULL,
92 .size = sizeof(PBE2PARAM),
93 .sname = "PBE2PARAM",
94};
73 95
74 96
75PBE2PARAM * 97PBE2PARAM *
@@ -97,12 +119,46 @@ PBE2PARAM_free(PBE2PARAM *a)
97 ASN1_item_free((ASN1_VALUE *)a, &PBE2PARAM_it); 119 ASN1_item_free((ASN1_VALUE *)a, &PBE2PARAM_it);
98} 120}
99 121
100ASN1_SEQUENCE(PBKDF2PARAM) = { 122static const ASN1_TEMPLATE PBKDF2PARAM_seq_tt[] = {
101 ASN1_SIMPLE(PBKDF2PARAM, salt, ASN1_ANY), 123 {
102 ASN1_SIMPLE(PBKDF2PARAM, iter, ASN1_INTEGER), 124 .flags = 0,
103 ASN1_OPT(PBKDF2PARAM, keylength, ASN1_INTEGER), 125 .tag = 0,
104 ASN1_OPT(PBKDF2PARAM, prf, X509_ALGOR) 126 .offset = offsetof(PBKDF2PARAM, salt),
105} ASN1_SEQUENCE_END(PBKDF2PARAM) 127 .field_name = "salt",
128 .item = &ASN1_ANY_it,
129 },
130 {
131 .flags = 0,
132 .tag = 0,
133 .offset = offsetof(PBKDF2PARAM, iter),
134 .field_name = "iter",
135 .item = &ASN1_INTEGER_it,
136 },
137 {
138 .flags = ASN1_TFLG_OPTIONAL,
139 .tag = 0,
140 .offset = offsetof(PBKDF2PARAM, keylength),
141 .field_name = "keylength",
142 .item = &ASN1_INTEGER_it,
143 },
144 {
145 .flags = ASN1_TFLG_OPTIONAL,
146 .tag = 0,
147 .offset = offsetof(PBKDF2PARAM, prf),
148 .field_name = "prf",
149 .item = &X509_ALGOR_it,
150 },
151};
152
153const ASN1_ITEM PBKDF2PARAM_it = {
154 .itype = ASN1_ITYPE_SEQUENCE,
155 .utype = V_ASN1_SEQUENCE,
156 .templates = PBKDF2PARAM_seq_tt,
157 .tcount = sizeof(PBKDF2PARAM_seq_tt) / sizeof(ASN1_TEMPLATE),
158 .funcs = NULL,
159 .size = sizeof(PBKDF2PARAM),
160 .sname = "PBKDF2PARAM",
161};
106 162
107 163
108PBKDF2PARAM * 164PBKDF2PARAM *