I'm trying to port my application code from OpenSSL 1.0.2 to 1.1.1 and I came across a change I can't seem to understand.
In 1.0.2 we have replaced the default bread
and bwrite
methods of BIO_s_socket
by calling:
orig_bread = BIO_s_socket()->bread;
orig_bwrite = BIO_s_socket()->bwrite;
BIO_s_socket()->bread = my_bread;
BIO_s_socket()->bwrite = my_bwrite;
However, in OpenSSL 1.1.1 BIO_s_socket()
is said to return const BIO_METHOD*
instead of BIO_METHOD*
. How can I change the default behavior in this version?
Edit: (...and if can't do it anymore, how do I set a bread and bwrite per ssl connection?)
I'm trying to port my application code from OpenSSL 1.0.2 to 1.1.0
Firstly I recommend you move to 1.1.1 not 1.1.0. 1.1.1 is a Long Term Support version (LTS) and will be supported until 2023. 1.1.0 support ends later this year.
You need to create a custom BIO_METHOD. In brief you create one using BIO_meth_new()
and then set custom read and write functions using BIO_meth_set_read()
and BIO_meth_set_write()
. Depending on what your BIO_METHOD does you may need to call other set functions. They are all documented here:
https://www.openssl.org/docs/man1.1.1/man3/BIO_meth_new.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.