我试图将我的应用程序代码从OpenSSL 1.0.2移植到1.1.1,但遇到了我似乎无法理解的更改。
在1.0.2中,我们通过调用替换了bread
的默认bwrite
和BIO_s_socket
方法:
orig_bread = BIO_s_socket()->bread;
orig_bwrite = BIO_s_socket()->bwrite;
BIO_s_socket()->bread = my_bread;
BIO_s_socket()->bwrite = my_bwrite;
但是,在OpenSSL 1.1.1中,据说BIO_s_socket()
返回const BIO_METHOD*
而不是BIO_METHOD*
。如何更改此版本的默认行为?
编辑:(...如果再也不能做,如何为每个ssl连接设置面包和bwrite?)
答案 0 :(得分:0)
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
内的字符串的所有实例