diff options
author | Matt Caswell <matt@openssl.org> | 2020-04-02 13:21:24 +0300 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-04-04 12:35:09 +0300 |
commit | d3ba3916d4fb5f8f7dbacb6cd7dab2909abb8e25 (patch) | |
tree | 23312e460609f5609f73042bc334d053e71cfb4a /include/internal | |
parent | e2bf331bc0c735ebd8d9b86725bc3dc32245f986 (diff) |
Add "endfirst" writing to WPACKET
Support the concept of writing to the end of the packet first.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11462)
Diffstat (limited to 'include/internal')
-rw-r--r-- | include/internal/packet.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/internal/packet.h b/include/internal/packet.h index c03d917da7..1620ff838f 100644 --- a/include/internal/packet.h +++ b/include/internal/packet.h @@ -638,6 +638,9 @@ struct wpacket_st { /* Our sub-packets (always at least one if not finished) */ WPACKET_SUB *subs; + + /* Writing from the end first? */ + unsigned int endfirst : 1; }; /* Flags */ @@ -677,12 +680,26 @@ int WPACKET_init(WPACKET *pkt, BUF_MEM *buf); int WPACKET_init_null(WPACKET *pkt, size_t lenbytes); /* + * Same as WPACKET_init_null except we set the WPACKET to assume DER length + * encoding for sub-packets. + */ +int WPACKET_init_null_der(WPACKET *pkt); + +/* * 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); + +/* + * Same as WPACKET_init_static_len except lenbytes is always 0, and we set the + * WPACKET to write to the end of the buffer moving towards the start and use + * DER length encoding for sub-packets. + */ +int WPACKET_init_der(WPACKET *pkt, unsigned char *buf, size_t len); + /* * Set the flags to be applied to the current sub-packet */ |