Browse Source

Rename some message functions for consistency.

Make the get/send functions match.

ssl3_client_hello -> ssl3_send_client_hello.
ssl3_send_newsession_ticket -> ssl3_send_new_session_ticket.
ssl3_send_client_verify -> ssl3_send_cert_verify

Change-Id: Iea5579479b8a8f392167b8fb3b7e9fe961d0f007
Reviewed-on: https://boringssl-review.googlesource.com/1613
Reviewed-by: Adam Langley <agl@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 10 years ago
committed by Adam Langley
parent
commit
8da990677b
7 changed files with 28 additions and 29 deletions
  1. +2
    -2
      include/openssl/ssl.h
  2. +2
    -2
      ssl/d1_clnt.c
  3. +1
    -1
      ssl/d1_srvr.c
  4. +16
    -16
      ssl/s3_clnt.c
  5. +2
    -2
      ssl/s3_srvr.c
  6. +2
    -2
      ssl/ssl_error.c
  7. +3
    -4
      ssl/ssl_locl.h

+ 2
- 2
include/openssl/ssl.h View File

@@ -2383,7 +2383,7 @@ OPENSSL_EXPORT void ERR_load_SSL_strings(void);
#define SSL_F_tls1_setup_key_block 183
#define SSL_F_SSL_set_fd 184
#define SSL_F_SSL_check_private_key 185
#define SSL_F_ssl3_send_client_verify 186
#define SSL_F_ssl3_send_cert_verify 186
#define SSL_F_ssl3_write_pending 187
#define SSL_F_ssl_cert_inst 188
#define SSL_F_ssl3_change_cipher_state 189
@@ -2410,7 +2410,7 @@ OPENSSL_EXPORT void ERR_load_SSL_strings(void);
#define SSL_F_SSL_SESSION_new 210
#define SSL_F_check_suiteb_cipher_list 211
#define SSL_F_ssl_scan_clienthello_tlsext 212
#define SSL_F_ssl3_client_hello 213
#define SSL_F_ssl3_send_client_hello 213
#define SSL_F_SSL_use_RSAPrivateKey_ASN1 214
#define SSL_F_ssl3_ctrl 215
#define SSL_F_ssl3_setup_write_buffer 216


+ 2
- 2
ssl/d1_clnt.c View File

@@ -245,7 +245,7 @@ int dtls1_connect(SSL *s)
ssl3_init_finished_mac(s);

dtls1_start_timer(s);
ret=ssl3_client_hello(s);
ret=ssl3_send_client_hello(s);
if (ret <= 0) goto end;

if ( s->d1->send_cookie)
@@ -393,7 +393,7 @@ int dtls1_connect(SSL *s)
case SSL3_ST_CW_CERT_VRFY_A:
case SSL3_ST_CW_CERT_VRFY_B:
dtls1_start_timer(s);
ret=ssl3_send_client_verify(s);
ret=ssl3_send_cert_verify(s);
if (ret <= 0) goto end;
s->state=SSL3_ST_CW_CHANGE_A;
s->init_num=0;


+ 1
- 1
ssl/d1_srvr.c View File

@@ -547,7 +547,7 @@ int dtls1_accept(SSL *s)

case SSL3_ST_SW_SESSION_TICKET_A:
case SSL3_ST_SW_SESSION_TICKET_B:
ret=ssl3_send_newsession_ticket(s);
ret=ssl3_send_new_session_ticket(s);
if (ret <= 0) goto end;
s->state=SSL3_ST_SW_CHANGE_A;
s->init_num=0;


+ 16
- 16
ssl/s3_clnt.c View File

@@ -261,7 +261,7 @@ int ssl3_connect(SSL *s)
case SSL3_ST_CW_CLNT_HELLO_B:

s->shutdown=0;
ret=ssl3_client_hello(s);
ret=ssl3_send_client_hello(s);
if (ret <= 0) goto end;
s->state=SSL3_ST_CR_SRVR_HELLO_A;
s->init_num=0;
@@ -379,7 +379,7 @@ int ssl3_connect(SSL *s)

