Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/openssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-06-10 19:48:26 +0300
committerPauli <paul.dale@oracle.com>2019-07-11 23:26:46 +0300
commit15cb0f095878092a625219f58bd915bdf1acc973 (patch)
treef0c021bb085b0c973cb7e921c20c3871d477ccac /include/internal
parent8ae173bb57819a23717fd3c8e7c51cb62f4268d0 (diff)
Give WPACKET the ability to have a NULL buffer underneath it
This means the WPACKET API can be used for calculating the number of bytes that would have been written if a non-NULL buffer had been used. This enables us to calculate the number of length bytes required when encoding ASN.1 Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9111)
Diffstat (limited to 'include/internal')
-rw-r--r--include/internal/packet.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/internal/packet.h b/include/internal/packet.h
index 9f8a098620..69a6bd1308 100644
--- a/include/internal/packet.h
+++ b/include/internal/packet.h
@@ -670,6 +670,13 @@ int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes);
int WPACKET_init(WPACKET *pkt, BUF_MEM *buf);
/*
+ * Same as WPACKET_init_len except there is no underlying buffer. No data is
+ * ever actually written. We just keep track of how much data would have been
+ * written if a buffer was there.
+ */
+int WPACKET_init_null(WPACKET *pkt, size_t lenbytes);
+
+/*
* Same as WPACKET_init_len except we do not use a growable BUF_MEM structure.
* A fixed buffer of memory |buf| of size |len| is used instead. A failure will
* occur if you attempt to write beyond the end of the buffer
@@ -868,6 +875,9 @@ int WPACKET_get_length(WPACKET *pkt, size_t *len);
*/
unsigned char *WPACKET_get_curr(WPACKET *pkt);
+/* Returns true if the underlying buffer is actually NULL */
+int WPACKET_is_null_buf(WPACKET *pkt);
+
/* Release resources in a WPACKET if a failure has occurred. */
void WPACKET_cleanup(WPACKET *pkt);