Optimized BIO mem read - without reallocation
authorKirill Marinushkin <k.marinushkin@gmail.com>
Sun, 13 Mar 2016 12:20:52 +0000 (13:20 +0100)
committerRich Salz <rsalz@openssl.org>
Sat, 2 Apr 2016 20:57:07 +0000 (16:57 -0400)
commit9fe9d0461ea4bcc42cd75a30f013fa61b5407b93
tree138059a58990939eba8e1f421dd17bd0a3ba79c6
parent6b888643105e37d340d509b98023b4779653c8a7
Optimized BIO mem read - without reallocation

Currently on every BIO mem read operation the remaining data is reallocated.
This commit solves the issue.
BIO mem structure includes additional pointer to the read position.
On every read the pointer moves instead of reallocating the memory for the remaining data.
Reallocation accures before write and some ioctl operations, if the read pointer doesn't point on the beginning of the buffer.
Also the flag is added to rewind the read pointer without losing the data.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/bio/bio_lcl.h
crypto/bio/bss_mem.c
doc/crypto/BIO_s_mem.pod
include/openssl/bio.h
include/openssl/ossl_typ.h