case SSL3_ST_CW_CERT_VRFY_A:
case SSL3_ST_CW_CERT_VRFY_B:
ret=ssl3_send_client_verify(s);
ret=ssl3_send_cert_verify(s);
if (ret <= 0) goto end;
s->state=SSL3_ST_CW_CHANGE_A;
s->init_num=0;
@@ -616,7 +616,7 @@ end:
}


int ssl3_client_hello(SSL *s)
int ssl3_send_client_hello(SSL *s)
{
unsigned char *buf;
unsigned char *p,*d;
@@ -647,7 +647,7 @@ int ssl3_client_hello(SSL *s)
*/
if (options & SSL_OP_NO_DTLSv1)
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, SSL_R_WRONG_SSL_VERSION);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, SSL_R_WRONG_SSL_VERSION);
goto err;
}
/* Update method so we don't use any DTLS 1.2
@@ -735,7 +735,7 @@ int ssl3_client_hello(SSL *s)
{
if (i > (int)sizeof(s->session->session_id))
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, ERR_R_INTERNAL_ERROR);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, ERR_R_INTERNAL_ERROR);
goto err;
}
memcpy(p,s->session->session_id,i);
@@ -747,7 +747,7 @@ int ssl3_client_hello(SSL *s)
{
if ( s->d1->cookie_len > sizeof(s->d1->cookie))
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, ERR_R_INTERNAL_ERROR);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, ERR_R_INTERNAL_ERROR);
goto err;
}
*(p++) = s->d1->cookie_len;
@@ -759,7 +759,7 @@ int ssl3_client_hello(SSL *s)
i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0)
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, SSL_R_NO_CIPHERS_AVAILABLE);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, SSL_R_NO_CIPHERS_AVAILABLE);
goto err;
}
s2n(i,p);
@@ -772,12 +772,12 @@ int ssl3_client_hello(SSL *s)
/* TLS extensions*/
if (ssl_prepare_clienthello_tlsext(s) <= 0)
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, SSL_R_CLIENTHELLO_TLSEXT);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, SSL_R_CLIENTHELLO_TLSEXT);
goto err;
}
if ((p = ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH, p-buf)) == NULL)
{
OPENSSL_PUT_ERROR(SSL, ssl3_client_hello, ERR_R_INTERNAL_ERROR);
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_hello, ERR_R_INTERNAL_ERROR);
goto err;
}
@@ -2305,7 +2305,7 @@ err:
return(-1);
}

int ssl3_send_client_verify(SSL *s)
int ssl3_send_cert_verify(SSL *s)
{
unsigned char *buf, *p;
const EVP_MD *md;
@@ -2336,7 +2336,7 @@ int ssl3_send_client_verify(SSL *s)
if (!BIO_mem_contents(s->s3->handshake_buffer, &hdata, &hdatalen) ||
!tls12_get_sigandhash(p, pkey, md))
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, ERR_R_INTERNAL_ERROR);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, ERR_R_INTERNAL_ERROR);
goto err;
}
p += 2;
@@ -2345,7 +2345,7 @@ int ssl3_send_client_verify(SSL *s)
|| !EVP_DigestUpdate(&mctx, hdata, hdatalen)
|| !EVP_DigestFinal(&mctx, digest, &digest_length))
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, ERR_R_EVP_LIB);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, ERR_R_EVP_LIB);
goto err;
}
}
@@ -2368,7 +2368,7 @@ int ssl3_send_client_verify(SSL *s)
}
else
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, ERR_R_INTERNAL_ERROR);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, ERR_R_INTERNAL_ERROR);
goto err;
}

@@ -2383,20 +2383,20 @@ int ssl3_send_client_verify(SSL *s)
EVP_PKEY_sign(pctx, NULL, &signature_length,
digest, digest_length) != 1)
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, ERR_R_EVP_LIB);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, ERR_R_EVP_LIB);
goto err;
}

if (p + 2 + signature_length > buf + SSL3_RT_MAX_PLAIN_LENGTH)
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, SSL_R_DATA_LENGTH_TOO_LONG);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, SSL_R_DATA_LENGTH_TOO_LONG);
goto err;
}

