Cryptography Reference
In-Depth Information
// Record the verify data for later secure renegotiation
memcpy( parameters->connection_end == connection_end_client ?
parameters->server_verify_data : parameters->client_verify_data,
verify_data, VERIFY_DATA_LEN );
4. Add client hello extension capabilities to send_client_hello as shown
in Listing 8-41.
Listing 8-41: “tls.c” client hello extension capability
typedef enum
{
server_name = 0,
secure_renegotiation = 0xFF01
}
ExtensionType;
static unsigned short add_client_hello_extensions( unsigned char **extensions,
TLSParameters *parameters,
int renegotiating )
{
unsigned char *write_ptr;
unsigned short extensions_length;
unsigned short extension_type;
unsigned char *renegotiation_extension;
unsigned short renegotiation_extension_length;
extensions_length = 0;
if ( parameters->support_secure_renegotiation )
{
renegotiation_extension_length =
add_renegotiation_extension( &renegotiation_extension,
renegotiating, parameters );
extensions_length += renegotiation_extension_length +
sizeof( unsigned short ) + 2;
}
if ( extensions_length )
{
write_ptr = *extensions = ( unsigned char * ) malloc(
extensions_length );
memset( *extensions, '\0', extensions_length );
// Insert the renegotiation extension
extension_type = htons( secure_renegotiation );
write_ptr = append_buffer( write_ptr, ( void * ) &extension_type,
sizeof( unsigned short ) );
(Continued)
 
Search WWH ::




Custom Search