Rename ssl_set_handshake_header2()
authorMatt Caswell <matt@openssl.org>
Thu, 29 Sep 2016 21:40:15 +0000 (22:40 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 2 Oct 2016 19:25:57 +0000 (20:25 +0100)
ssl_set_handshake_header2() was only ever a temporary name while we had
to have ssl_set_handshake_header() for code that hadn't been converted to
WPACKET yet. No code remains that needed that so we can rename it.

Reviewed-by: Rich Salz <rsalz@openssl.org>
ssl/d1_lib.c
ssl/s3_lib.c
ssl/ssl_locl.h
ssl/statem/statem_clnt.c
ssl/statem/statem_dtls.c
ssl/statem/statem_lib.c
ssl/statem/statem_srvr.c
ssl/t1_lib.c

index 27b8ccb162052069b1f04e73d4e707ad545c0d96..112c69904e7323ec741061700b29f841a5dd75dc 100644 (file)
@@ -42,7 +42,7 @@ const SSL3_ENC_METHOD DTLSv1_enc_data = {
     tls1_export_keying_material,
     SSL_ENC_FLAG_DTLS | SSL_ENC_FLAG_EXPLICIT_IV,
     DTLS1_HM_HEADER_LENGTH,
-    dtls1_set_handshake_header2,
+    dtls1_set_handshake_header,
     dtls1_close_construct_packet,
     dtls1_handshake_write
 };
@@ -62,7 +62,7 @@ const SSL3_ENC_METHOD DTLSv1_2_enc_data = {
     SSL_ENC_FLAG_DTLS | SSL_ENC_FLAG_EXPLICIT_IV | SSL_ENC_FLAG_SIGALGS
         | SSL_ENC_FLAG_SHA256_PRF | SSL_ENC_FLAG_TLS1_2_CIPHERS,
     DTLS1_HM_HEADER_LENGTH,
-    dtls1_set_handshake_header2,
+    dtls1_set_handshake_header,
     dtls1_close_construct_packet,
     dtls1_handshake_write
 };
index 02cf88be4579a19ffc6f787b4dbf358041f9f3bc..630c94d38394539f5d2b96e3b9c222be709db7ac 100644 (file)
@@ -2750,7 +2750,7 @@ const SSL3_ENC_METHOD SSLv3_enc_data = {
              int use_context))ssl_undefined_function,
     0,
     SSL3_HM_HEADER_LENGTH,
-    ssl3_set_handshake_header2,
+    ssl3_set_handshake_header,
     tls_close_construct_packet,
     ssl3_handshake_write
 };
@@ -2777,13 +2777,7 @@ const SSL_CIPHER *ssl3_get_cipher(unsigned int u)
         return (NULL);
 }
 
