Loading CHANGES +5 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,11 @@ Changes between 0.9.6 and 0.9.7 [xx XXX 2000] *) New functions or ASN1_item_d2i_fp() and ASN1_item_d2i_bio(). These replace the old function pointer based I/O routines. Change most of the *_d2i_bio() and *_d2i_fp() functions to use these. [Steve Henson] *) Enhance mkdef.pl to be more accepting about spacing in C preprocessor lines, recognice more "algorithms" that can be deselected, and make it complain about algorithm deselection that isn't recognised. Loading crypto/asn1/a_d2i_fp.c +62 −5 Original line number Diff line number Diff line Loading @@ -61,9 +61,11 @@ #include <openssl/buffer.h> #include <openssl/asn1_mac.h> #define HEADER_SIZE 8 static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb); #ifndef NO_OLD_ASN1 #ifndef NO_FP_API char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, unsigned char **x) { Loading @@ -85,10 +87,65 @@ char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, unsigned char **x) { BUF_MEM *b = NULL; unsigned char *p; char *ret=NULL; int len; len = asn1_d2i_read_bio(in, &b); if(len < 0) goto err; p=(unsigned char *)b->data; ret=d2i(x,&p,len); err: if (b != NULL) BUF_MEM_free(b); return(ret); } #endif void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x) { BUF_MEM *b = NULL; unsigned char *p; void *ret=NULL; int len; len = asn1_d2i_read_bio(in, &b); if(len < 0) goto err; p=(unsigned char *)b->data; ret=ASN1_item_d2i(x,&p,len, it); err: if (b != NULL) BUF_MEM_free(b); return(ret); } #ifndef NO_FP_API void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x) { BIO *b; char *ret; if ((b=BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_D2I_FP,ERR_R_BUF_LIB); return(NULL); } BIO_set_fp(b,in,BIO_NOCLOSE); ret=ASN1_item_d2i_bio(it,b,x); BIO_free(b); return(ret); } #endif #define HEADER_SIZE 8 static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) { BUF_MEM *b; unsigned char *p; int i; char *ret=NULL; int ret=-1; ASN1_CTX c; int want=HEADER_SIZE; int eos=0; Loading @@ -99,7 +156,7 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, if (b == NULL) { ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE); return(NULL); return -1; } ERR_clear_error(); Loading Loading @@ -187,8 +244,8 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, } } p=(unsigned char *)b->data; ret=d2i(x,&p,off); *pb = b; return off; err: if (b != NULL) BUF_MEM_free(b); return(ret); Loading crypto/asn1/a_i2d_fp.c +50 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ #include <openssl/buffer.h> #include <openssl/asn1.h> #ifndef NO_OLD_ASN1 #ifndef NO_FP_API int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x) { Loading Loading @@ -111,3 +113,51 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x) OPENSSL_free(b); return(ret); } #endif #ifndef NO_FP_API int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x) { BIO *b; int ret; if ((b=BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB); return(0); } BIO_set_fp(b,out,BIO_NOCLOSE); ret=ASN1_item_i2d_bio(it,b,x); BIO_free(b); return(ret); } #endif int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) { unsigned char *b = NULL; int i,j=0,n,ret=1; n = ASN1_item_i2d(x, &b, it); if (b == NULL) { ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); return(0); } for (;;) { i=BIO_write(out,&(b[j]),n); if (i == n) break; if (i <= 0) { ret=0; break; } j+=i; n-=i; } OPENSSL_free(b); return(ret); } crypto/asn1/asn1.h +4 −0 Original line number Diff line number Diff line Loading @@ -805,7 +805,9 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x); #ifndef NO_FP_API char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x); void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); #endif Loading @@ -813,7 +815,9 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); #ifndef NO_BIO char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); Loading crypto/asn1/asn_pack.c +4 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ #include "cryptlib.h" #include <openssl/asn1.h> #ifndef NO_ASN1_OLD /* ASN1 packing and unpacking functions */ /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ Loading Loading @@ -143,6 +145,8 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_STRING **oct) return octmp; } #endif /* ASN1_ITEM versions of the above */ ASN1_STRING *ASN1_pack_item(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) Loading Loading
CHANGES +5 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,11 @@ Changes between 0.9.6 and 0.9.7 [xx XXX 2000] *) New functions or ASN1_item_d2i_fp() and ASN1_item_d2i_bio(). These replace the old function pointer based I/O routines. Change most of the *_d2i_bio() and *_d2i_fp() functions to use these. [Steve Henson] *) Enhance mkdef.pl to be more accepting about spacing in C preprocessor lines, recognice more "algorithms" that can be deselected, and make it complain about algorithm deselection that isn't recognised. Loading
crypto/asn1/a_d2i_fp.c +62 −5 Original line number Diff line number Diff line Loading @@ -61,9 +61,11 @@ #include <openssl/buffer.h> #include <openssl/asn1_mac.h> #define HEADER_SIZE 8 static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb); #ifndef NO_OLD_ASN1 #ifndef NO_FP_API char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, unsigned char **x) { Loading @@ -85,10 +87,65 @@ char *ASN1_d2i_fp(char *(*xnew)(), char *(*d2i)(), FILE *in, char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, unsigned char **x) { BUF_MEM *b = NULL; unsigned char *p; char *ret=NULL; int len; len = asn1_d2i_read_bio(in, &b); if(len < 0) goto err; p=(unsigned char *)b->data; ret=d2i(x,&p,len); err: if (b != NULL) BUF_MEM_free(b); return(ret); } #endif void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x) { BUF_MEM *b = NULL; unsigned char *p; void *ret=NULL; int len; len = asn1_d2i_read_bio(in, &b); if(len < 0) goto err; p=(unsigned char *)b->data; ret=ASN1_item_d2i(x,&p,len, it); err: if (b != NULL) BUF_MEM_free(b); return(ret); } #ifndef NO_FP_API void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x) { BIO *b; char *ret; if ((b=BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_D2I_FP,ERR_R_BUF_LIB); return(NULL); } BIO_set_fp(b,in,BIO_NOCLOSE); ret=ASN1_item_d2i_bio(it,b,x); BIO_free(b); return(ret); } #endif #define HEADER_SIZE 8 static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) { BUF_MEM *b; unsigned char *p; int i; char *ret=NULL; int ret=-1; ASN1_CTX c; int want=HEADER_SIZE; int eos=0; Loading @@ -99,7 +156,7 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, if (b == NULL) { ASN1err(ASN1_F_ASN1_D2I_BIO,ERR_R_MALLOC_FAILURE); return(NULL); return -1; } ERR_clear_error(); Loading Loading @@ -187,8 +244,8 @@ char *ASN1_d2i_bio(char *(*xnew)(), char *(*d2i)(), BIO *in, } } p=(unsigned char *)b->data; ret=d2i(x,&p,off); *pb = b; return off; err: if (b != NULL) BUF_MEM_free(b); return(ret); Loading
crypto/asn1/a_i2d_fp.c +50 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,8 @@ #include <openssl/buffer.h> #include <openssl/asn1.h> #ifndef NO_OLD_ASN1 #ifndef NO_FP_API int ASN1_i2d_fp(int (*i2d)(), FILE *out, unsigned char *x) { Loading Loading @@ -111,3 +113,51 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x) OPENSSL_free(b); return(ret); } #endif #ifndef NO_FP_API int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x) { BIO *b; int ret; if ((b=BIO_new(BIO_s_file())) == NULL) { ASN1err(ASN1_F_ASN1_I2D_FP,ERR_R_BUF_LIB); return(0); } BIO_set_fp(b,out,BIO_NOCLOSE); ret=ASN1_item_i2d_bio(it,b,x); BIO_free(b); return(ret); } #endif int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x) { unsigned char *b = NULL; int i,j=0,n,ret=1; n = ASN1_item_i2d(x, &b, it); if (b == NULL) { ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE); return(0); } for (;;) { i=BIO_write(out,&(b[j]),n); if (i == n) break; if (i <= 0) { ret=0; break; } j+=i; n-=i; } OPENSSL_free(b); return(ret); }
crypto/asn1/asn1.h +4 −0 Original line number Diff line number Diff line Loading @@ -805,7 +805,9 @@ void *ASN1_item_dup(const ASN1_ITEM *it, void *x); #ifndef NO_FP_API char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x); void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x); int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); #endif Loading @@ -813,7 +815,9 @@ int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); #ifndef NO_BIO char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x); void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x); int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x); int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a); int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a); int ASN1_TIME_print(BIO *fp,ASN1_TIME *a); Loading
crypto/asn1/asn_pack.c +4 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ #include "cryptlib.h" #include <openssl/asn1.h> #ifndef NO_ASN1_OLD /* ASN1 packing and unpacking functions */ /* Turn an ASN1 encoded SEQUENCE OF into a STACK of structures */ Loading Loading @@ -143,6 +145,8 @@ ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_STRING **oct) return octmp; } #endif /* ASN1_ITEM versions of the above */ ASN1_STRING *ASN1_pack_item(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct) Loading