OpenSSL BIO operation

Viewed 166

I have several questions about how Openssl works for which I cannot find an exact answer.

The messages received are decrypted by calling BIO_write () or calling SSL_read ()? Both functions are needed, but when does OpenSSL do the job?

Is it possible to put several different messages in the BIO without calling SSL_read() or is this a risk of a bug?

Is it possible without using a lock to use the SSL_write / BIO_read functions from one thread and SSL_read / BIO_write on another thread using the same connection (of course not the same bio)?

To be clearer on what I want to do. I would like to have my IO thread which puts the encrypted messages in a buffer and another thread which will decrypt them (when the worker is ready so the buffer can contain several different messages).

There might be one thread that decrypts a message while another is encrypting a message (to send it). Two threads will never do the same on the same connection. There can be one read and one write, but never 2 reads or 2 writes. Is a lock via mutex necessary? Is it risky to do that?

The goal is to have my IO thread that maximizes IO doing as little work as possible while taking advantage of multithreading for efficient message processing.

It is for experimental purposes.

0 Answers
Related