-/*
- * 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, WPACKET *pkt, int htype)
+int ssl3_set_handshake_header(SSL *s, WPACKET *pkt, int htype)
 {
     /* Set the content type and 3 bytes for the message len */
     if (!WPACKET_put_bytes_u8(pkt, htype)
index cd44e37f41133b501eed81d80655c7e57f0498d6..eb297404298d0a3604058fe912f04ace986da031 100644 (file)
@@ -1584,7 +1584,7 @@ typedef struct ssl3_enc_method {
     /* Handshake header length */
     unsigned int hhlen;
     /* Set the handshake header */
-    int (*set_handshake_header2) (SSL *s, WPACKET *pkt, int type);
+    int (*set_handshake_header) (SSL *s, WPACKET *pkt, int type);
     /* Close construction of the handshake message */
     int (*close_construct_packet) (SSL *s, WPACKET *pkt);
     /* Write out handshake message */
@@ -1594,8 +1594,8 @@ typedef struct ssl3_enc_method {
 # define SSL_HM_HEADER_LENGTH(s) s->method->ssl3_enc->hhlen
 # define ssl_handshake_start(s) \
         (((unsigned char *)s->init_buf->data) + s->method->ssl3_enc->hhlen)
-# define ssl_set_handshake_header2(s, pkt, htype) \
-        s->method->ssl3_enc->set_handshake_header2((s), (pkt), (htype))
+# define ssl_set_handshake_header(s, pkt, htype) \
+        s->method->ssl3_enc->set_handshake_header((s), (pkt), (htype))
 # define ssl_close_construct_packet(s, pkt) \
         s->method->ssl3_enc->close_construct_packet((s), (pkt))
 # define ssl_do_write(s)  s->method->ssl3_enc->do_write(s)
@@ -1899,9 +1899,9 @@ __owur long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void));
 __owur int ssl3_do_change_cipher_spec(SSL *ssl);
 __owur long ssl3_default_timeout(void);
 
-__owur int ssl3_set_handshake_header2(SSL *s, WPACKET *pkt, int htype);
+__owur int ssl3_set_handshake_header(SSL *s, WPACKET *pkt, int htype);
 __owur int tls_close_construct_packet(SSL *s, WPACKET *pkt);
-__owur int dtls1_set_handshake_header2(SSL *s, WPACKET *pkt, int htype);
+__owur int dtls1_set_handshake_header(SSL *s, WPACKET *pkt, int htype);
 __owur int dtls1_close_construct_packet(SSL *s, WPACKET *pkt);
 __owur int ssl3_handshake_write(SSL *s);
 
index e4b2219f06209663ec1a0d8ea21bf5ecc1907f7d..02d1b7af897fd6995083c808a48b1b6ee4e0a0eb 100644 (file)
@@ -738,7 +738,7 @@ int tls_construct_client_hello(SSL *s)
     if (i && ssl_fill_hello_random(s, 0, p, sizeof(s->s3->client_random)) <= 0)
         goto err;
 
-    if (!ssl_set_handshake_header2(s, &pkt, SSL3_MT_CLIENT_HELLO)) {
+    if (!ssl_set_handshake_header(s, &pkt, SSL3_MT_CLIENT_HELLO)) {
         ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
         SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR);
         goto err;
@@ -2469,7 +2469,7 @@ int tls_construct_client_key_exchange(SSL *s)
         goto err;
     }
 
-    if (!ssl_set_handshake_header2(s, &pkt, SSL3_MT_CLIENT_KEY_EXCHANGE)) {
+    if (!ssl_set_handshake_header(s, &pkt, SSL3_MT_CLIENT_KEY_EXCHANGE)) {
         ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE);
         SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
         goto err;
@@ -2605,7 +2605,7 @@ int tls_construct_client_verify(SSL *s)
         goto err;
     }
 
-    if (!ssl_set_handshake_header2(s, &pkt, SSL3_MT_CERTIFICATE_VERIFY)) {
+    if (!ssl_set_handshake_header(s, &pkt, SSL3_MT_CERTIFICATE_VERIFY)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR);
         goto err;
     }
@@ -2878,7 +2878,7 @@ int tls_construct_next_proto(SSL *s)
         goto err;
     }
 
-    if (!ssl_set_handshake_header2(s, &pkt, SSL3_MT_NEXT_PROTO)) {
+    if (!ssl_set_handshake_header(s, &pkt, SSL3_MT_NEXT_PROTO)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_NEXT_PROTO, ERR_R_INTERNAL_ERROR);
         goto err;
     }
index 7e23ad91a134dce4a085cd468b1470c5573df841..0328ab7def5e37179841a078b91dab991a1c5f49 100644 (file)
@@ -1212,13 +1212,7 @@ void dtls1_get_message_header(unsigned char *data, struct hm_header_st *msg_hdr)
     n2l3(data, msg_hdr->frag_len);
 }
 