if (EVP_PKEY_sign(pctx, &p[2], &signature_length,
digest, digest_length) != 1)
{
OPENSSL_PUT_ERROR(SSL, ssl3_send_client_verify, ERR_R_EVP_LIB);
OPENSSL_PUT_ERROR(SSL, ssl3_send_cert_verify, ERR_R_EVP_LIB);
goto err;
}



+ 2
- 2
ssl/s3_srvr.c View File

@@ -614,7 +614,7 @@ int ssl3_accept(SSL *s)

case SSL3_ST_SW_SESSION_TICKET_A:
case SSL3_ST_SW_SESSION_TICKET_B:
ret=ssl3_send_newsession_ticket(s);
ret=ssl3_send_new_session_ticket(s);
if (ret <= 0) goto end;
s->state=SSL3_ST_SW_CHANGE_A;
s->init_num=0;
@@ -2648,7 +2648,7 @@ int ssl3_send_server_certificate(SSL *s)
}

/* send a new session ticket (not necessarily for a new session) */
int ssl3_send_newsession_ticket(SSL *s)
int ssl3_send_new_session_ticket(SSL *s)
{
if (s->state == SSL3_ST_SW_SESSION_TICKET_A)
{


+ 2
- 2
ssl/ssl_error.c View File

@@ -103,7 +103,7 @@ const ERR_STRING_DATA SSL_error_string_data[] = {
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_change_cipher_state, 0), "ssl3_change_cipher_state"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_check_cert_and_algorithm, 0), "ssl3_check_cert_and_algorithm"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_check_client_hello, 0), "ssl3_check_client_hello"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_client_hello, 0), "ssl3_client_hello"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_client_hello, 0), "ssl3_send_client_hello"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_connect, 0), "ssl3_connect"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_ctrl, 0), "ssl3_ctrl"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_ctx_ctrl, 0), "ssl3_ctx_ctrl"},
@@ -134,7 +134,7 @@ const ERR_STRING_DATA SSL_error_string_data[] = {
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_channel_id, 0), "ssl3_send_channel_id"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_client_certificate, 0), "ssl3_send_client_certificate"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_client_key_exchange, 0), "ssl3_send_client_key_exchange"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_client_verify, 0), "ssl3_send_client_verify"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_cert_verify, 0), "ssl3_send_cert_verify"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_server_certificate, 0), "ssl3_send_server_certificate"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_server_hello, 0), "ssl3_send_server_hello"},
{ERR_PACK(ERR_LIB_SSL, SSL_F_ssl3_send_server_key_exchange, 0), "ssl3_send_server_key_exchange"},


+ 3
- 4
ssl/ssl_locl.h View File

@@ -863,7 +863,7 @@ const SSL_CIPHER *ssl3_get_cipher_by_value(uint16_t value);
uint16_t ssl3_get_cipher_value(const SSL_CIPHER *c);
void ssl3_init_finished_mac(SSL *s);
int ssl3_send_server_certificate(SSL *s);
int ssl3_send_newsession_ticket(SSL *s);
int ssl3_send_new_session_ticket(SSL *s);
int ssl3_send_cert_status(SSL *s);
int ssl3_get_finished(SSL *s,int state_a,int state_b);
int ssl3_setup_key_block(SSL *s);
@@ -957,17 +957,16 @@ void dtls1_start_timer(SSL *s);
void dtls1_stop_timer(SSL *s);
int dtls1_is_timer_expired(SSL *s);
void dtls1_double_timeout(SSL *s);
int dtls1_send_newsession_ticket(SSL *s);
unsigned int dtls1_min_mtu(void);

/* some client-only functions */
int ssl3_client_hello(SSL *s);
int ssl3_send_client_hello(SSL *s);
int ssl3_get_server_hello(SSL *s);
int ssl3_get_certificate_request(SSL *s);
int ssl3_get_new_session_ticket(SSL *s);
int ssl3_get_cert_status(SSL *s);
int ssl3_get_server_done(SSL *s);
int ssl3_send_client_verify(SSL *s);
int ssl3_send_cert_verify(SSL *s);
int ssl3_send_client_certificate(SSL *s);
int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey);
int ssl3_send_client_key_exchange(SSL *s);


Loading…
Cancel
Save