Hi devs,
(excuse me I write for this still)
I found easy way for do it. I mean create concatenation BIOs.
pointers next_bio are used only for filters BIO. I concatenate BIOs through
this pointer.

modification:
bio_lib.c

BIO_read()
{
....
 i=b->method->bread(b,out,outl);
/* line 166: concatenate BIO start */
 if (!(BIO_method_type(b) & BIO_TYPE_FILTER)  /* no filter BIO */
  && (0 <= i)    /* no error */
  && (i < outl)    /* need more data */
  && b->next_bio)    /* next BIO exists */
 {
  i += BIO_read(b->next_bio, (char*)out+i, outl-i); /* recursive call next
BIO */
 }
/* concatenate BIO end */
....
}

similar correction is need in BIO_gets()


now can I easy use:
{
 BIO *b1 = BIO_new_file("data.txt", "rt");
 BIO *b2 = BIO_new_mem_buf("some short data",  15);
 BIO *b3 = BIO_new_file("data.txt", "rt");
 BIO *b4 = BIO_new_mem_buf("another data",  12);

 BIO *bout = BIO_new_file("data_out.txt", "wt");
 BIO_push(b1, b2);
 BIO_push(b1, b3);
 BIO_push(b1, b4);

 char buf[10];
 int len = 1;
 while (0 < (len = BIO_read(b1, buf, 10)))
  BIO_write(bout , buf, len);

 BIO_free_all(b1);
 BIO_free(bout);
}


Problems:
1. we can concatenate only non filter BIOs
2. we can not create general BIO structure, in some case filter bio don'
work correctlyt
Bfx - BIO filter
Bx - other BIO
a) B1 -> B2 -> B3 ... OK
Purpose: easy, without copy put one BIO into other function
Certificate in more files or memory put into e.g. PEM_X509_INFO_read_bio()

b) Bf1
    |
   B1 -> B2 -> B3 ... OK (but problem with Base64 bio, I think)
Purpose: e.g. count hash over BIOs

c) Bf1 -> B2
    |
    B1    ... FALSE (impossible to create)
Purpose: concatenate different type bio into one type
e.g.
Bf1 - base64
B1 - base64
B2 - ASN1

d) Bf1
    |
   B1 -> Bf2
          |
          B2  ... OK (but who use this?)
Purpose: like c) Bf1 count hash over B1(ASN1) and Bf2(B2(Base64))

Problems c) d) and partially b) may be resolve add into struct bio_st next
data as *concat_next_bio.
We need create new function for concatenate two BIOs as BIO_concatenate(BIO
*b1, BIO *b2);
We need correct BIO_reset() and other BIO_ctrl()


Please tell me, if is possible add this function into OpenSSL in next
versions. Who give impuls to add something into OpenSSL project?
Or how ease create patch for this?


Martin


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to