diff options
author | Matt Caswell <matt@openssl.org> | 2016-11-08 10:33:35 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-09 10:36:54 +0000 |
commit | 9b36b7d9bdb33d1edbc2bbfd8a773a0eb8645788 (patch) | |
tree | 668a1ea4172315f0ac08291bf9a44dc8bde80b8f /ssl/packet_locl.h | |
parent | 327c1627923288d3dbbfc34d1c7d8785552f6ad8 (diff) | |
download | openssl-9b36b7d9bdb33d1edbc2bbfd8a773a0eb8645788.zip openssl-9b36b7d9bdb33d1edbc2bbfd8a773a0eb8645788.tar.gz openssl-9b36b7d9bdb33d1edbc2bbfd8a773a0eb8645788.tar.bz2 |
Add support for initialising WPACKETs from a static buffer
Normally WPACKETs will use a BUF_MEM which can grow as required. Sometimes
though that may be overkill for what is needed - a static buffer may be
sufficient. This adds that capability.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/packet_locl.h')
-rw-r--r-- | ssl/packet_locl.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ssl/packet_locl.h b/ssl/packet_locl.h index 94933c1..4658734 100644 --- a/ssl/packet_locl.h +++ b/ssl/packet_locl.h @@ -625,6 +625,9 @@ struct wpacket_st { /* The buffer where we store the output data */ BUF_MEM *buf; + /* Fixed sized buffer which can be used as an alternative to buf */ + unsigned char *staticbuf; + /* * Offset into the buffer where we are currently writing. We use an offset * in case the buffer grows and gets reallocated. @@ -671,6 +674,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 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 + */ +int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len, + size_t lenbytes); +/* * Set the flags to be applied to the current sub-packet */ int WPACKET_set_flags(WPACKET *pkt, unsigned int flags); |