Cryptography Reference
In-Depth Information
perror( “Unable to receive client hello” );
send_alert_message( connection, handshake_failure,
&parameters->active_send_parameters );
return 1;
}
}
if ( parameters->session_id_length > 0 )
{
// Client asked for a resumption, and this server recognized the
// session id. Shortened handshake here. “parse_client_hello”
// will have already initiated calculate keys.
if ( send_server_hello( connection, parameters ) )
{
send_alert_message( connection, handshake_failure,
&parameters->active_send_parameters );
return 3;
}
// Can't calculate keys until this point because server random
// is needed.
calculate_keys( parameters );
// send server change cipher spec/finished message
// Order is reversed when resuming
if ( !( send_change_cipher_spec( connection, parameters ) ) )
{
perror( “Unable to send client change cipher spec” );
send_alert_message( connection, handshake_failure,
&parameters->active_send_parameters );
return 7;
}
// This message will be encrypted using the newly negotiated keys
if ( !( send_finished( connection, parameters ) ) )
{
perror( “Unable to send client finished” );
send_alert_message( connection, handshake_failure,
&parameters->active_send_parameters );
return 8;
}
parameters->peer_finished = 0;
while ( !parameters->peer_finished )
{
if ( receive_tls_msg( connection, NULL, 0, parameters ) < 0 )
{
perror( “Unable to receive client finished” );
send_alert_message( connection, handshake_failure,
&parameters->active_send_parameters );
return 6;
}
Search WWH ::




Custom Search