summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_bytes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bytes.c')
-rw-r--r--src/lib/libcrypto/asn1/a_bytes.c44
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
69static unsigned long tag2bit[32]={ 63static unsigned long tag2bit[32]={
700, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */ 640, 0, 0, B_ASN1_BIT_STRING, /* tags 0 - 3 */
71B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */ 65B_ASN1_OCTET_STRING, 0, 0, B_ASN1_UNKNOWN,/* tags 4- 7 */
72B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */ 66B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 8-11 */
73B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN, B_ASN1_UNKNOWN,/* tags 12-15 */ 67B_ASN1_UTF8STRING,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,B_ASN1_UNKNOWN,/* tags 12-15 */
740, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING, 680, 0, B_ASN1_NUMERICSTRING,B_ASN1_PRINTABLESTRING,
75B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0, 69B_ASN1_T61STRING,B_ASN1_VIDEOTEXSTRING,B_ASN1_IA5STRING,0,
760,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING, 700,B_ASN1_GRAPHICSTRING,B_ASN1_ISO64STRING,B_ASN1_GENERALSTRING,
77B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN, 71B_ASN1_UNIVERSALSTRING,B_ASN1_UNKNOWN,B_ASN1_BMPSTRING,B_ASN1_UNKNOWN,
78 }; 72 };
79 73
80#ifndef NOPROTO
81static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c); 74static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c);
82#else 75/* type is a 'bitmap' of acceptable string types.
83static int asn1_collate_primative();
84#endif
85
86/* type is a 'bitmap' of acceptable string types to be accepted.
87 */ 76 */
88ASN1_STRING *d2i_ASN1_type_bytes(a, pp, length, type) 77ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
89ASN1_STRING **a; 78 long length, int type)
90unsigned char **pp;
91long length;
92int 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
155int i2d_ASN1_bytes(a, pp, tag, xclass) 141int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass)
156ASN1_STRING *a;
157unsigned char **pp;
158int tag;
159int 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
185ASN1_STRING *d2i_ASN1_bytes(a, pp, length, Ptag, Pclass) 167ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
186ASN1_STRING **a; 168 int Ptag, int Pclass)
187unsigned char **pp;
188long length;
189int Ptag;
190int 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 */
282static int asn1_collate_primative(a,c) 260static int asn1_collate_primative(ASN1_STRING *a, ASN1_CTX *c)
283ASN1_STRING *a;
284ASN1_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);
340err: 316err:
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);