aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKirill Marinushkin <k.marinushkin@gmail.com>2016-03-13 13:20:52 +0100
committerRich Salz <rsalz@openssl.org>2016-04-02 16:57:07 -0400
commit9fe9d0461ea4bcc42cd75a30f013fa61b5407b93 (patch)
tree138059a58990939eba8e1f421dd17bd0a3ba79c6 /include
parent6b888643105e37d340d509b98023b4779653c8a7 (diff)
downloadopenssl-9fe9d0461ea4bcc42cd75a30f013fa61b5407b93.tar.gz
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>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/bio.h6
-rw-r--r--include/openssl/ossl_typ.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index a32c2d3886..e0c6380883 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -216,10 +216,12 @@ extern "C" {
# define BIO_FLAGS_BASE64_NO_NL 0x100
/*
- * This is used with memory BIOs: it means we shouldn't free up or change the
- * data in any way.
+ * This is used with memory BIOs:
+ * BIO_FLAGS_MEM_RDONLY means we shouldn't free up or change the data in any way;
+ * BIO_FLAGS_NONCLEAR_RST means we should't clear data on reset.
*/
# define BIO_FLAGS_MEM_RDONLY 0x200
+# define BIO_FLAGS_NONCLEAR_RST 0x400
typedef union bio_addr_st BIO_ADDR;
typedef struct bio_addrinfo_st BIO_ADDRINFO;
diff --git a/include/openssl/ossl_typ.h b/include/openssl/ossl_typ.h
index 7a8d319989..ee2f70af13 100644
--- a/include/openssl/ossl_typ.h
+++ b/include/openssl/ossl_typ.h
@@ -128,6 +128,7 @@ typedef struct bn_recp_ctx_st BN_RECP_CTX;
typedef struct bn_gencb_st BN_GENCB;
typedef struct buf_mem_st BUF_MEM;
+typedef struct bio_buf_mem_st BIO_BUF_MEM;
typedef struct evp_cipher_st EVP_CIPHER;
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;