| OLD | NEW |
| 1 /* crypto/asn1/a_dup.c */ | 1 /* crypto/asn1/a_dup.c */ |
| 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 * |
| 5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
| 6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
| 7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
| 8 * | 8 * |
| 9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
| 10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
| 56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include "cryptlib.h" | 60 #include "cryptlib.h" |
| 61 #include <openssl/asn1.h> | 61 #include <openssl/asn1.h> |
| 62 | 62 |
| 63 #ifndef NO_OLD_ASN1 | 63 #ifndef NO_OLD_ASN1 |
| 64 | 64 |
| 65 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x) | 65 void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x) |
| 66 { | 66 { |
| 67 unsigned char *b,*p; | 67 unsigned char *b,*p; |
| 68 const unsigned char *p2; | 68 const unsigned char *p2; |
| 69 int i; | 69 int i; |
| 70 char *ret; | 70 char *ret; |
| 71 | 71 |
| 72 if (x == NULL) return(NULL); | 72 if (x == NULL) return(NULL); |
| 73 | 73 |
| 74 i=i2d(x,NULL); | 74 i=i2d(x,NULL); |
| 75 b=OPENSSL_malloc(i+10); | 75 b=OPENSSL_malloc(i+10); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 100 if (x == NULL) return(NULL); | 100 if (x == NULL) return(NULL); |
| 101 | 101 |
| 102 i=ASN1_item_i2d(x,&b,it); | 102 i=ASN1_item_i2d(x,&b,it); |
| 103 if (b == NULL) | 103 if (b == NULL) |
| 104 { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NUL
L); } | 104 { ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NUL
L); } |
| 105 p= b; | 105 p= b; |
| 106 ret=ASN1_item_d2i(NULL,&p,i, it); | 106 ret=ASN1_item_d2i(NULL,&p,i, it); |
| 107 OPENSSL_free(b); | 107 OPENSSL_free(b); |
| 108 return(ret); | 108 return(ret); |
| 109 } | 109 } |
| OLD | NEW |