Great! Thanks for your help.
Edson E. Watanabe
7COMm
Sao Paulo
Brazil

----- Original Message -----
From: "root" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 09, 2000 4:26 PM
Subject: Re: BIO Filter for compression


>
>
> "Edson E. Watanabe" wrote:
>
> > Did someone write a BIO filter for gzip/zlib compression/decompression?
> > Is it easy to write?
> > I think I could use crypto/evp/bio_b64.c as a starting point (writing a
> > BIO_f_gzip filter for compressing and a BIO_f_gunzip for expanding), but
I
> > want to know if are there any pitfalls in implementing or installing new
> > BIOs.
>
> Yes,its very easy. I wrote one "ZBIO" from gzio.c code in GNU ZLIB for my
> secure transfer of file server.You have to create a new BIO method and a
> function to return a pointer to that method when its requested.Then you
have
> to fill its pointer to function members with the gzread/gzwrite code in
ZLIB.
>
> In fact, its just an exercise because there are few things to add/modify.
>
> This is the new method context: (name of variables could be re-written
like
> in cipher bio or b64 bio...)
>
> typedef struct z_struct
> {
>  z_stream stream;  /* This is original ZLIB context */
>  char mode;
>  int z_err;
>  int z_eof;
>  uLong crc;
>  int transparent;
>  int first;
>  int level;
>  char *buf;
> } BIO_COMP_CTX;
>
> And this is the method
>
> #define BIO_TYPE_COMP  (12|0x0200)  /* filter */
>
> static BIO_METHOD methods_z=
> {
>  BIO_TYPE_COMP,"comp",
>  zbio_write, /* this is gzwrite() */
>  zbio_read,  /*gzread() */
>  NULL,
>  NULL,
>  zbio_ctrl, /* ctrl could set the compress level */
>  zbio_new,
>  zbio_free,
> };
>
> This is how I've called my bio:
>
> BIO_METHOD *BIO_f_comp(void)
> {
>  return(&methods_z);
> }
>
> I use this BIO at the botton of a B64 bio and a encryption BIO, without
> problems...
> I use the same BIO for compress and uncompress: if I call BIO_read it
> uncompresses and if I call BIO_wrie it compresses.
>
> Hope this helps
>
> Pablo J. Royo
>




__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to