-/*
- * Set the PACKETW length, and the location for where we should write that
- * length. Normally this will be at the start of the PACKETW, and therefore
- * the PACKETW would have been initialised via PACKETW_init_len(). However there
- * is the possibility that the length needs to be written to some other location
- * other than the start of the PACKETW. In that case init via PACKETW_init() and
- * then set the location for the length using this function.
- */
-int PACKETW_set_packet_len(PACKETW *pkt, unsigned char *packet_len,
- size_t lenbytes)
+int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes)
+{
+ /* Internal API, so should not fail */
+ if (!ossl_assert(buf != NULL))
+ return 0;
+
+ pkt->staticbuf = NULL;
+ pkt->buf = buf;
+ pkt->maxsize = maxmaxsize(lenbytes);
+
+ return wpacket_intern_init_len(pkt, lenbytes);
+}
+
+int WPACKET_init(WPACKET *pkt, BUF_MEM *buf)
+{
+ return WPACKET_init_len(pkt, buf, 0);
+}
+
+int WPACKET_set_flags(WPACKET *pkt, unsigned int flags)