提交 a6a48e87 编写于 作者: B Ben Laurie

Make it build.

上级 36086186
...@@ -2463,7 +2463,7 @@ static int authz_tlsext_generate_cb(SSL *s, unsigned short ext_type, ...@@ -2463,7 +2463,7 @@ static int authz_tlsext_generate_cb(SSL *s, unsigned short ext_type,
return 1; return 1;
} }
} }
//no auth extension to send /* no auth extension to send */
return -1; return -1;
} }
...@@ -2496,7 +2496,7 @@ static int auth_suppdata_generate_cb(SSL *s, unsigned short supp_data_type, ...@@ -2496,7 +2496,7 @@ static int auth_suppdata_generate_cb(SSL *s, unsigned short supp_data_type,
return 1; return 1;
} }
} }
//no supplemental data to send /* no supplemental data to send */
return -1; return -1;
} }
......
...@@ -3598,7 +3598,7 @@ static int authz_tlsext_generate_cb(SSL *s, unsigned short ext_type, ...@@ -3598,7 +3598,7 @@ static int authz_tlsext_generate_cb(SSL *s, unsigned short ext_type,
return 1; return 1;
} }
} }
//no auth extension to send /* no auth extension to send */
return -1; return -1;
} }
...@@ -3631,7 +3631,7 @@ static int auth_suppdata_generate_cb(SSL *s, unsigned short supp_data_type, ...@@ -3631,7 +3631,7 @@ static int auth_suppdata_generate_cb(SSL *s, unsigned short supp_data_type,
return 1; return 1;
} }
} }
//no supplemental data to send /* no supplemental data to send */
return -1; return -1;
} }
#endif #endif
......
...@@ -3645,7 +3645,7 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip) ...@@ -3645,7 +3645,7 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip)
SSLerr(SSL_F_TLS1_SEND_CLIENT_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB); SSLerr(SSL_F_TLS1_SEND_CLIENT_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB);
return 0; return 0;
} }
//if first entry, write handshake message type /* if first entry, write handshake message type */
if (length == 0) if (length == 0)
{ {
if (!BUF_MEM_grow_clean(s->init_buf, 4)) if (!BUF_MEM_grow_clean(s->init_buf, 4))
...@@ -3655,9 +3655,12 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip) ...@@ -3655,9 +3655,12 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip)
} }
p = (unsigned char *)s->init_buf->data; p = (unsigned char *)s->init_buf->data;
*(p++) = SSL3_MT_SUPPLEMENTAL_DATA; *(p++) = SSL3_MT_SUPPLEMENTAL_DATA;
//update message length when all callbacks complete /* update message length when all
* callbacks complete */
size_loc = p; size_loc = p;
//skip over handshake length field (3 bytes) and supp_data length field (3 bytes) /* skip over handshake length field (3
* bytes) and supp_data length field
* (3 bytes) */
p += 3 + 3; p += 3 + 3;
length += 1 +3 +3; length += 1 +3 +3;
} }
...@@ -3674,9 +3677,9 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip) ...@@ -3674,9 +3677,9 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip)
} }
if (length > 0) if (length > 0)
{ {
//write handshake length /* write handshake length */
l2n3(length - 4, size_loc); l2n3(length - 4, size_loc);
//supp_data length /* supp_data length */
l2n3(length - 7, size_loc); l2n3(length - 7, size_loc);
s->state = SSL3_ST_CW_SUPPLEMENTAL_DATA_B; s->state = SSL3_ST_CW_SUPPLEMENTAL_DATA_B;
s->init_num = length; s->init_num = length;
...@@ -3685,7 +3688,7 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip) ...@@ -3685,7 +3688,7 @@ int tls1_send_client_supplemental_data(SSL *s, int *skip)
} }
} }
//no supp data message sent /* no supp data message sent */
*skip = 1; *skip = 1;
s->init_num = 0; s->init_num = 0;
s->init_off = 0; s->init_off = 0;
...@@ -3728,7 +3731,7 @@ int tls1_get_server_supplemental_data(SSL *s) ...@@ -3728,7 +3731,7 @@ int tls1_get_server_supplemental_data(SSL *s)
{ {
n2s(p, supp_data_entry_type); n2s(p, supp_data_entry_type);
n2s(p, supp_data_entry_len); n2s(p, supp_data_entry_len);
//if there is a callback for this supp data type, send it /* if there is a callback for this supp data type, send it */
for (i=0; i < s->ctx->cli_supp_data_records_count; i++) for (i=0; i < s->ctx->cli_supp_data_records_count; i++)
{ {
if (s->ctx->cli_supp_data_records[i].supp_data_type == supp_data_entry_type && s->ctx->cli_supp_data_records[i].fn1) if (s->ctx->cli_supp_data_records[i].supp_data_type == supp_data_entry_type && s->ctx->cli_supp_data_records[i].fn1)
......
...@@ -3734,12 +3734,13 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip) ...@@ -3734,12 +3734,13 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip)
SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB); SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB);
return 0; return 0;
} }
//write supp data entry... /* write supp data entry...
//if first entry, write handshake message type * if first entry, write handshake message type
//jump back to write length at end * jump back to write length at end */
if (length == 0) if (length == 0)
{ {
//1 byte message type + 3 bytes for message length /* 1 byte message type + 3 bytes for
* message length */
if (!BUF_MEM_grow_clean(s->init_buf, 4)) if (!BUF_MEM_grow_clean(s->init_buf, 4))
{ {
SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB); SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB);
...@@ -3747,13 +3748,15 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip) ...@@ -3747,13 +3748,15 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip)
} }
p = (unsigned char *)s->init_buf->data; p = (unsigned char *)s->init_buf->data;
*(p++) = SSL3_MT_SUPPLEMENTAL_DATA; *(p++) = SSL3_MT_SUPPLEMENTAL_DATA;
//hold on to length field to update later /* hold on to length field to update later */
size_loc = p; size_loc = p;
//skip over handshake length field (3 bytes) and supp_data length field (3 bytes) /* skip over handshake length field (3
* bytes) and supp_data length field
* (3 bytes) */
p += 3 + 3; p += 3 + 3;
length += 1 +3 +3; length += 1 +3 +3;
} }
//2 byte supp data type + 2 byte length + outlen /* 2 byte supp data type + 2 byte length + outlen */
if (!BUF_MEM_grow(s->init_buf, outlen + 4)) if (!BUF_MEM_grow(s->init_buf, outlen + 4))
{ {
SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB); SSLerr(SSL_F_TLS1_SEND_SERVER_SUPPLEMENTAL_DATA,ERR_R_BUF_LIB);
...@@ -3762,15 +3765,16 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip) ...@@ -3762,15 +3765,16 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip)
s2n(record->supp_data_type, p); s2n(record->supp_data_type, p);
s2n(outlen, p); s2n(outlen, p);
memcpy(p, out, outlen); memcpy(p, out, outlen);
//update length to supp data type (2 bytes) + supp data length (2 bytes) + supp data /* update length to supp data type (2 bytes) +
* supp data length (2 bytes) + supp data */
length += (outlen + 4); length += (outlen + 4);
p += outlen; p += outlen;
} }
if (length > 0) if (length > 0)
{ {
//write handshake length /* write handshake length */
l2n3(length - 4, size_loc); l2n3(length - 4, size_loc);
//supp_data length /* supp_data length */
l2n3(length - 7, size_loc); l2n3(length - 7, size_loc);
s->state = SSL3_ST_SW_SUPPLEMENTAL_DATA_B; s->state = SSL3_ST_SW_SUPPLEMENTAL_DATA_B;
s->init_num = length; s->init_num = length;
...@@ -3780,7 +3784,7 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip) ...@@ -3780,7 +3784,7 @@ int tls1_send_server_supplemental_data(SSL *s, int *skip)
} }
} }
//no supp data message sent /* no supp data message sent */
*skip = 1; *skip = 1;
s->init_num = 0; s->init_num = 0;
s->init_off = 0; s->init_off = 0;
...@@ -3824,7 +3828,7 @@ int tls1_get_client_supplemental_data(SSL *s) ...@@ -3824,7 +3828,7 @@ int tls1_get_client_supplemental_data(SSL *s)
{ {
n2s(p, supp_data_entry_type); n2s(p, supp_data_entry_type);
n2s(p, supp_data_entry_len); n2s(p, supp_data_entry_len);
//if there is a callback for this supp data type, send it /* if there is a callback for this supp data type, send it */
for (i=0; i < s->ctx->srv_supp_data_records_count; i++) for (i=0; i < s->ctx->srv_supp_data_records_count; i++)
{ {
if (s->ctx->srv_supp_data_records[i].supp_data_type == supp_data_entry_type && s->ctx->srv_supp_data_records[i].fn2) if (s->ctx->srv_supp_data_records[i].supp_data_type == supp_data_entry_type && s->ctx->srv_supp_data_records[i].fn2)
......
...@@ -1766,20 +1766,37 @@ bad: ...@@ -1766,20 +1766,37 @@ bad:
if (suppdata) if (suppdata)
{ {
//TEST CASES /* TEST CASES */
//client and server both send and receive, verify additional arg passed back /* client and server both send and receive, verify
SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_0, supp_data_0_srv_first_cb, supp_data_0_srv_second_cb, s_ssl); * additional arg passed back */
SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_0, supp_data_0_cli_first_cb, supp_data_0_cli_second_cb, c_ssl); SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_0,
supp_data_0_srv_first_cb,
//-1 response from sending server/client doesn't receive, -1 response from sending client/server doesn't receive supp_data_0_srv_second_cb, s_ssl);
SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_1, supp_data_1_srv_first_cb, supp_data_1_srv_second_cb, NULL); SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_0,
SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_1, supp_data_1_cli_first_cb, supp_data_1_cli_second_cb, NULL); supp_data_0_cli_first_cb,
supp_data_0_cli_second_cb, c_ssl);
//null sending server/client doesn't receive, null sending client/server doesn't receive
SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_2, /*supp_data_2_srv_first_cb*/NULL, supp_data_2_srv_second_cb, NULL); /* -1 response from sending server/client doesn't
SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_2, supp_data_2_cli_first_cb, /*supp_data_2_cli_second_cb*/NULL, NULL); * receive, -1 response from sending client/server
* doesn't receive */
//alerts set to non-zero and zero return values not tested SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_1,
supp_data_1_srv_first_cb,
supp_data_1_srv_second_cb, NULL);
SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_1,
supp_data_1_cli_first_cb,
supp_data_1_cli_second_cb, NULL);
/* null sending server/client doesn't receive, null
sending client/server doesn't receive */
SSL_CTX_set_srv_supp_data(s_ctx, CUSTOM_SUPP_DATA_TYPE_2,
/*supp_data_2_srv_first_cb*/NULL,
supp_data_2_srv_second_cb, NULL);
SSL_CTX_set_cli_supp_data(c_ctx, CUSTOM_SUPP_DATA_TYPE_2,
supp_data_2_cli_first_cb,
/*supp_data_2_cli_second_cb*/NULL,
NULL);
/* alerts set to non-zero and zero return values not tested */
} }
#ifndef OPENSSL_NO_KRB5 #ifndef OPENSSL_NO_KRB5
if (c_ssl && c_ssl->kssl_ctx) if (c_ssl && c_ssl->kssl_ctx)
......
...@@ -1086,19 +1086,6 @@ void ssl_set_client_disabled(SSL *s) ...@@ -1086,19 +1086,6 @@ void ssl_set_client_disabled(SSL *s)
c->valid = 1; c->valid = 1;
} }
/* byte_compare is a compare function for qsort(3) that compares bytes. */
static int byte_compare(const void *in_a, const void *in_b)
{
unsigned char a = *((const unsigned char*) in_a);
unsigned char b = *((const unsigned char*) in_b);
if (a > b)
return 1;
else if (a < b)
return -1;
return 0;
}
unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit) unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned char *limit)
{ {
int extdatalen=0; int extdatalen=0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册