Cryptography Reference
In-Depth Information
update_digest( &parameters->sha1_handshake_digest, send_buffer,
send_buffer_size );
response = send_message( connection, content_handshake, send_buffer,
send_buffer_size );
4. Because send_handshake_message now takes a new parameter — the
TLSParameters — update the invocations to it to include this, as shown
in Listing 6-49.
Listing 6-49: “tls.c” send_handshake_message updates
static int send_client_hello( int connection, TLSParameters *parameters )
{
status = send_handshake_message( connection, client_hello, send_buffer,
send_buffer_size, parameters );
static int send_client_key_exchange( int connection, TLSParameters *parameters )
{
if ( send_handshake_message( connection, client_key_exchange,
key_exchange_message, key_exchange_message_len, parameters ) )
{
5. Update the running digest within receive_tls_message , if the type of the
message is content_handshake , as in Listing 6-50.
Listing 6-50: “tls.c” receive_tls_message with handshake digest update
static int receive_tls_msg( int connection,
TLSParameters *parameters )
{
if ( message.type == content_handshake )
{
while ( ( read_pos - decrypted_message ) < decrypted_length )
{
Handshake handshake;
// Keep track of beginning of message for handshake digest update below
const unsigned char *handshake_msg_start = read_pos;
update_digest( &parameters->md5_handshake_digest, handshake_msg_start,
handshake.length + 4 );
update_digest( &parameters->sha1_handshake_digest, handshake_msg_start,
handshake.length + 4 );
}
Search WWH ::




Custom Search