Deleted Added
full compact
a_bytes.c (59191) a_bytes.c (68651)
1/* crypto/asn1/a_bytes.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 97 unchanged lines hidden (view full) ---

106 {
107 if ((ret=ASN1_STRING_new()) == NULL) return(NULL);
108 }
109 else
110 ret=(*a);
111
112 if (len != 0)
113 {
1/* crypto/asn1/a_bytes.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *

--- 97 unchanged lines hidden (view full) ---

106 {
107 if ((ret=ASN1_STRING_new()) == NULL) return(NULL);
108 }
109 else
110 ret=(*a);
111
112 if (len != 0)
113 {
114 s=(unsigned char *)Malloc((int)len+1);
114 s=(unsigned char *)OPENSSL_malloc((int)len+1);
115 if (s == NULL)
116 {
117 i=ERR_R_MALLOC_FAILURE;
118 goto err;
119 }
120 memcpy(s,p,(int)len);
121 s[len]='\0';
122 p+=len;
123 }
124 else
125 s=NULL;
126
115 if (s == NULL)
116 {
117 i=ERR_R_MALLOC_FAILURE;
118 goto err;
119 }
120 memcpy(s,p,(int)len);
121 s[len]='\0';
122 p+=len;
123 }
124 else
125 s=NULL;
126
127 if (ret->data != NULL) Free(ret->data);
127 if (ret->data != NULL) OPENSSL_free(ret->data);
128 ret->length=(int)len;
129 ret->data=s;
130 ret->type=tag;
131 if (a != NULL) (*a)=ret;
132 *pp=p;
133 return(ret);
134err:
135 ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,i);

--- 77 unchanged lines hidden (view full) ---

213 }
214 }
215 else
216 {
217 if (len != 0)
218 {
219 if ((ret->length < len) || (ret->data == NULL))
220 {
128 ret->length=(int)len;
129 ret->data=s;
130 ret->type=tag;
131 if (a != NULL) (*a)=ret;
132 *pp=p;
133 return(ret);
134err:
135 ASN1err(ASN1_F_D2I_ASN1_TYPE_BYTES,i);

--- 77 unchanged lines hidden (view full) ---

213 }
214 }
215 else
216 {
217 if (len != 0)
218 {
219 if ((ret->length < len) || (ret->data == NULL))
220 {
221 if (ret->data != NULL) Free(ret->data);
222 s=(unsigned char *)Malloc((int)len + 1);
221 if (ret->data != NULL) OPENSSL_free(ret->data);
222 s=(unsigned char *)OPENSSL_malloc((int)len + 1);
223 if (s == NULL)
224 {
225 i=ERR_R_MALLOC_FAILURE;
226 goto err;
227 }
228 }
229 else
230 s=ret->data;
231 memcpy(s,p,(int)len);
232 s[len] = '\0';
233 p+=len;
234 }
235 else
236 {
237 s=NULL;
223 if (s == NULL)
224 {
225 i=ERR_R_MALLOC_FAILURE;
226 goto err;
227 }
228 }
229 else
230 s=ret->data;
231 memcpy(s,p,(int)len);
232 s[len] = '\0';
233 p+=len;
234 }
235 else
236 {
237 s=NULL;
238 if (ret->data != NULL) Free(ret->data);
238 if (ret->data != NULL) OPENSSL_free(ret->data);
239 }
240
241 ret->length=(int)len;
242 ret->data=s;
243 ret->type=Ptag;
244 }
245
246 if (a != NULL) (*a)=ret;

--- 58 unchanged lines hidden (view full) ---

305 if (!(c->inf & 1))
306 c->slen-=(c->p-c->q);
307 num+=os->length;
308 }
309
310 if (!asn1_Finish(c)) goto err;
311
312 a->length=num;
239 }
240
241 ret->length=(int)len;
242 ret->data=s;
243 ret->type=Ptag;
244 }
245
246 if (a != NULL) (*a)=ret;

--- 58 unchanged lines hidden (view full) ---

305 if (!(c->inf & 1))
306 c->slen-=(c->p-c->q);
307 num+=os->length;
308 }
309
310 if (!asn1_Finish(c)) goto err;
311
312 a->length=num;
313 if (a->data != NULL) Free(a->data);
313 if (a->data != NULL) OPENSSL_free(a->data);
314 a->data=(unsigned char *)b.data;
315 if (os != NULL) ASN1_STRING_free(os);
316 return(1);
317err:
318 ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
319 if (os != NULL) ASN1_STRING_free(os);
314 a->data=(unsigned char *)b.data;
315 if (os != NULL) ASN1_STRING_free(os);
316 return(1);
317err:
318 ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
319 if (os != NULL) ASN1_STRING_free(os);
320 if (b.data != NULL) Free(b.data);
320 if (b.data != NULL) OPENSSL_free(b.data);
321 return(0);
322 }
323
321 return(0);
322 }
323