diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2019-04-04 09:48:47 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-04-16 10:55:36 +0100 |
commit | 693f98aae8a33f2e0f91264ca7383438bae93d47 (patch) | |
tree | 9dbab5d7edf8422ecb26009583895de40902239f /doc | |
parent | 4912bf74280caa7aec5b206e29b103d594075123 (diff) |
Add documentation for the BIO_s_mem pecularities
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8649)
(cherry picked from commit 3d42833d389134b7b05b655c264e4dba5a2179e9)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man3/BIO_s_mem.pod | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/man3/BIO_s_mem.pod b/doc/man3/BIO_s_mem.pod index 050d7786a6..250d12cbae 100644 --- a/doc/man3/BIO_s_mem.pod +++ b/doc/man3/BIO_s_mem.pod @@ -88,6 +88,22 @@ a buffering BIO to the chain will speed up the process. Calling BIO_set_mem_buf() on a BIO created with BIO_new_secmem() will give undefined results, including perhaps a program crash. +Switching the memory BIO from read write to read only is not supported and +can give undefined results including a program crash. There are two notable +exceptions to the rule. The first one is to assign a static memory buffer +immediately after BIO creation and set the BIO as read only. + +The other supported sequence is to start with read write BIO then temporarily +switch it to read only and call BIO_reset() on the read only BIO immediately +before switching it back to read write. Before the BIO is freed it must be +switched back to the read write mode. + +Calling BIO_get_mem_ptr() on read only BIO will return a BUF_MEM that +contains only the remaining data to be read. If the close status of the +BIO is set to BIO_NOCLOSE, before freeing the BUF_MEM the data pointer +in it must be set to NULL as the data pointer does not point to an +allocated memory. + =head1 BUGS There should be an option to set the maximum size of a memory BIO. |