-/*
- * 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, WPACKET *pkt, int htype)
+int dtls1_set_handshake_header(SSL *s, WPACKET *pkt, int htype)
 {
     unsigned char *header;
 
index 0a482fd3a75a4dc06e76abd58304fd8e61a7095a..da26ef8c168898c41c42ef8ee5177ed83566ef33 100644 (file)
@@ -78,7 +78,7 @@ int tls_construct_finished(SSL *s, const char *sender, int slen)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt, SSL3_MT_FINISHED)) {
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_FINISHED)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_FINISHED, ERR_R_INTERNAL_ERROR);
         goto err;
     }
@@ -297,7 +297,7 @@ unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk)
         goto err;
     }
 
-    if (!ssl_set_handshake_header2(s, &pkt, SSL3_MT_CERTIFICATE)
+    if (!ssl_set_handshake_header(s, &pkt, SSL3_MT_CERTIFICATE)
             || !WPACKET_start_sub_packet_u24(&pkt)) {
         SSLerr(SSL_F_SSL3_OUTPUT_CERT_CHAIN, ERR_R_INTERNAL_ERROR);
         goto err;
index 008ebda13285d728b60b8ea4f38dc84eea4812c3..cc737ba846a1214d1282014431e849c451690d0d 100644 (file)
@@ -834,7 +834,7 @@ int tls_construct_hello_request(SSL *s)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt, SSL3_MT_HELLO_REQUEST)
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_HELLO_REQUEST)
             || !ssl_close_construct_packet(s, &pkt)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_HELLO_REQUEST, ERR_R_INTERNAL_ERROR);
         ossl_statem_set_error(s);
@@ -872,8 +872,8 @@ int dtls_construct_hello_verify_request(SSL *s)
     }
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt,
-                                          DTLS1_MT_HELLO_VERIFY_REQUEST)
+            || !ssl_set_handshake_header(s, &pkt,
+                                         DTLS1_MT_HELLO_VERIFY_REQUEST)
             || !dtls_raw_hello_verify_request(&pkt, s->d1->cookie,
                                               s->d1->cookie_len)
                /*
@@ -1504,7 +1504,7 @@ int tls_construct_server_hello(SSL *s)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt, SSL3_MT_SERVER_HELLO)
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_SERVER_HELLO)
             || !WPACKET_put_bytes_u16(&pkt, s->version)
                /*
                 * Random stuff. Filling of the server_random takes place in
@@ -1575,7 +1575,7 @@ int tls_construct_server_done(SSL *s)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt, SSL3_MT_SERVER_DONE)
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_SERVER_DONE)
             || !ssl_close_construct_packet(s, &pkt)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_DONE, ERR_R_INTERNAL_ERROR);
         goto err;
@@ -1614,8 +1614,8 @@ int tls_construct_server_key_exchange(SSL *s)
     size_t paramlen, paramoffset;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt,
-                                          SSL3_MT_SERVER_KEY_EXCHANGE)
+            || !ssl_set_handshake_header(s, &pkt,
+                                         SSL3_MT_SERVER_KEY_EXCHANGE)
             || !WPACKET_get_total_written(&pkt, &paramoffset)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
         goto f_err;
@@ -1950,8 +1950,8 @@ int tls_construct_certificate_request(SSL *s)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt,
-                                          SSL3_MT_CERTIFICATE_REQUEST)) {
+            || !ssl_set_handshake_header(s, &pkt,
+                                         SSL3_MT_CERTIFICATE_REQUEST)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, ERR_R_INTERNAL_ERROR);
         goto err;
     }
@@ -2985,7 +2985,7 @@ int tls_construct_new_session_ticket(SSL *s)
     }
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt, SSL3_MT_NEWSESSION_TICKET)) {
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_NEWSESSION_TICKET)) {
         SSLerr(SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET, ERR_R_INTERNAL_ERROR);
         goto err;
     }
@@ -3123,8 +3123,7 @@ int tls_construct_cert_status(SSL *s)
     WPACKET pkt;
 
     if (!WPACKET_init(&pkt, s->init_buf)
-            || !ssl_set_handshake_header2(s, &pkt,
-                                          SSL3_MT_CERTIFICATE_STATUS)
+            || !ssl_set_handshake_header(s, &pkt, SSL3_MT_CERTIFICATE_STATUS)
             || !WPACKET_put_bytes_u8(&pkt, s->tlsext_status_type)
             || !WPACKET_sub_memcpy_u24(&pkt, s->tlsext_ocsp_resp,
                                        s->tlsext_ocsp_resplen)
index 9c110816218345d2a99ce3d94fb99cb12d7a7fcf..71c480f4029e1a4587e5f44939398ba959310b4c 100644 (file)
@@ -40,7 +40,7 @@ SSL3_ENC_METHOD const TLSv1_enc_data = {
     tls1_export_keying_material,
     0,
     SSL3_HM_HEADER_LENGTH,
-    ssl3_set_handshake_header2,
+    ssl3_set_handshake_header,
     tls_close_construct_packet,
     ssl3_handshake_write
 };
@@ -59,7 +59,7 @@ SSL3_ENC_METHOD const TLSv1_1_enc_data = {
     tls1_export_keying_material,
     SSL_ENC_FLAG_EXPLICIT_IV,
     SSL3_HM_HEADER_LENGTH,
-    ssl3_set_handshake_header2,
+    ssl3_set_handshake_header,
     tls_close_construct_packet,
     ssl3_handshake_write
 };
@@ -79,7 +79,7 @@ SSL3_ENC_METHOD const TLSv1_2_enc_data = {
     SSL_ENC_FLAG_EXPLICIT_IV | SSL_ENC_FLAG_SIGALGS | SSL_ENC_FLAG_SHA256_PRF
         | SSL_ENC_FLAG_TLS1_2_CIPHERS,
     SSL3_HM_HEADER_LENGTH,
-    ssl3_set_handshake_header2,
+    ssl3_set_handshake_header,
     tls_close_construct_packet,
     ssl3_handshake_write
 };