Cryptography Reference
In-Depth Information
read_pos = parse_server_hello( read_pos, handshake.length,
parameters );
if ( read_pos == NULL ) /* error occurred */
{
free( msg_buf );
send_alert_message( connection, illegal_parameter );
return -1;
}
break;
default:
printf( “Ignoring unrecognized handshake message %d\n”,
handshake.msg_type );
// Silently ignore any unrecognized types per section 6
// TODO However, out-of-order messages should result in a fatal alert
// per section 7.4
read_pos += handshake.length;
break;
}
}
else
{
// Ignore content types not understood, per section 6 of the RFC.
printf( “Ignoring non-recognized content type %d\n”, message.type );
}
free( msg_buf );
return message.length;
}
As I'm sure you can imagine, you fi ll this out quite a bit more throughout
this chapter. For now, though, just focus on the parse_server_hello function.
The Server Hello message is illustrated in Figure 6-6.
major
minor
current time
random bytes
server
random
random bytes
sess
id
len
session id
(variable)
Comp
meth
random bytes
cipher suites
Figure 6-6: Server Hello structure
As with the client hello, go ahead and defi ne a structure to hold its value in
Listing 6-22.
Search WWH ::




Custom Search