diff options
author | beck <> | 1999-09-29 04:37:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 04:37:45 +0000 |
commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/asn1/a_bytes.c | |
parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bytes.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bytes.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/src/lib/libcrypto/asn1/a_bytes.c b/src/lib/libcrypto/asn1/a_bytes.c index 14168d61ad..e452e03b88 100644 --- a/src/lib/libcrypto/asn1/a_bytes.c +++ b/src/lib/libcrypto/asn1/a_bytes.c | |||
@@ -58,38 +58,24 @@ | |||
58 | 58 | ||
59 | #include <stdio.h> | 59 | #include <stdio.h> |
60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
61 | #include "asn1_mac.h" | 61 | #include <openssl/asn1_mac.h> |
62 | |||
63 | /* ASN1err(ASN1_F_ASN1_TYPE_NEW,ASN1_R_ERROR_STACK); | ||
64 | * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_ERROR_STACK); | ||
65 | * ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,ASN1_R_WRONG_TYPE); | ||
66 | * ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,ASN1_R_WRONG_TAG); | ||
67 | */ | ||
68 | 62 | ||
69 | static unsigned long tag2bit[32]={ | 63 | static unsigned long tag2bit[32]={ |
70 | 0, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ | 64 | 0, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ |
71 | B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ | 65 | B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ |
72 | B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ | 66 | B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ |
73 | B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 12-15 */ | 67 | B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */ |
74 | 0, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, | 68 | 0, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, |
75 | B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0, | 69 | B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0, |
76 | 0,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, | 70 | 0,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, |
77 | B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, | 71 | B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, |
78 | }; | 72 | }; |
79 | 73 | ||
80 | #ifndef NOPROTO | ||
81 | static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c); | 74 | static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c); |
82 | #else | 75 | /* type is a 'bitmap' of acceptable string types. |
83 | static int asn1_collate_primative(); | ||
84 | #endif | ||
85 | |||
86 | /* type is a 'bitmap' of acceptable string types to be accepted. | ||
87 | */ | 76 | */ |
88 | ASN1_STRING *d2i_ASN1_type_bytes(a, pp, length, type) | 77 | ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp, |
89 | ASN1_STRING **a; | 78 | long length, int type) |
90 | unsigned char **pp; | ||
91 | long length; | ||
92 | int type; | ||
93 | { | 79 | { |
94 | ASN1_STRING *ret=NULL; | 80 | ASN1_STRING *ret=NULL; |
95 | unsigned char *p,*s; | 81 | unsigned char *p,*s; |
@@ -152,11 +138,7 @@ err: | |||
152 | return(NULL); | 138 | return(NULL); |
153 | } | 139 | } |
154 | 140 | ||
155 | int i2d_ASN1_bytes(a, pp, tag, xclass) | 141 | int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass) |
156 | ASN1_STRING *a; | ||
157 | unsigned char **pp; | ||
158 | int tag; | ||
159 | int xclass; | ||
160 | { | 142 | { |
161 | int ret,r,constructed; | 143 | int ret,r,constructed; |
162 | unsigned char *p; | 144 | unsigned char *p; |
@@ -182,12 +164,8 @@ int xclass; | |||
182 | return(r); | 164 | return(r); |
183 | } | 165 | } |
184 | 166 | ||
185 | ASN1_STRING *d2i_ASN1_bytes(a, pp, length, Ptag, Pclass) | 167 | ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length, |
186 | ASN1_STRING **a; | 168 | int Ptag, int Pclass) |
187 | unsigned char **pp; | ||
188 | long length; | ||
189 | int Ptag; | ||
190 | int Pclass; | ||
191 | { | 169 | { |
192 | ASN1_STRING *ret=NULL; | 170 | ASN1_STRING *ret=NULL; |
193 | unsigned char *p,*s; | 171 | unsigned char *p,*s; |
@@ -279,9 +257,7 @@ err: | |||
279 | * them into the one struture that is then returned */ | 257 | * them into the one struture that is then returned */ |
280 | /* There have been a few bug fixes for this function from | 258 | /* There have been a few bug fixes for this function from |
281 | * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ | 259 | * Paul Keogh <paul.keogh@sse.ie>, many thanks to him */ |
282 | static int asn1_collate_primative(a,c) | 260 | static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c) |
283 | ASN1_STRING *a; | ||
284 | ASN1_CTX *c; | ||
285 | { | 261 | { |
286 | ASN1_STRING *os=NULL; | 262 | ASN1_STRING *os=NULL; |
287 | BUF_MEM b; | 263 | BUF_MEM b; |
@@ -338,7 +314,7 @@ ASN1_CTX *c; | |||
338 | if (os != NULL) ASN1_STRING_free(os); | 314 | if (os != NULL) ASN1_STRING_free(os); |
339 | return(1); | 315 | return(1); |
340 | err: | 316 | err: |
341 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMATIVE,c->error); | 317 | ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error); |
342 | if (os != NULL) ASN1_STRING_free(os); | 318 | if (os != NULL) ASN1_STRING_free(os); |
343 | if (b.data != NULL) Free(b.data); | 319 | if (b.data != NULL) Free(b.data); |
344 | return(0); | 320 | return(0); |