Make init_msg a uint8_t*.
It's current a void* and gets explicitly cast everywhere. Make it a uint8_t and
only add the casts when converting it come init_buf, which internally stores a
char*.
Change-Id: I28bed129e46ed37ee1ce378d5c3bd0738fc1177f
Reviewed-on: https://boringssl-review.googlesource.com/1163
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index 4e854a2..570514b 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -439,7 +439,7 @@
goto f_err;
}
*ok=1;
- s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
+ s->init_msg = (uint8_t*)s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
s->init_num = (int)s->s3->tmp.message_size;
return s->init_num;
}
@@ -481,7 +481,7 @@
if (!s->d1->listen)
s->d1->handshake_read_seq++;
- s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
+ s->init_msg = (uint8_t*)s->init_buf->data + DTLS1_HM_HEADER_LENGTH;
return s->init_num;
f_err:
diff --git a/ssl/d1_clnt.c b/ssl/d1_clnt.c
index 2e02572..15e02a1 100644
--- a/ssl/d1_clnt.c
+++ b/ssl/d1_clnt.c
@@ -622,7 +622,7 @@
return(1);
}
- data = (unsigned char *)s->init_msg;
+ data = s->init_msg;
#if 0
if (s->method->version != DTLS_ANY_VERSION &&
((data[0] != (s->version>>8)) || (data[1] != (s->version&0xff))))
diff --git a/ssl/s3_both.c b/ssl/s3_both.c
index cdbcb66..d4698aa 100644
--- a/ssl/s3_both.c
+++ b/ssl/s3_both.c
@@ -254,7 +254,7 @@
}
s->s3->change_cipher_spec=0;
- p = (unsigned char *)s->init_msg;
+ p = s->init_msg;
i = s->s3->tmp.peer_finish_md_len;
if (i != n)
@@ -358,7 +358,7 @@
goto f_err;
}
*ok=1;
- s->init_msg = s->init_buf->data + 4;
+ s->init_msg = (uint8_t*)s->init_buf->data + 4;
s->init_num = (int)s->s3->tmp.message_size;
return s->init_num;
}
@@ -445,7 +445,7 @@
s->s3->tmp.message_size=l;
s->state=stn;
- s->init_msg = s->init_buf->data + 4;
+ s->init_msg = (uint8_t*)s->init_buf->data + 4;
s->init_num = 0;
}
diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
index a28fd33..a998a1e 100644
--- a/ssl/s3_clnt.c
+++ b/ssl/s3_clnt.c
@@ -913,7 +913,7 @@
goto f_err;
}
- d=p=(unsigned char *)s->init_msg;
+ d = p = s->init_msg;
if (s->method->version == DTLS_ANY_VERSION)
{
/* Work out correct protocol version to use */
@@ -1120,7 +1120,7 @@
if (!ok) return((int)n);
- CBS_init(&cbs, (uint8_t *)s->init_msg, n);
+ CBS_init(&cbs, s->init_msg, n);
if ((sk=sk_X509_new_null()) == NULL)
{
@@ -1316,7 +1316,7 @@
return(1);
}
- param=p=(unsigned char *)s->init_msg;
+ param = p = s->init_msg;
if (s->session->sess_cert != NULL)
{
if (s->session->sess_cert->peer_rsa_tmp != NULL)
@@ -1822,7 +1822,7 @@
}
}
- CBS_init(&cbs, (uint8_t *)s->init_msg, n);
+ CBS_init(&cbs, s->init_msg, n);
ca_sk = sk_X509_NAME_new(ca_dn_cmp);
if (ca_sk == NULL)
@@ -1964,7 +1964,7 @@
goto f_err;
}
- p=d=(unsigned char *)s->init_msg;
+ p = d = s->init_msg;
n2l(p, s->session->tlsext_tick_lifetime_hint);
n2s(p, ticklen);
/* ticket_lifetime_hint + ticket_length + ticket */
@@ -2038,7 +2038,7 @@
OPENSSL_PUT_ERROR(SSL, ssl3_get_cert_status, SSL_R_LENGTH_MISMATCH);
goto f_err;
}
- p = (unsigned char *)s->init_msg;
+ p = s->init_msg;
if (*p++ != TLSEXT_STATUSTYPE_ocsp)
{
al = SSL_AD_DECODE_ERROR;
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c
index b7c1072..eec8680 100644
--- a/ssl/s3_srvr.c
+++ b/ssl/s3_srvr.c
@@ -889,7 +889,7 @@
if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE)
{
unsigned int session_length, cookie_length;
- p = (unsigned char *) s->init_msg;
+ p = s->init_msg;
if (n < 2 + SSL3_RANDOM_SIZE)
return 1;
@@ -945,7 +945,7 @@
return -1;
}
- d=p=(unsigned char *)s->init_msg;
+ d = p = s->init_msg;
/* use version from inside client hello, not from record header
* (may differ: see RFC 2246, Appendix E, second paragraph) */
@@ -2054,7 +2054,7 @@
&ok);
if (!ok) return((int)n);
- p=(unsigned char *)s->init_msg;
+ p = s->init_msg;
alg_k=s->s3->tmp.new_cipher->algorithm_mkey;
alg_a=s->s3->tmp.new_cipher->algorithm_auth;
@@ -2675,7 +2675,7 @@
}
/* we now have a signature that we need to verify */
- p=(unsigned char *)s->init_msg;
+ p = s->init_msg;
if (SSL_USE_SIGALGS(s))
{
int rv = tls12_check_peer_sigalg(&md, s, p, pkey);
@@ -2864,7 +2864,7 @@
goto f_err;
}
- CBS_init(&certificate_msg, (uint8_t *)s->init_msg, n);
+ CBS_init(&certificate_msg, s->init_msg, n);
if ((sk=sk_X509_new_null()) == NULL)
{
@@ -3221,7 +3221,7 @@
return -1;
}
- CBS_init(&next_protocol, (uint8_t *)s->init_msg, n);
+ CBS_init(&next_protocol, s->init_msg, n);
/* The payload looks like:
* uint8 proto_len;
@@ -3294,7 +3294,7 @@
return -1;
}
- CBS_init(&encrypted_extensions, (uint8_t *)s->init_msg, n);
+ CBS_init(&encrypted_extensions, s->init_msg, n);
/* EncryptedExtensions could include multiple extensions, but
* the only extension that could be negotiated is ChannelID,
diff --git a/ssl/ssl.h b/ssl/ssl.h
index fa2fffc..7f23cc7 100644
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -1312,7 +1312,7 @@
int rstate; /* where we are when reading */
BUF_MEM *init_buf; /* buffer used during init */
- void *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */
+ uint8_t *init_msg; /* pointer to handshake message body, set by ssl3_get_message() */
int init_num; /* amount read/written */
int init_off; /* amount read/written */