[openssl-users] i2d_PKCS7_bio() very slow for large file when reading in memory

Jan Kohnert nospam001-lists at jankoh.mooo.com
Tue May 3 22:21:57 UTC 2016


Hi,

Am Freitag, 29. April 2016, 15:23:02 schrieb Dr. Stephen Henson:
> Memory BIOs can be very inefficient when they contain a lot of data and it
> is read in small chunks: each read copies the remaining data to the start
> of the memory block. If your message uses indefinite length encoding that
> could well happen.

I wasn't aware of that, thanks!
 
> If you read the data into a block of memory and call d2i_CMS_ContentInfo()
> on it you shouldn't get this problem. Alternatively if you have to use a
> memory BIO you can retrieve the pointer to the contained memory block using
> BIO_get_mem_data() and call d2i_CMS_ContentInfo() on the result.
> 
> A third option of to make the BIO read only and call d2i_CMS_bio() on that:
> read only memory BIOs are handled more efficiently.

I'll give your thoughts a shot! Thanks again, I'll post the results as soon as 
I'm able!

-- 
MfG Jan



More information about the openssl-users mailing list