summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509v3/v3_genn.c
diff options
context:
space:
mode:
authorbeck <>2000-03-19 11:13:58 +0000
committerbeck <>2000-03-19 11:13:58 +0000
commit796d609550df3a33fc11468741c5d2f6d3df4c11 (patch)
tree6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/x509v3/v3_genn.c
parent5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff)
downloadopenbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_genn.c')
-rw-r--r--src/lib/libcrypto/x509v3/v3_genn.c70
1 files changed, 62 insertions, 8 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_genn.c b/src/lib/libcrypto/x509v3/v3_genn.c
index af716232f8..894afa7e03 100644
--- a/src/lib/libcrypto/x509v3/v3_genn.c
+++ b/src/lib/libcrypto/x509v3/v3_genn.c
@@ -88,12 +88,15 @@ int i2d_GENERAL_NAME(GENERAL_NAME *a, unsigned char **pp)
88 88
89 switch(a->type) { 89 switch(a->type) {
90 90
91 case GEN_OTHERNAME:
92 case GEN_X400: 91 case GEN_X400:
93 case GEN_EDIPARTY: 92 case GEN_EDIPARTY:
94 ret = i2d_ASN1_TYPE(a->d.other, pp); 93 ret = i2d_ASN1_TYPE(a->d.other, pp);
95 break; 94 break;
96 95
96 case GEN_OTHERNAME:
97 ret = i2d_OTHERNAME(a->d.otherName, pp);
98 break;
99
97 case GEN_EMAIL: 100 case GEN_EMAIL:
98 case GEN_DNS: 101 case GEN_DNS:
99 case GEN_URI: 102 case GEN_URI:
@@ -137,12 +140,15 @@ GENERAL_NAME *d2i_GENERAL_NAME(GENERAL_NAME **a, unsigned char **pp,
137 140
138 switch(ret->type) { 141 switch(ret->type) {
139 /* Just put these in a "blob" for now */ 142 /* Just put these in a "blob" for now */
140 case GEN_OTHERNAME:
141 case GEN_X400: 143 case GEN_X400:
142 case GEN_EDIPARTY: 144 case GEN_EDIPARTY:
143 M_ASN1_D2I_get_imp(ret->d.other, d2i_ASN1_TYPE,V_ASN1_SEQUENCE); 145 M_ASN1_D2I_get_imp(ret->d.other, d2i_ASN1_TYPE,V_ASN1_SEQUENCE);
144 break; 146 break;
145 147
148 case GEN_OTHERNAME:
149 M_ASN1_D2I_get_imp(ret->d.otherName, d2i_OTHERNAME,V_ASN1_SEQUENCE);
150 break;
151
146 case GEN_EMAIL: 152 case GEN_EMAIL:
147 case GEN_DNS: 153 case GEN_DNS:
148 case GEN_URI: 154 case GEN_URI:
@@ -176,17 +182,20 @@ void GENERAL_NAME_free(GENERAL_NAME *a)
176{ 182{
177 if (a == NULL) return; 183 if (a == NULL) return;
178 switch(a->type) { 184 switch(a->type) {
179 case GEN_OTHERNAME:
180 case GEN_X400: 185 case GEN_X400:
181 case GEN_EDIPARTY: 186 case GEN_EDIPARTY:
182 ASN1_TYPE_free(a->d.other); 187 ASN1_TYPE_free(a->d.other);
183 break; 188 break;
184 189
190 case GEN_OTHERNAME:
191 OTHERNAME_free(a->d.otherName);
192 break;
193
185 case GEN_EMAIL: 194 case GEN_EMAIL:
186 case GEN_DNS: 195 case GEN_DNS:
187 case GEN_URI: 196 case GEN_URI:
188 197
189 ASN1_IA5STRING_free(a->d.ia5); 198 M_ASN1_IA5STRING_free(a->d.ia5);
190 break; 199 break;
191 200
192 case GEN_DIRNAME: 201 case GEN_DIRNAME:
@@ -194,7 +203,7 @@ void GENERAL_NAME_free(GENERAL_NAME *a)
194 break; 203 break;
195 204
196 case GEN_IPADD: 205 case GEN_IPADD:
197 ASN1_OCTET_STRING_free(a->d.ip); 206 M_ASN1_OCTET_STRING_free(a->d.ip);
198 break; 207 break;
199 208
200 case GEN_RID: 209 case GEN_RID:
@@ -202,11 +211,11 @@ void GENERAL_NAME_free(GENERAL_NAME *a)
202 break; 211 break;
203 212
204 } 213 }
205 Free ((char *)a); 214 Free (a);
206} 215}
207 216
208/* Now the GeneralNames versions: a SEQUENCE OF GeneralName These are needed as 217/* Now the GeneralNames versions: a SEQUENCE OF GeneralName. These are needed as
209 * an explicit functions. 218 * explicit functions.
210 */ 219 */
211 220
212STACK_OF(GENERAL_NAME) *GENERAL_NAMES_new() 221STACK_OF(GENERAL_NAME) *GENERAL_NAMES_new()
@@ -235,3 +244,48 @@ return i2d_ASN1_SET_OF_GENERAL_NAME(a, pp, i2d_GENERAL_NAME, V_ASN1_SEQUENCE,
235IMPLEMENT_STACK_OF(GENERAL_NAME) 244IMPLEMENT_STACK_OF(GENERAL_NAME)
236IMPLEMENT_ASN1_SET_OF(GENERAL_NAME) 245IMPLEMENT_ASN1_SET_OF(GENERAL_NAME)
237 246
247int i2d_OTHERNAME(OTHERNAME *a, unsigned char **pp)
248{
249 int v = 0;
250 M_ASN1_I2D_vars(a);
251
252 M_ASN1_I2D_len(a->type_id, i2d_ASN1_OBJECT);
253 M_ASN1_I2D_len_EXP_opt(a->value, i2d_ASN1_TYPE, 0, v);
254
255 M_ASN1_I2D_seq_total();
256
257 M_ASN1_I2D_put(a->type_id, i2d_ASN1_OBJECT);
258 M_ASN1_I2D_put_EXP_opt(a->value, i2d_ASN1_TYPE, 0, v);
259
260 M_ASN1_I2D_finish();
261}
262
263OTHERNAME *OTHERNAME_new(void)
264{
265 OTHERNAME *ret=NULL;
266 ASN1_CTX c;
267 M_ASN1_New_Malloc(ret, OTHERNAME);
268 ret->type_id = OBJ_nid2obj(NID_undef);
269 M_ASN1_New(ret->value, ASN1_TYPE_new);
270 return (ret);
271 M_ASN1_New_Error(ASN1_F_OTHERNAME_NEW);
272}
273
274OTHERNAME *d2i_OTHERNAME(OTHERNAME **a, unsigned char **pp, long length)
275{
276 M_ASN1_D2I_vars(a,OTHERNAME *,OTHERNAME_new);
277 M_ASN1_D2I_Init();
278 M_ASN1_D2I_start_sequence();
279 M_ASN1_D2I_get(ret->type_id, d2i_ASN1_OBJECT);
280 M_ASN1_D2I_get_EXP_opt(ret->value, d2i_ASN1_TYPE, 0);
281 M_ASN1_D2I_Finish(a, OTHERNAME_free, ASN1_F_D2I_OTHERNAME);
282}
283
284void OTHERNAME_free(OTHERNAME *a)
285{
286 if (a == NULL) return;
287 ASN1_OBJECT_free(a->type_id);
288 ASN1_TYPE_free(a->value);
289 Free (a);
290}
291