开发者

OpenSSL Bio chains: Clarrification on documentation

The documentation for Openssl memory BIO sinks is here.

I am creating a BIO chain to turn binary strings into base64 strings. The source/sink is always a memory location, and this enables me to just keep the same chain arround. However the data (should) go into a memory buffer managed by OpenSSL when I write to it, and it should come from a user supplied memory buffer when read from the chain.

BIO_set_mem_buf() is the function used to set a user supplied buffer, and I will set the BIO_NOCLOSE property as I manage my memory using new. Now in order to use the same chain for writing I need to change the memory bio into managing its own memory. My question is: " Will BIO_reset() change it back to managing its own memory after a user has 开发者_StackOverflowsupplied a custom buffer ? Are there any performance consequences of using a single chain for what I want to do ?"


I'm not sure to get you right but here is how I usually proceed with OpenSSL:

I consider OpenSSL's BIO structures to be some kind of opaque streams.

Whatever data I have to pass to (or get from) OpenSSL, it is usually stored in a custom data structure of my own, then copied to/from an OpenSSL BIO for processing.

As you stated, the documentation of OpenSSL is not really clear on some points. Since we cannot reasonably make an assumption of its internal behavior, I believe this way of doing things to be safer.

However, in case you need high performance and want to avoid the useless copy (this would be legitimate), you better ask the OpenSSL Users mailing-list. Their answers will be acurate and I believe that only them can answer things which aren't precisely described into the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