Bladeren bron

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>
kris/onging/CECPQ3_patch15
David Benjamin 10 jaren geleden
committed by Adam Langley
bovenliggende
commit
51b1f7427b
6 gewijzigde bestanden met toevoegingen van 20 en 20 verwijderingen
  1. +2
    -2
      ssl/d1_both.c
  2. +1
    -1
      ssl/d1_clnt.c
  3. +3
    -3
      ssl/s3_both.c
  4. +6
    -6
      ssl/s3_clnt.c
  5. +7
    -7
      ssl/s3_srvr.c
  6. +1
    -1
      ssl/ssl.h

+ 2
- 2
ssl/d1_both.c Bestand weergeven

@@ -439,7 +439,7 @@ long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
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 @@ again:
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:


+ 1
- 1
ssl/d1_clnt.c Bestand weergeven

@@ -622,7 +622,7 @@ static int dtls1_get_hello_verify(SSL *s)
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))))


+ 3
- 3
ssl/s3_both.c Bestand weergeven

@@ -254,7 +254,7 @@ int ssl3_get_finished(SSL *s, int a, int b)
}
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 @@ long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
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 @@ long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
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;
}



+ 6
- 6
ssl/s3_clnt.c Bestand weergeven

@@ -913,7 +913,7 @@ int ssl3_get_server_hello(SSL *s)
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 @@ int ssl3_get_server_certificate(SSL *s)

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 @@ int ssl3_get_key_exchange(SSL *s)
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 @@ int ssl3_get_certificate_request(SSL *s)
}
}

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 @@ int ssl3_get_new_session_ticket(SSL *s)
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 @@ int ssl3_get_cert_status(SSL *s)
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;


+ 7
- 7
ssl/s3_srvr.c Bestand weergeven

@@ -889,7 +889,7 @@ int ssl3_get_client_hello(SSL *s)
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 @@ int ssl3_get_client_hello(SSL *s)
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 @@ int ssl3_get_client_key_exchange(SSL *s)
&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 @@ int ssl3_get_cert_verify(SSL *s)
}

/* 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 @@ int ssl3_get_client_certificate(SSL *s)
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 @@ int ssl3_get_next_proto(SSL *s)
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 @@ int ssl3_get_channel_id(SSL *s)
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,


+ 1
- 1
ssl/ssl.h Bestand weergeven

@@ -1312,7 +1312,7 @@ struct ssl_st
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 */



Laden…
Annuleren
Opslaan