Hello openssl-users,

I'm facing difficulties implementing a rather common behavior of a
client/server application using BIO chains.

Basically, all I want is to send several strings through the chain
from the client to the server, e.g. for authentication purposes.

On both the client and server side I have prepared the BIOs, and
chained them accordingly:
----------------------------------------------
    c = BIO_new(BIO_f_cipher());
    s = BIO_new(BIO_s_socket());
    BIO_set_fd(s, fd, BIO_NOCLOSE);
    BIO_set_cipher(c, cipher_type, key, iv, 1);
    s = BIO_push(c, s);
----------------------------------------------

The things are OK when I transmit a single string trough the chain.

Client:
----------------------------------------------
i1 = BIO_write(s, some_text, strlen(some_text));
----------------------------------------------

Server:
----------------------------------------------
j = BIO_read(s, buff, sizeof(buff));
----------------------------------------------

However I am forced to flush the BIO chain after writing the data, on
the client side, in order, to get valid data on the other end(server).
I guess this is something related to EVP_EncryptFinal, which must be
called to validate crypted data.

From this moment, if I transmit other data from client, using the same
chain, I will not be able on the server side to read the both strings.
----------------------------------------------
i2 = BIO_write(s, other_text, strlen(other_text));
----------------------------------------------


I don't know why this is happening. It looks to me that I must
include some other BIO in the chain. Anyway I need your help to
understand this strange behaviour, and to design a solution.



-- 
Best regards,
Alexandru Ciobanu                        mailto:[EMAIL PROTECTED]

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

Reply via email to