To avoid confusion with the read PACKET structure.
Reviewed-by: Rich Salz <rsalz@openssl.org>
#include "packet_locl.h"
/*
- * Allocate bytes in the PACKETW_BUF for the output. This reserves the bytes
+ * Allocate bytes in the WPACKET_BUF for the output. This reserves the bytes
* and count them as "written", but doesn't actually do the writing.
*/
-static unsigned char *PACKETW_BUF_allocate(PACKETW_BUF *wbuf, size_t len)
+static unsigned char *WPACKET_BUF_allocate(WPACKET_BUF *wbuf, size_t len)
{
unsigned char *ret = wbuf->curr;
}
/*
- * Initialise a PACKETW with the buffer in |buf|. The buffer must exist
- * for the whole time that the PACKETW is being used. Additionally |lenbytes| of
+ * Initialise a WPACKET with the buffer in |buf|. The buffer must exist
+ * for the whole time that the WPACKET is being used. Additionally |lenbytes| of
* data is preallocated at the start of the buffer to store the length of the
- * PACKETW once we know it.
+ * WPACKET once we know it.
*/
-int PACKETW_init_len(PACKETW *pkt, BUF_MEM *buf, size_t lenbytes)
+int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes)
{
- PACKETW_BUF *wbuf;
+ WPACKET_BUF *wbuf;
/* Sanity check */
if (buf == NULL)
return 0;
- wbuf = OPENSSL_zalloc(sizeof(PACKETW_BUF));
+ wbuf = OPENSSL_zalloc(sizeof(WPACKET_BUF));
if (wbuf == NULL) {
pkt->isclosed = 1;
return 0;
return 1;
}
- pkt->packet_len = PACKETW_BUF_allocate(wbuf, lenbytes);
+ pkt->packet_len = WPACKET_BUF_allocate(wbuf, lenbytes);
if (pkt->packet_len == NULL) {
OPENSSL_free(wbuf);
pkt->wbuf = NULL;
}
/*
- * Same as PACKETW_init_len except there is no preallocation of the PACKETW
+ * Same as WPACKET_init_len except there is no preallocation of the WPACKET
* length.
*/
-int PACKETW_init(PACKETW *pkt, BUF_MEM *buf)
+int WPACKET_init(WPACKET *pkt, BUF_MEM *buf)
{
- return PACKETW_init_len(pkt, buf, 0);
+ return WPACKET_init_len(pkt, buf, 0);
}
/*
- * 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
+ * Set the WPACKET length, and the location for where we should write that
+ * length. Normally this will be at the start of the WPACKET, and therefore
+ * the WPACKET would have been initialised via WPACKET_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
+ * other than the start of the WPACKET. In that case init via WPACKET_init() and
* then set the location for the length using this function.
*/
-int PACKETW_set_packet_len(PACKETW *pkt, unsigned char *packet_len,
+int WPACKET_set_packet_len(WPACKET *pkt, unsigned char *packet_len,
size_t lenbytes)
{
/* We only allow this to be set once */
return 1;
}
-int PACKETW_set_flags(PACKETW *pkt, unsigned int flags)
+int WPACKET_set_flags(WPACKET *pkt, unsigned int flags)
{
pkt->flags = flags;
}
/*
- * Closes the PACKETW and marks it as invalid for future writes. It also writes
+ * Closes the WPACKET and marks it as invalid for future writes. It also writes
* out the length of the packet to the required location (normally the start
- * of the PACKETW) if appropriate. A PACKETW cannot be closed if it has an
+ * of the WPACKET) if appropriate. A WPACKET cannot be closed if it has an
* active sub-packet.
*/
-int PACKETW_close(PACKETW *pkt)
+int WPACKET_close(WPACKET *pkt)
{
size_t packlen;
return 0;
packlen = pkt->wbuf->written - pkt->pwritten;
- if (packlen == 0 && pkt->flags & OPENSSL_PACKETW_FLAGS_NON_ZERO_LENGTH)
+ if (packlen == 0 && pkt->flags & OPENSSL_WPACKET_FLAGS_NON_ZERO_LENGTH)
return 0;
if (packlen == 0
- && pkt->flags & OPENSSL_PACKETW_FLAGS_ABANDON_ON_ZERO_LENGTH) {
- /* Deallocate any bytes allocated for the length of the PACKETW */
+ && pkt->flags & OPENSSL_WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) {
+ /* Deallocate any bytes allocated for the length of the WPACKET */
if ((pkt->wbuf->curr - pkt->lenbytes) == pkt->packet_len) {
pkt->wbuf->written -= pkt->lenbytes;
pkt->wbuf->curr -= pkt->lenbytes;
pkt->packet_len = NULL;
}
- /* Write out the PACKETW length if needed */
+ /* Write out the WPACKET length if needed */
if (pkt->packet_len != NULL) {
size_t lenbytes;
* Additionally |lenbytes| of data is preallocated at the start of the
* sub-packet to store its length once we know it.
*/
-int PACKETW_get_sub_packet_len(PACKETW *pkt, PACKETW *subpkt, size_t lenbytes)
+int WPACKET_get_sub_packet_len(WPACKET *pkt, WPACKET *subpkt, size_t lenbytes)
{
if (pkt->isclosed || pkt->haschild || subpkt == NULL)
return 0;
return 1;
}
- subpkt->packet_len = PACKETW_BUF_allocate(pkt->wbuf, lenbytes);
+ subpkt->packet_len = WPACKET_BUF_allocate(pkt->wbuf, lenbytes);
if (subpkt->packet_len == NULL) {
subpkt->isclosed = 1;
return 0;
}
/*
- * Same as PACKETW_get_sub_packet_len() except no bytes are pre-allocated for
+ * Same as WPACKET_get_sub_packet_len() except no bytes are pre-allocated for
* the sub-packet length.
*/
-int PACKETW_get_sub_packet(PACKETW *pkt, PACKETW *subpkt)
+int WPACKET_get_sub_packet(WPACKET *pkt, WPACKET *subpkt)
{
- return PACKETW_get_sub_packet_len(pkt, subpkt, 0);
+ return WPACKET_get_sub_packet_len(pkt, subpkt, 0);
}
/*
- * Allocate some bytes in the PACKETW for writing. That number of bytes is
+ * Allocate some bytes in the WPACKET for writing. That number of bytes is
* marked as having been written, and a pointer to their location is stored in
* |*allocbytes|.
*/
-int PACKETW_allocate_bytes(PACKETW *pkt, size_t bytes,
+int WPACKET_allocate_bytes(WPACKET *pkt, size_t bytes,
unsigned char **allocbytes)
{
unsigned char *data;
if (pkt->isclosed || pkt->haschild || bytes == 0)
return 0;
- data = PACKETW_BUF_allocate(pkt->wbuf, bytes);
+ data = WPACKET_BUF_allocate(pkt->wbuf, bytes);
if (data == NULL)
return 0;
}
/*
- * Write the value stored in |val| into the PACKETW. The value will consome
+ * Write the value stored in |val| into the WPACKET. The value will consome
* |bytes| amount of storage. An error will occur if |val| cannot be accommdated
* in |bytes| storage, e.g. attempting to write the value 256 into 1 byte will
* fail.
*/
-int PACKETW_put_bytes(PACKETW *pkt, unsigned int val, size_t bytes)
+int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t bytes)
{
unsigned char *data;
if (bytes > sizeof(unsigned int)
- || !PACKETW_allocate_bytes(pkt, bytes, &data))
+ || !WPACKET_allocate_bytes(pkt, bytes, &data))
return 0;
data += bytes - 1;
}
/*
- * Set a maximum size that we will not allow the PACKETW to grow beyond. If not
+ * Set a maximum size that we will not allow the WPACKET to grow beyond. If not
* set then there is no maximum.
*/
-int PACKETW_set_max_size(PACKETW *pkt, size_t maxsize)
+int WPACKET_set_max_size(WPACKET *pkt, size_t maxsize)
{
pkt->wbuf->maxsize = maxsize;
}
/*
- * Copy |len| bytes of data from |*src| into the PACKETW.
+ * Copy |len| bytes of data from |*src| into the WPACKET.
*/
-int PACKETW_memcpy(PACKETW *pkt, const void *src, size_t len)
+int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
{
unsigned char *dest;
if (len == 0)
return 1;
- if (!PACKETW_allocate_bytes(pkt, len, &dest))
+ if (!WPACKET_allocate_bytes(pkt, len, &dest))
return 0;
memcpy(dest, src, len);
/*
* Return the total number of bytes written so far to the underlying buffer.
- * This might includes bytes written by a parent PACKETW.
+ * This might includes bytes written by a parent WPACKET.
*/
-int PACKETW_get_total_written(PACKETW *pkt, size_t *written)
+int WPACKET_get_total_written(WPACKET *pkt, size_t *written)
{
if (pkt->isclosed || written == NULL)
return 0;
}
/*
- * Returns the length of this PACKETW so far. This excludes any bytes allocated
+ * Returns the length of this WPACKET so far. This excludes any bytes allocated
* for the length itself.
*/
-int PACKETW_get_length(PACKETW *pkt, size_t *len)
+int WPACKET_get_length(WPACKET *pkt, size_t *len)
{
if (pkt->isclosed || len == NULL)
return 0;
size_t written;
/*
- * Maximum number of bytes we will allow to be written to this PACKETW. Zero
+ * Maximum number of bytes we will allow to be written to this WPACKET. Zero
* if no maximum
*/
size_t maxsize;
-} PACKETW_BUF;
+} WPACKET_BUF;
-typedef struct packetw_st PACKETW;
+typedef struct packetw_st WPACKET;
struct packetw_st {
- /* The parent PACKETW if we have one or NULL otherwise */
- PACKETW *parent;
+ /* The parent WPACKET if we have one or NULL otherwise */
+ WPACKET *parent;
/* The actual buffer - shared with sub-packets */
- PACKETW_BUF *wbuf;
+ WPACKET_BUF *wbuf;
- /* Flags for this PACKETW */
+ /* Flags for this WPACKET */
unsigned int flags;
/*
- * Pointer to where the length of this PACKETW goes (or NULL if we don't
+ * Pointer to where the length of this WPACKET goes (or NULL if we don't
* write the length)
*/
unsigned char *packet_len;
/* True if we have an active sub-packet or false otherwise */
int haschild;
- /* True if PACKETW_close() has been called on this PACKETW */
+ /* True if WPACKET_close() has been called on this WPACKET */
int isclosed;
};
/* Flags */
-#define OPENSSL_PACKETW_FLAGS_NONE 0
-/* Error on PACKETW_close() if no data written to the PACKETW */
-#define OPENSSL_PACKETW_FLAGS_NON_ZERO_LENGTH 1
+#define OPENSSL_WPACKET_FLAGS_NONE 0
+/* Error on WPACKET_close() if no data written to the WPACKET */
+#define OPENSSL_WPACKET_FLAGS_NON_ZERO_LENGTH 1
/*
- * Abandon all changes on PACKETW_close() if no data written to the PACKETW,
+ * Abandon all changes on WPACKET_close() if no data written to the WPACKET,
* i.e. this does not write out a zero packet length
*/
-#define OPENSSL_PACKETW_FLAGS_ABANDON_ON_ZERO_LENGTH 2
+#define OPENSSL_WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH 2
-int PACKETW_init_len(PACKETW *pkt, BUF_MEM *buf, size_t lenbytes);
-int PACKETW_init(PACKETW *pkt, BUF_MEM *buf);
-int PACKETW_set_flags(PACKETW *pkt, unsigned int flags);
-int PACKETW_set_packet_len(PACKETW *pkt, unsigned char *packet_len,
+int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes);
+int WPACKET_init(WPACKET *pkt, BUF_MEM *buf);
+int WPACKET_set_flags(WPACKET *pkt, unsigned int flags);
+int WPACKET_set_packet_len(WPACKET *pkt, unsigned char *packet_len,
size_t lenbytes);
-int PACKETW_close(PACKETW *pkt);
-int PACKETW_get_sub_packet_len(PACKETW *pkt, PACKETW *subpkt, size_t lenbytes);
-int PACKETW_get_sub_packet(PACKETW *pkt, PACKETW *subpkt);
-int PACKETW_allocate_bytes(PACKETW *pkt, size_t bytes,
+int WPACKET_close(WPACKET *pkt);
+int WPACKET_get_sub_packet_len(WPACKET *pkt, WPACKET *subpkt, size_t lenbytes);
+int WPACKET_get_sub_packet(WPACKET *pkt, WPACKET *subpkt);
+int WPACKET_allocate_bytes(WPACKET *pkt, size_t bytes,
unsigned char **allocbytes);
-int PACKETW_put_bytes(PACKETW *pkt, unsigned int val, size_t bytes);
-int PACKETW_set_max_size(PACKETW *pkt, size_t maxsize);
-int PACKETW_memcpy(PACKETW *pkt, const void *src, size_t len);
-int PACKETW_get_total_written(PACKETW *pkt, size_t *written);
-int PACKETW_get_length(PACKETW *pkt, size_t *len);
+int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t bytes);
+int WPACKET_set_max_size(WPACKET *pkt, size_t maxsize);
+int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len);
+int WPACKET_get_total_written(WPACKET *pkt, size_t *written);
+int WPACKET_get_length(WPACKET *pkt, size_t *len);
# ifdef __cplusplus
}
}
/*
- * Temporary name. To be renamed ssl3_set_handshake_header() once all PACKETW
+ * Temporary name. To be renamed ssl3_set_handshake_header() once all WPACKET
* conversion is complete. The old ssl3_set_handshake_heder() can be deleted
* at that point.
* TODO - RENAME ME
*/
-int ssl3_set_handshake_header2(SSL *s, PACKETW *pkt, PACKETW *body, int htype)
+int ssl3_set_handshake_header2(SSL *s, WPACKET *pkt, WPACKET *body, int htype)
{
/* Set the content type and 3 bytes for the message len */
- if (!PACKETW_put_bytes(pkt, htype, 1)
- || !PACKETW_get_sub_packet_len(pkt, body, 3))
+ if (!WPACKET_put_bytes(pkt, htype, 1)
+ || !WPACKET_get_sub_packet_len(pkt, body, 3))
return 0;
return 1;
/*
* Old version of the ssl3_put_cipher_by_char function used by code that has not
- * yet been converted to PACKETW yet. It will be deleted once PACKETW conversion
+ * yet been converted to WPACKET yet. It will be deleted once WPACKET conversion
* is complete.
* TODO - DELETE ME
*/
return (2);
}
-int ssl3_put_cipher_by_char(const SSL_CIPHER *c, PACKETW *pkt, size_t *len)
+int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
{
if ((c->id & 0xff000000) != 0x03000000) {
*len = 0;
return 1;
}
- if (!PACKETW_put_bytes(pkt, c->id & 0xffff, 2))
+ if (!WPACKET_put_bytes(pkt, c->id & 0xffff, 2))
return 0;
*len = 2;
long (*ssl_ctrl) (SSL *s, int cmd, long larg, void *parg);
long (*ssl_ctx_ctrl) (SSL_CTX *ctx, int cmd, long larg, void *parg);
const SSL_CIPHER *(*get_cipher_by_char) (const unsigned char *ptr);
- int (*put_cipher_by_char) (const SSL_CIPHER *cipher, PACKETW *pkt,
+ int (*put_cipher_by_char) (const SSL_CIPHER *cipher, WPACKET *pkt,
size_t *len);
int (*ssl_pending) (const SSL *s);
int (*num_ciphers) (void);
/* Set the handshake header */
int (*set_handshake_header) (SSL *s, int type, unsigned long len);
/* Set the handshake header */
- int (*set_handshake_header2) (SSL *s, PACKETW *pkt, PACKETW *body,
+ int (*set_handshake_header2) (SSL *s, WPACKET *pkt, WPACKET *body,
int type);
/* Close construction of the handshake message */
- int (*close_construct_packet) (SSL *s, PACKETW *pkt);
+ int (*close_construct_packet) (SSL *s, WPACKET *pkt);
/* Write out handshake message */
int (*do_write) (SSL *s);
} SSL3_ENC_METHOD;
__owur const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p);
__owur int ssl3_put_cipher_by_char_old(const SSL_CIPHER *c, unsigned char *p);
-__owur int ssl3_put_cipher_by_char(const SSL_CIPHER *c, PACKETW *pkt,
+__owur int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt,
size_t *len);
int ssl3_init_finished_mac(SSL *s);
__owur int ssl3_setup_key_block(SSL *s);
__owur long ssl3_default_timeout(void);
__owur int ssl3_set_handshake_header(SSL *s, int htype, unsigned long len);
-__owur int ssl3_set_handshake_header2(SSL *s, PACKETW *pkt, PACKETW *body,
+__owur int ssl3_set_handshake_header2(SSL *s, WPACKET *pkt, WPACKET *body,
int htype);
-__owur int tls_close_construct_packet(SSL *s, PACKETW *pkt);
-__owur int dtls1_set_handshake_header2(SSL *s, PACKETW *pkt, PACKETW *body,
+__owur int tls_close_construct_packet(SSL *s, WPACKET *pkt);
+__owur int dtls1_set_handshake_header2(SSL *s, WPACKET *pkt, WPACKET *body,
int htype);
-__owur int dtls1_close_construct_packet(SSL *s, PACKETW *pkt);
+__owur int dtls1_close_construct_packet(SSL *s, WPACKET *pkt);
__owur int ssl3_handshake_write(SSL *s);
__owur int ssl_allow_compression(SSL *s);
__owur int tls1_shared_list(SSL *s,
const unsigned char *l1, size_t l1len,
const unsigned char *l2, size_t l2len, int nmatch);
-__owur int ssl_add_clienthello_tlsext(SSL *s, PACKETW *pkt, int *al);
+__owur int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al);
__owur unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
unsigned char *limit, int *al);
__owur int ssl_parse_clienthello_tlsext(SSL *s, PACKET *pkt);
__owur long ssl_get_algorithm2(SSL *s);
__owur size_t tls12_copy_sigalgs_old(SSL *s, unsigned char *out,
const unsigned char *psig, size_t psiglen);
-__owur int tls12_copy_sigalgs(SSL *s, PACKETW *pkt,
+__owur int tls12_copy_sigalgs(SSL *s, WPACKET *pkt,
const unsigned char *psig, size_t psiglen);
__owur int tls1_save_sigalgs(SSL *s, const unsigned char *data, int dsize);
__owur int tls1_process_sigalgs(SSL *s);
int *al);
__owur int custom_ext_add_old(SSL *s, int server, unsigned char **pret,
unsigned char *limit, int *al);
-__owur int custom_ext_add(SSL *s, int server, PACKETW *pkt, int *al);
+__owur int custom_ext_add(SSL *s, int server, WPACKET *pkt, int *al);
__owur int custom_exts_copy(custom_ext_methods *dst,
const custom_ext_methods *src);
static int key_exchange_expected(SSL *s);
static int ca_dn_cmp(const X509_NAME *const *a, const X509_NAME *const *b);
static int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
- PACKETW *pkt);
+ WPACKET *pkt);
/*
* Is a CertificateRequest message allowed at the moment or not?
SSL_COMP *comp;
#endif
SSL_SESSION *sess = s->session;
- PACKETW pkt, body, spkt;
+ WPACKET pkt, body, spkt;
- if (!PACKETW_init(&pkt, s->init_buf)
- || !PACKETW_set_max_size(&pkt, SSL3_RT_MAX_PLAIN_LENGTH)) {
+ if (!WPACKET_init(&pkt, s->init_buf)
+ || !WPACKET_set_max_size(&pkt, SSL3_RT_MAX_PLAIN_LENGTH)) {
/* Should not happen */
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
* client_version in client hello and not resetting it to
* the negotiated version.
*/
- if (!PACKETW_put_bytes(&body, s->client_version, 2)
- || !PACKETW_memcpy(&body, s->s3->client_random, SSL3_RANDOM_SIZE)) {
+ if (!WPACKET_put_bytes(&body, s->client_version, 2)
+ || !WPACKET_memcpy(&body, s->s3->client_random, SSL3_RANDOM_SIZE)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
else
i = s->session->session_id_length;
if (i > (int)sizeof(s->session->session_id)
- || !PACKETW_get_sub_packet_len(&body, &spkt, 1)
- || (i != 0 && !PACKETW_memcpy(&spkt, s->session->session_id, i))
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_get_sub_packet_len(&body, &spkt, 1)
+ || (i != 0 && !WPACKET_memcpy(&spkt, s->session->session_id, i))
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
/* cookie stuff for DTLS */
if (SSL_IS_DTLS(s)) {
if (s->d1->cookie_len > sizeof(s->d1->cookie)
- || !PACKETW_get_sub_packet_len(&body, &spkt, 1)
- || !PACKETW_memcpy(&spkt, s->d1->cookie, s->d1->cookie_len)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_get_sub_packet_len(&body, &spkt, 1)
+ || !WPACKET_memcpy(&spkt, s->d1->cookie, s->d1->cookie_len)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
}
/* Ciphers supported */
- if (!PACKETW_get_sub_packet_len(&body, &spkt, 2)) {
+ if (!WPACKET_get_sub_packet_len(&body, &spkt, 2)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
/* ssl_cipher_list_to_bytes() raises SSLerr if appropriate */
if (!ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &spkt))
goto err;
- if (!PACKETW_close(&spkt)) {
+ if (!WPACKET_close(&spkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
/* COMPRESSION */
- if (!PACKETW_get_sub_packet_len(&body, &spkt, 1)) {
+ if (!WPACKET_get_sub_packet_len(&body, &spkt, 1)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
int compnum = sk_SSL_COMP_num(s->ctx->comp_methods);
for (i = 0; i < compnum; i++) {
comp = sk_SSL_COMP_value(s->ctx->comp_methods, i);
- if (!PACKETW_put_bytes(&spkt, comp->id, 1)) {
+ if (!WPACKET_put_bytes(&spkt, comp->id, 1)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
}
#endif
/* Add the NULL method */
- if (!PACKETW_put_bytes(&spkt, 0, 1) || !PACKETW_close(&spkt)) {
+ if (!WPACKET_put_bytes(&spkt, 0, 1) || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT);
goto err;
}
- if (!PACKETW_get_sub_packet_len(&body, &spkt, 2)
+ if (!WPACKET_get_sub_packet_len(&body, &spkt, 2)
/*
* If extensions are of zero length then we don't even add the
* extensions length bytes
*/
- || !PACKETW_set_flags(&spkt,
- OPENSSL_PACKETW_FLAGS_ABANDON_ON_ZERO_LENGTH)
+ || !WPACKET_set_flags(&spkt,
+ OPENSSL_WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)
|| !ssl_add_clienthello_tlsext(s, &spkt, &al)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&spkt)) {
ssl3_send_alert(s, SSL3_AL_FATAL, al);
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
}
- if (!PACKETW_close(&body) || !ssl_close_construct_packet(s, &pkt)) {
+ if (!WPACKET_close(&body) || !ssl_close_construct_packet(s, &pkt)) {
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
goto err;
return i;
}
-int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, PACKETW *pkt)
+int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, WPACKET *pkt)
{
int i;
size_t totlen = 0, len, maxlen;
}
/*
- * Temporary name. To be renamed dtls1_set_handshake_header() once all PACKETW
+ * Temporary name. To be renamed dtls1_set_handshake_header() once all WPACKET
* conversion is complete. The old dtls1_set_handshake_heder() can be deleted
* at that point.
* TODO - RENAME ME
*/
-int dtls1_set_handshake_header2(SSL *s, PACKETW *pkt, PACKETW *body, int htype)
+int dtls1_set_handshake_header2(SSL *s, WPACKET *pkt, WPACKET *body, int htype)
{
unsigned char *header;
dtls1_set_message_header(s, htype, 0, 0, 0);
* We allocate space at the start for the message header. This gets filled
* in later
*/
- if (!PACKETW_allocate_bytes(pkt, DTLS1_HM_HEADER_LENGTH, &header)
- || !PACKETW_get_sub_packet(pkt, body))
+ if (!WPACKET_allocate_bytes(pkt, DTLS1_HM_HEADER_LENGTH, &header)
+ || !WPACKET_get_sub_packet(pkt, body))
return 0;
return 1;
}
-int dtls1_close_construct_packet(SSL *s, PACKETW *pkt)
+int dtls1_close_construct_packet(SSL *s, WPACKET *pkt)
{
size_t msglen;
- if (!PACKETW_get_length(pkt, &msglen)
+ if (!WPACKET_get_length(pkt, &msglen)
|| msglen > INT_MAX
- || !PACKETW_close(pkt))
+ || !WPACKET_close(pkt))
return 0;
s->d1->w_msg_hdr.msg_len = msglen - DTLS1_HM_HEADER_LENGTH;
s->d1->w_msg_hdr.frag_len = msglen - DTLS1_HM_HEADER_LENGTH;
return (0);
}
-int tls_close_construct_packet(SSL *s, PACKETW *pkt)
+int tls_close_construct_packet(SSL *s, WPACKET *pkt)
{
size_t msglen;
- if (!PACKETW_get_length(pkt, &msglen)
+ if (!WPACKET_get_length(pkt, &msglen)
|| msglen > INT_MAX
- || !PACKETW_close(pkt))
+ || !WPACKET_close(pkt))
return 0;
s->init_num = (int)msglen;
s->init_off = 0;
/*
* Request custom extension data from the application and add to the return
- * buffer. This is the old style function signature prior to PACKETW. This is
- * here temporarily until the conversion to PACKETW is completed, i.e. it is
+ * buffer. This is the old style function signature prior to WPACKET. This is
+ * here temporarily until the conversion to WPACKET is completed, i.e. it is
* used by code that hasn't been converted yet.
* TODO - REMOVE THIS FUNCTION
*/
* Request custom extension data from the application and add to the return
* buffer.
*/
-int custom_ext_add(SSL *s, int server, PACKETW *pkt, int *al)
+int custom_ext_add(SSL *s, int server, WPACKET *pkt, int *al)
{
custom_ext_methods *exts = server ? &s->cert->srv_ext : &s->cert->cli_ext;
custom_ext_method *meth;
for (i = 0; i < exts->meths_count; i++) {
const unsigned char *out = NULL;
size_t outlen = 0;
- PACKETW spkt;
+ WPACKET spkt;
meth = exts->meths + i;
continue; /* skip this extension */
}
- if (!PACKETW_put_bytes(pkt, meth->ext_type, 2)
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || (outlen > 0 && !PACKETW_memcpy(&spkt, out, outlen))
- || !PACKETW_close(&spkt)) {
+ if (!WPACKET_put_bytes(pkt, meth->ext_type, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || (outlen > 0 && !WPACKET_memcpy(&spkt, out, outlen))
+ || !WPACKET_close(&spkt)) {
*al = SSL_AD_INTERNAL_ERROR;
return 0;
}
return ret;
}
-int ssl_add_clienthello_tlsext(SSL *s, PACKETW *pkt, int *al)
+int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al)
{
- PACKETW spkt;
+ WPACKET spkt;
#ifndef OPENSSL_NO_EC
/* See if we support any ECC ciphersuites */
int using_ecc = 0;
/* Add RI if renegotiating */
if (s->renegotiate) {
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_renegotiate, 2)
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_memcpy(&spkt, s->s3->previous_client_finished,
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_renegotiate, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_memcpy(&spkt, s->s3->previous_client_finished,
s->s3->previous_client_finished_len)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
if (s->tlsext_hostname != NULL) {
/* Add TLS extension servername to the Client Hello message */
- PACKETW slistpkt, hostpkt;
+ WPACKET slistpkt, hostpkt;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_server_name, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_server_name, 2)
/* Sub-packet for server_name extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
/* Sub-packet for servername list (always 1 hostname)*/
- || !PACKETW_get_sub_packet_len(&spkt, &slistpkt, 2)
- || !PACKETW_put_bytes(&slistpkt, TLSEXT_NAMETYPE_host_name, 1)
+ || !WPACKET_get_sub_packet_len(&spkt, &slistpkt, 2)
+ || !WPACKET_put_bytes(&slistpkt, TLSEXT_NAMETYPE_host_name, 1)
/* Sub-packet for a single hostname host name */
- || !PACKETW_get_sub_packet_len(&slistpkt, &hostpkt, 2)
- || !PACKETW_memcpy(&hostpkt, s->tlsext_hostname,
+ || !WPACKET_get_sub_packet_len(&slistpkt, &hostpkt, 2)
+ || !WPACKET_memcpy(&hostpkt, s->tlsext_hostname,
strlen(s->tlsext_hostname))
- || !PACKETW_close(&hostpkt)
- || !PACKETW_close(&slistpkt)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&hostpkt)
+ || !WPACKET_close(&slistpkt)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
#ifndef OPENSSL_NO_SRP
/* Add SRP username if there is one */
if (s->srp_ctx.login != NULL) {
- PACKETW loginpkt;
+ WPACKET loginpkt;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_srp, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_srp, 2)
/* Sub-packet for SRP extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_get_sub_packet_len(&spkt, &loginpkt, 1)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(&spkt, &loginpkt, 1)
/* login must not be zero...internal error if so */
- || !PACKETW_set_flags(&loginpkt,
- OPENSSL_PACKETW_FLAGS_NON_ZERO_LENGTH)
- || !PACKETW_memcpy(&loginpkt, s->srp_ctx.login,
+ || !WPACKET_set_flags(&loginpkt,
+ OPENSSL_WPACKET_FLAGS_NON_ZERO_LENGTH)
+ || !WPACKET_memcpy(&loginpkt, s->srp_ctx.login,
strlen(s->srp_ctx.login))
- || !PACKETW_close(&loginpkt)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&loginpkt)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
#ifndef OPENSSL_NO_EC
if (using_ecc) {
- PACKETW formatspkt, curveslistpkt;
+ WPACKET formatspkt, curveslistpkt;
/*
* Add TLS extension ECPointFormats to the ClientHello message
tls1_get_formatlist(s, &pformats, &num_formats);
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_ec_point_formats, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_ec_point_formats, 2)
/* Sub-packet for formats extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_get_sub_packet_len(&spkt, &formatspkt, 1)
- || !PACKETW_memcpy(&formatspkt, pformats, num_formats)
- || !PACKETW_close(&formatspkt)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(&spkt, &formatspkt, 1)
+ || !WPACKET_memcpy(&formatspkt, pformats, num_formats)
+ || !WPACKET_close(&formatspkt)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
return 0;
}
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_elliptic_curves, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_elliptic_curves, 2)
/* Sub-packet for curves extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_get_sub_packet_len(&spkt, &curveslistpkt, 2)) {
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(&spkt, &curveslistpkt, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
/* Copy curve ID if supported */
for (i = 0; i < num_curves; i++, pcurves += 2) {
if (tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED)) {
- if (!PACKETW_put_bytes(&curveslistpkt, pcurves[0], 1)
- || !PACKETW_put_bytes(&curveslistpkt, pcurves[1], 1)) {
+ if (!WPACKET_put_bytes(&curveslistpkt, pcurves[0], 1)
+ || !WPACKET_put_bytes(&curveslistpkt, pcurves[1], 1)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT,
ERR_R_INTERNAL_ERROR);
return 0;
}
}
}
- if (!PACKETW_close(&curveslistpkt) || !PACKETW_close(&spkt)) {
+ if (!WPACKET_close(&curveslistpkt) || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
s->tlsext_session_ticket->data == NULL)
goto skip_ext;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_session_ticket, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_session_ticket, 2)
/* Sub-packet for ticket extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_memcpy(&spkt, s->session->tlsext_tick, ticklen)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_memcpy(&spkt, s->session->tlsext_tick, ticklen)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
if (SSL_CLIENT_USE_SIGALGS(s)) {
size_t salglen;
const unsigned char *salg;
- PACKETW salgslistpkt;
+ WPACKET salgslistpkt;
salglen = tls12_get_psigalgs(s, &salg);
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_signature_algorithms, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_signature_algorithms, 2)
/* Sub-packet for sig-algs extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
/* Sub-packet for the actual list */
- || !PACKETW_get_sub_packet_len(&spkt, &salgslistpkt, 2)
+ || !WPACKET_get_sub_packet_len(&spkt, &salgslistpkt, 2)
|| !tls12_copy_sigalgs(s, &salgslistpkt, salg, salglen)
- || !PACKETW_close(&salgslistpkt)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&salgslistpkt)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
}
#ifndef OPENSSL_NO_OCSP
if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) {
- PACKETW idspkt, extpkt;
+ WPACKET idspkt, extpkt;
int i;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_status_request, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_status_request, 2)
/* Sub-packet for status request extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_put_bytes(&spkt, TLSEXT_STATUSTYPE_ocsp, 1)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_put_bytes(&spkt, TLSEXT_STATUSTYPE_ocsp, 1)
/* Sub-packet for the ids */
- || !PACKETW_get_sub_packet_len(&spkt, &idspkt, 2)) {
+ || !WPACKET_get_sub_packet_len(&spkt, &idspkt, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
unsigned char *idbytes;
int idlen;
OCSP_RESPID *id;
- PACKETW idpkt;
+ WPACKET idpkt;
id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i);
idlen = i2d_OCSP_RESPID(id, NULL);
if (idlen <= 0
/* Sub-packet for an individual id */
- || !PACKETW_get_sub_packet_len(&idspkt, &idpkt, 1)
- || !PACKETW_allocate_bytes(&idpkt, idlen, &idbytes)
+ || !WPACKET_get_sub_packet_len(&idspkt, &idpkt, 1)
+ || !WPACKET_allocate_bytes(&idpkt, idlen, &idbytes)
|| i2d_OCSP_RESPID(id, &idbytes) != idlen
- || !PACKETW_close(&idpkt)) {
+ || !WPACKET_close(&idpkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
}
- if (!PACKETW_close(&idspkt)
- || !PACKETW_get_sub_packet_len(&spkt, &extpkt, 2)) {
+ if (!WPACKET_close(&idspkt)
+ || !WPACKET_get_sub_packet_len(&spkt, &extpkt, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
- if (!PACKETW_allocate_bytes(&extpkt, extlen, &extbytes)
+ if (!WPACKET_allocate_bytes(&extpkt, extlen, &extbytes)
|| i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &extbytes)
!= extlen) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
}
- if (!PACKETW_close(&extpkt) || !PACKETW_close(&spkt)) {
+ if (!WPACKET_close(&extpkt) || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
else
mode = SSL_DTLSEXT_HB_ENABLED;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_heartbeat, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_heartbeat, 2)
/* Sub-packet for Hearbeat extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_put_bytes(&spkt, mode, 1)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_put_bytes(&spkt, mode, 1)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
* The client advertises an empty extension to indicate its support
* for Next Protocol Negotiation
*/
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_next_proto_neg, 2)
- || !PACKETW_put_bytes(pkt, 0, 2)) {
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_next_proto_neg, 2)
+ || !WPACKET_put_bytes(pkt, 0, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
* (see longer comment below)
*/
if (s->alpn_client_proto_list && !s->s3->tmp.finish_md_len) {
- PACKETW plistpkt;
+ WPACKET plistpkt;
- if (!PACKETW_put_bytes(pkt,
+ if (!WPACKET_put_bytes(pkt,
TLSEXT_TYPE_application_layer_protocol_negotiation, 2)
/* Sub-packet ALPN extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
/* Sub-packet for ALPN proto list */
- || !PACKETW_get_sub_packet_len(&spkt, &plistpkt, 2)
- || !PACKETW_memcpy(&plistpkt, s->alpn_client_proto_list,
+ || !WPACKET_get_sub_packet_len(&spkt, &plistpkt, 2)
+ || !WPACKET_memcpy(&plistpkt, s->alpn_client_proto_list,
s->alpn_client_proto_list_len)
- || !PACKETW_close(&plistpkt)
- || !PACKETW_close(&spkt)) {
+ || !WPACKET_close(&plistpkt)
+ || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
STACK_OF(SRTP_PROTECTION_PROFILE) *clnt = 0;
SRTP_PROTECTION_PROFILE *prof;
int i, ct;
- PACKETW plistpkt;
+ WPACKET plistpkt;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_use_srtp, 2)
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_use_srtp, 2)
/* Sub-packet for SRTP extension */
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
/* Sub-packet for the protection profile list */
- || !PACKETW_get_sub_packet_len(&spkt, &plistpkt, 2)) {
+ || !WPACKET_get_sub_packet_len(&spkt, &plistpkt, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
ct = sk_SRTP_PROTECTION_PROFILE_num(clnt);
for (i = 0; i < ct; i++) {
prof = sk_SRTP_PROTECTION_PROFILE_value(clnt, i);
- if (prof == NULL || !PACKETW_put_bytes(&plistpkt, prof->id, 2)) {
+ if (prof == NULL || !WPACKET_put_bytes(&plistpkt, prof->id, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
}
- if (!PACKETW_close(&plistpkt) || !PACKETW_close(&spkt)) {
+ if (!WPACKET_close(&plistpkt) || !WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
return 0;
}
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_encrypt_then_mac, 2)
- || !PACKETW_put_bytes(pkt, 0, 2)) {
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_encrypt_then_mac, 2)
+ || !WPACKET_put_bytes(pkt, 0, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
#ifndef OPENSSL_NO_CT
if (s->ct_validation_callback != NULL) {
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_signed_certificate_timestamp, 2)
- || !PACKETW_put_bytes(pkt, 0, 2)) {
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_signed_certificate_timestamp, 2)
+ || !WPACKET_put_bytes(pkt, 0, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
}
#endif
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_extended_master_secret, 2)
- || !PACKETW_put_bytes(pkt, 0, 2)) {
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_extended_master_secret, 2)
+ || !WPACKET_put_bytes(pkt, 0, 2)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
unsigned char *padbytes;
size_t hlen;
- if (!PACKETW_get_total_written(pkt, &hlen)) {
+ if (!WPACKET_get_total_written(pkt, &hlen)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
else
hlen = 0;
- if (!PACKETW_put_bytes(pkt, TLSEXT_TYPE_padding, 2)
- || !PACKETW_get_sub_packet_len(pkt, &spkt, 2)
- || !PACKETW_allocate_bytes(&spkt, hlen, &padbytes)) {
+ if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_padding, 2)
+ || !WPACKET_get_sub_packet_len(pkt, &spkt, 2)
+ || !WPACKET_allocate_bytes(&spkt, hlen, &padbytes)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
memset(padbytes, 0, hlen);
- if (!PACKETW_close(&spkt)) {
+ if (!WPACKET_close(&spkt)) {
SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
return 0;
}
/*
* Old version of the tls12_copy_sigalgs function used by code that has not
- * yet been converted to PACKETW yet. It will be deleted once PACKETW conversion
+ * yet been converted to WPACKET yet. It will be deleted once WPACKET conversion
* is complete.
* TODO - DELETE ME
*/
return tmpout - out;
}
-int tls12_copy_sigalgs(SSL *s, PACKETW *pkt,
+int tls12_copy_sigalgs(SSL *s, WPACKET *pkt,
const unsigned char *psig, size_t psiglen)
{
size_t i;
for (i = 0; i < psiglen; i += 2, psig += 2) {
if (tls12_sigalg_allowed(s, SSL_SECOP_SIGALG_SUPPORTED, psig)) {
- if (!PACKETW_put_bytes(pkt, psig[0], 1)
- || !PACKETW_put_bytes(pkt, psig[1], 1))
+ if (!WPACKET_put_bytes(pkt, psig[0], 1)
+ || !WPACKET_put_bytes(pkt, psig[1], 1))
return 0;
}
}