diff options
author | jsing <> | 2021-12-25 08:52:44 +0000 |
---|---|---|
committer | jsing <> | 2021-12-25 08:52:44 +0000 |
commit | a1aa360082915390f4dce8cb202c7a908f0801d7 (patch) | |
tree | deb13cf3156e23b9aed2e7ab7fcc949a90f0b8a0 | |
parent | 9bcf656c985ee0377aa1efaa225459e511cda945 (diff) | |
download | openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.tar.gz openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.tar.bz2 openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.zip |
Consolidate code/templates for ASN.1 types.
Where an ASN.1 type has its own file, move the ASN.1 item template and
template related functions into the file.
Discussed with tb@
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 34 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_enum.c | 34 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_int.c | 33 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_object.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_octet.c | 35 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_type.c | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_typ.c | 164 |
7 files changed, 168 insertions, 168 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 207d80ab38..4ffafd5f86 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.32 2021/12/25 07:48:09 jsing Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.33 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -60,10 +60,29 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/asn1t.h> | ||
63 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
64 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
65 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
66 | 67 | ||
68 | const ASN1_ITEM ASN1_BIT_STRING_it = { | ||
69 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
70 | .utype = V_ASN1_BIT_STRING, | ||
71 | .sname = "ASN1_BIT_STRING", | ||
72 | }; | ||
73 | |||
74 | ASN1_BIT_STRING * | ||
75 | ASN1_BIT_STRING_new(void) | ||
76 | { | ||
77 | return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it); | ||
78 | } | ||
79 | |||
80 | void | ||
81 | ASN1_BIT_STRING_free(ASN1_BIT_STRING *a) | ||
82 | { | ||
83 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it); | ||
84 | } | ||
85 | |||
67 | int | 86 | int |
68 | ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) | 87 | ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) |
69 | { | 88 | { |
@@ -313,3 +332,16 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) | |||
313 | 332 | ||
314 | return (NULL); | 333 | return (NULL); |
315 | } | 334 | } |
335 | |||
336 | int | ||
337 | i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out) | ||
338 | { | ||
339 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it); | ||
340 | } | ||
341 | |||
342 | ASN1_BIT_STRING * | ||
343 | d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len) | ||
344 | { | ||
345 | return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
346 | &ASN1_BIT_STRING_it); | ||
347 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_enum.c b/src/lib/libcrypto/asn1/a_enum.c index e0e64f0a81..f48543ef3f 100644 --- a/src/lib/libcrypto/asn1/a_enum.c +++ b/src/lib/libcrypto/asn1/a_enum.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_enum.c,v 1.21 2021/12/15 18:00:31 jsing Exp $ */ | 1 | /* $OpenBSD: a_enum.c,v 1.22 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -60,6 +60,7 @@ | |||
60 | #include <stdio.h> | 60 | #include <stdio.h> |
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/asn1t.h> | ||
63 | #include <openssl/bn.h> | 64 | #include <openssl/bn.h> |
64 | #include <openssl/buffer.h> | 65 | #include <openssl/buffer.h> |
65 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
@@ -69,6 +70,24 @@ | |||
69 | * for comments on encoding see a_int.c | 70 | * for comments on encoding see a_int.c |
70 | */ | 71 | */ |
71 | 72 | ||
73 | const ASN1_ITEM ASN1_ENUMERATED_it = { | ||
74 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
75 | .utype = V_ASN1_ENUMERATED, | ||
76 | .sname = "ASN1_ENUMERATED", | ||
77 | }; | ||
78 | |||
79 | ASN1_ENUMERATED * | ||
80 | ASN1_ENUMERATED_new(void) | ||
81 | { | ||
82 | return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it); | ||
83 | } | ||
84 | |||
85 | void | ||
86 | ASN1_ENUMERATED_free(ASN1_ENUMERATED *a) | ||
87 | { | ||
88 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it); | ||
89 | } | ||
90 | |||
72 | int | 91 | int |
73 | ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) | 92 | ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v) |
74 | { | 93 | { |
@@ -320,3 +339,16 @@ err: | |||
320 | free(s); | 339 | free(s); |
321 | return (ret); | 340 | return (ret); |
322 | } | 341 | } |
342 | |||
343 | int | ||
344 | i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out) | ||
345 | { | ||
346 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it); | ||
347 | } | ||
348 | |||
349 | ASN1_ENUMERATED * | ||
350 | d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len) | ||
351 | { | ||
352 | return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
353 | &ASN1_ENUMERATED_it); | ||
354 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_int.c b/src/lib/libcrypto/asn1/a_int.c index 9218a17c11..eac7546eac 100644 --- a/src/lib/libcrypto/asn1/a_int.c +++ b/src/lib/libcrypto/asn1/a_int.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_int.c,v 1.36 2021/12/25 07:48:09 jsing Exp $ */ | 1 | /* $OpenBSD: a_int.c,v 1.37 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -61,10 +61,29 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | ||
64 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
65 | #include <openssl/buffer.h> | 66 | #include <openssl/buffer.h> |
66 | #include <openssl/err.h> | 67 | #include <openssl/err.h> |
67 | 68 | ||
69 | const ASN1_ITEM ASN1_INTEGER_it = { | ||
70 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
71 | .utype = V_ASN1_INTEGER, | ||
72 | .sname = "ASN1_INTEGER", | ||
73 | }; | ||
74 | |||
75 | ASN1_INTEGER * | ||
76 | ASN1_INTEGER_new(void) | ||
77 | { | ||
78 | return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it); | ||
79 | } | ||
80 | |||
81 | void | ||
82 | ASN1_INTEGER_free(ASN1_INTEGER *a) | ||
83 | { | ||
84 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it); | ||
85 | } | ||
86 | |||
68 | static int | 87 | static int |
69 | ASN1_INTEGER_valid(const ASN1_INTEGER *a) | 88 | ASN1_INTEGER_valid(const ASN1_INTEGER *a) |
70 | { | 89 | { |
@@ -567,6 +586,18 @@ err: | |||
567 | return (NULL); | 586 | return (NULL); |
568 | } | 587 | } |
569 | 588 | ||
589 | int | ||
590 | i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out) | ||
591 | { | ||
592 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it); | ||
593 | } | ||
594 | |||
595 | ASN1_INTEGER * | ||
596 | d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len) | ||
597 | { | ||
598 | return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
599 | &ASN1_INTEGER_it); | ||
600 | } | ||
570 | 601 | ||
571 | /* This is a version of d2i_ASN1_INTEGER that ignores the sign bit of | 602 | /* This is a version of d2i_ASN1_INTEGER that ignores the sign bit of |
572 | * ASN1 integers: some broken software can encode a positive INTEGER | 603 | * ASN1 integers: some broken software can encode a positive INTEGER |
diff --git a/src/lib/libcrypto/asn1/a_object.c b/src/lib/libcrypto/asn1/a_object.c index cc4f5dd424..a029a12fd8 100644 --- a/src/lib/libcrypto/asn1/a_object.c +++ b/src/lib/libcrypto/asn1/a_object.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_object.c,v 1.34 2021/12/25 07:48:09 jsing Exp $ */ | 1 | /* $OpenBSD: a_object.c,v 1.35 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -61,11 +61,18 @@ | |||
61 | #include <string.h> | 61 | #include <string.h> |
62 | 62 | ||
63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
64 | #include <openssl/asn1t.h> | ||
64 | #include <openssl/bn.h> | 65 | #include <openssl/bn.h> |
65 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
66 | #include <openssl/buffer.h> | 67 | #include <openssl/buffer.h> |
67 | #include <openssl/objects.h> | 68 | #include <openssl/objects.h> |
68 | 69 | ||
70 | const ASN1_ITEM ASN1_OBJECT_it = { | ||
71 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
72 | .utype = V_ASN1_OBJECT, | ||
73 | .sname = "ASN1_OBJECT", | ||
74 | }; | ||
75 | |||
69 | ASN1_OBJECT * | 76 | ASN1_OBJECT * |
70 | ASN1_OBJECT_new(void) | 77 | ASN1_OBJECT_new(void) |
71 | { | 78 | { |
diff --git a/src/lib/libcrypto/asn1/a_octet.c b/src/lib/libcrypto/asn1/a_octet.c index d998675d3f..c1a25202c0 100644 --- a/src/lib/libcrypto/asn1/a_octet.c +++ b/src/lib/libcrypto/asn1/a_octet.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_octet.c,v 1.10 2015/07/29 14:58:34 jsing Exp $ */ | 1 | /* $OpenBSD: a_octet.c,v 1.11 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -59,6 +59,26 @@ | |||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | 60 | ||
61 | #include <openssl/asn1.h> | 61 | #include <openssl/asn1.h> |
62 | #include <openssl/asn1t.h> | ||
63 | |||
64 | const ASN1_ITEM ASN1_OCTET_STRING_it = { | ||
65 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
66 | .utype = V_ASN1_OCTET_STRING, | ||
67 | .sname = "ASN1_OCTET_STRING", | ||
68 | }; | ||
69 | |||
70 | ASN1_OCTET_STRING * | ||
71 | ASN1_OCTET_STRING_new(void) | ||
72 | { | ||
73 | return (ASN1_OCTET_STRING *)ASN1_item_new(&ASN1_OCTET_STRING_it); | ||
74 | } | ||
75 | |||
76 | void | ||
77 | ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a) | ||
78 | { | ||
79 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_OCTET_STRING_it); | ||
80 | } | ||
81 | |||
62 | 82 | ||
63 | ASN1_OCTET_STRING * | 83 | ASN1_OCTET_STRING * |
64 | ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) | 84 | ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) |
@@ -77,3 +97,16 @@ ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) | |||
77 | { | 97 | { |
78 | return ASN1_STRING_set(x, d, len); | 98 | return ASN1_STRING_set(x, d, len); |
79 | } | 99 | } |
100 | |||
101 | int | ||
102 | i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out) | ||
103 | { | ||
104 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_OCTET_STRING_it); | ||
105 | } | ||
106 | |||
107 | ASN1_OCTET_STRING * | ||
108 | d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len) | ||
109 | { | ||
110 | return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
111 | &ASN1_OCTET_STRING_it); | ||
112 | } | ||
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c index a18ffe66ba..23fa9f602c 100644 --- a/src/lib/libcrypto/asn1/a_type.c +++ b/src/lib/libcrypto/asn1/a_type.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_type.c,v 1.21 2019/10/24 16:36:10 jsing Exp $ */ | 1 | /* $OpenBSD: a_type.c,v 1.22 2021/12/25 08:52:44 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -61,6 +61,18 @@ | |||
61 | #include <openssl/asn1t.h> | 61 | #include <openssl/asn1t.h> |
62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
63 | 63 | ||
64 | ASN1_TYPE * | ||
65 | ASN1_TYPE_new(void) | ||
66 | { | ||
67 | return (ASN1_TYPE *)ASN1_item_new(&ASN1_ANY_it); | ||
68 | } | ||
69 | |||
70 | void | ||
71 | ASN1_TYPE_free(ASN1_TYPE *a) | ||
72 | { | ||
73 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_ANY_it); | ||
74 | } | ||
75 | |||
64 | int | 76 | int |
65 | ASN1_TYPE_get(const ASN1_TYPE *a) | 77 | ASN1_TYPE_get(const ASN1_TYPE *a) |
66 | { | 78 | { |
@@ -185,3 +197,16 @@ ASN1_TYPE_unpack_sequence(const ASN1_ITEM *it, const ASN1_TYPE *t) | |||
185 | return NULL; | 197 | return NULL; |
186 | return ASN1_item_unpack(t->value.sequence, it); | 198 | return ASN1_item_unpack(t->value.sequence, it); |
187 | } | 199 | } |
200 | |||
201 | int | ||
202 | i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out) | ||
203 | { | ||
204 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ANY_it); | ||
205 | } | ||
206 | |||
207 | ASN1_TYPE * | ||
208 | d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len) | ||
209 | { | ||
210 | return (ASN1_TYPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
211 | &ASN1_ANY_it); | ||
212 | } | ||
diff --git a/src/lib/libcrypto/asn1/tasn_typ.c b/src/lib/libcrypto/asn1/tasn_typ.c index 7a2b90f390..d35913b46e 100644 --- a/src/lib/libcrypto/asn1/tasn_typ.c +++ b/src/lib/libcrypto/asn1/tasn_typ.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_typ.c,v 1.15 2021/12/23 18:04:41 tb Exp $ */ | 1 | /* $OpenBSD: tasn_typ.c,v 1.16 2021/12/25 08:52:44 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 | */ |
@@ -61,134 +61,6 @@ | |||
61 | 61 | ||
62 | /* Declarations for string types */ | 62 | /* Declarations for string types */ |
63 | 63 | ||
64 | const ASN1_ITEM ASN1_INTEGER_it = { | ||
65 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
66 | .utype = V_ASN1_INTEGER, | ||
67 | .sname = "ASN1_INTEGER", | ||
68 | }; | ||
69 | |||
70 | ASN1_INTEGER * | ||
71 | d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len) | ||
72 | { | ||
73 | return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
74 | &ASN1_INTEGER_it); | ||
75 | } | ||
76 | |||
77 | int | ||
78 | i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out) | ||
79 | { | ||
80 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it); | ||
81 | } | ||
82 | |||
83 | ASN1_INTEGER * | ||
84 | ASN1_INTEGER_new(void) | ||
85 | { | ||
86 | return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it); | ||
87 | } | ||
88 | |||
89 | void | ||
90 | ASN1_INTEGER_free(ASN1_INTEGER *a) | ||
91 | { | ||
92 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it); | ||
93 | } | ||
94 | |||
95 | |||
96 | const ASN1_ITEM ASN1_ENUMERATED_it = { | ||
97 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
98 | .utype = V_ASN1_ENUMERATED, | ||
99 | .sname = "ASN1_ENUMERATED", | ||
100 | }; | ||
101 | |||
102 | ASN1_ENUMERATED * | ||
103 | d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len) | ||
104 | { | ||
105 | return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
106 | &ASN1_ENUMERATED_it); | ||
107 | } | ||
108 | |||
109 | int | ||
110 | i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out) | ||
111 | { | ||
112 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it); | ||
113 | } | ||
114 | |||
115 | ASN1_ENUMERATED * | ||
116 | ASN1_ENUMERATED_new(void) | ||
117 | { | ||
118 | return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it); | ||
119 | } | ||
120 | |||
121 | void | ||
122 | ASN1_ENUMERATED_free(ASN1_ENUMERATED *a) | ||
123 | { | ||
124 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it); | ||
125 | } | ||
126 | |||
127 | |||
128 | const ASN1_ITEM ASN1_BIT_STRING_it = { | ||
129 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
130 | .utype = V_ASN1_BIT_STRING, | ||
131 | .sname = "ASN1_BIT_STRING", | ||
132 | }; | ||
133 | |||
134 | ASN1_BIT_STRING * | ||
135 | d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len) | ||
136 | { | ||
137 | return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
138 | &ASN1_BIT_STRING_it); | ||
139 | } | ||
140 | |||
141 | int | ||
142 | i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out) | ||
143 | { | ||
144 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it); | ||
145 | } | ||
146 | |||
147 | ASN1_BIT_STRING * | ||
148 | ASN1_BIT_STRING_new(void) | ||
149 | { | ||
150 | return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it); | ||
151 | } | ||
152 | |||
153 | void | ||
154 | ASN1_BIT_STRING_free(ASN1_BIT_STRING *a) | ||
155 | { | ||
156 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it); | ||
157 | } | ||
158 | |||
159 | |||
160 | const ASN1_ITEM ASN1_OCTET_STRING_it = { | ||
161 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
162 | .utype = V_ASN1_OCTET_STRING, | ||
163 | .sname = "ASN1_OCTET_STRING", | ||
164 | }; | ||
165 | |||
166 | ASN1_OCTET_STRING * | ||
167 | d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len) | ||
168 | { | ||
169 | return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
170 | &ASN1_OCTET_STRING_it); | ||
171 | } | ||
172 | |||
173 | int | ||
174 | i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out) | ||
175 | { | ||
176 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_OCTET_STRING_it); | ||
177 | } | ||
178 | |||
179 | ASN1_OCTET_STRING * | ||
180 | ASN1_OCTET_STRING_new(void) | ||
181 | { | ||
182 | return (ASN1_OCTET_STRING *)ASN1_item_new(&ASN1_OCTET_STRING_it); | ||
183 | } | ||
184 | |||
185 | void | ||
186 | ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a) | ||
187 | { | ||
188 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_OCTET_STRING_it); | ||
189 | } | ||
190 | |||
191 | |||
192 | const ASN1_ITEM ASN1_NULL_it = { | 64 | const ASN1_ITEM ASN1_NULL_it = { |
193 | .itype = ASN1_ITYPE_PRIMITIVE, | 65 | .itype = ASN1_ITYPE_PRIMITIVE, |
194 | .utype = V_ASN1_NULL, | 66 | .utype = V_ASN1_NULL, |
@@ -221,13 +93,6 @@ ASN1_NULL_free(ASN1_NULL *a) | |||
221 | } | 93 | } |
222 | 94 | ||
223 | 95 | ||
224 | const ASN1_ITEM ASN1_OBJECT_it = { | ||
225 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
226 | .utype = V_ASN1_OBJECT, | ||
227 | .sname = "ASN1_OBJECT", | ||
228 | }; | ||
229 | |||
230 | |||
231 | const ASN1_ITEM ASN1_UTF8STRING_it = { | 96 | const ASN1_ITEM ASN1_UTF8STRING_it = { |
232 | .itype = ASN1_ITYPE_PRIMITIVE, | 97 | .itype = ASN1_ITYPE_PRIMITIVE, |
233 | .utype = V_ASN1_UTF8STRING, | 98 | .utype = V_ASN1_UTF8STRING, |
@@ -552,13 +417,13 @@ ASN1_BMPSTRING_free(ASN1_BMPSTRING *a) | |||
552 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_BMPSTRING_it); | 417 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_BMPSTRING_it); |
553 | } | 418 | } |
554 | 419 | ||
555 | |||
556 | const ASN1_ITEM ASN1_ANY_it = { | 420 | const ASN1_ITEM ASN1_ANY_it = { |
557 | .itype = ASN1_ITYPE_PRIMITIVE, | 421 | .itype = ASN1_ITYPE_PRIMITIVE, |
558 | .utype = V_ASN1_ANY, | 422 | .utype = V_ASN1_ANY, |
559 | .sname = "ASN1_ANY", | 423 | .sname = "ASN1_ANY", |
560 | }; | 424 | }; |
561 | 425 | ||
426 | |||
562 | /* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */ | 427 | /* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */ |
563 | 428 | ||
564 | const ASN1_ITEM ASN1_SEQUENCE_it = { | 429 | const ASN1_ITEM ASN1_SEQUENCE_it = { |
@@ -568,31 +433,6 @@ const ASN1_ITEM ASN1_SEQUENCE_it = { | |||
568 | }; | 433 | }; |
569 | 434 | ||
570 | 435 | ||
571 | ASN1_TYPE * | ||
572 | d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len) | ||
573 | { | ||
574 | return (ASN1_TYPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
575 | &ASN1_ANY_it); | ||
576 | } | ||
577 | |||
578 | int | ||
579 | i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out) | ||
580 | { | ||
581 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ANY_it); | ||
582 | } | ||
583 | |||
584 | ASN1_TYPE * | ||
585 | ASN1_TYPE_new(void) | ||
586 | { | ||
587 | return (ASN1_TYPE *)ASN1_item_new(&ASN1_ANY_it); | ||
588 | } | ||
589 | |||
590 | void | ||
591 | ASN1_TYPE_free(ASN1_TYPE *a) | ||
592 | { | ||
593 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_ANY_it); | ||
594 | } | ||
595 | |||
596 | /* Multistring types */ | 436 | /* Multistring types */ |
597 | 437 | ||
598 | 438 | ||