summaryrefslogtreecommitdiffstats
path: root/ssl/s3_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-08-03 20:57:52 +0100
committerMatt Caswell <matt@openssl.org>2016-09-13 09:41:21 +0100
commit2c7b4dbc1af9cfae4e4afd7c4a07db95a1133a6a (patch)
tree01fe05288e91154c01cec450435541330b5dcd78 /ssl/s3_lib.c
parentb7273855acd7ec2d1e7a4ba626ed538808fc7517 (diff)
Convert tls_construct_client_hello() to use PACKETW
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'ssl/s3_lib.c')
-rw-r--r--ssl/s3_lib.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index e94ee83717..9f7c6cc782 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -2751,6 +2751,8 @@ const SSL3_ENC_METHOD SSLv3_enc_data = {
0,
SSL3_HM_HEADER_LENGTH,
ssl3_set_handshake_header,
+ ssl3_set_handshake_header2,
+ tls_close_construct_packet,
ssl3_handshake_write
};
@@ -2787,6 +2789,22 @@ int ssl3_set_handshake_header(SSL *s, int htype, unsigned long len)
return 1;
}
+/*
+ * Temporary name. To be renamed ssl3_set_handshake_header() once all PACKETW
+ * 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)
+{
+ /* 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))
+ return 0;
+
+ return 1;
+}
+
int ssl3_handshake_write(SSL *s)
{
return ssl3_do_write(s, SSL3_RT_HANDSHAKE);
@@ -3553,7 +3571,13 @@ const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p)
return cp;
}
-int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
+/*
+ * 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
+ * is complete.
+ * TODO - DELETE ME
+ */
+int ssl3_put_cipher_by_char_old(const SSL_CIPHER *c, unsigned char *p)
{
long l;
@@ -3567,6 +3591,20 @@ int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
return (2);
}
+int ssl3_put_cipher_by_char(const SSL_CIPHER *c, PACKETW *pkt, size_t *len)
+{
+ if ((c->id & 0xff000000) != 0x03000000) {
+ *len = 0;
+ return 1;
+ }
+
+ if (!PACKETW_put_bytes(pkt, c->id & 0xffff, 2))
+ return 0;
+
+ *len = 2;
+ return 1;
+}
+
/*
* ssl3_choose_cipher - choose a cipher from those offered by the client
* @s: SSL connection