Cryptography Reference
In-Depth Information
Listing 6-14: “tls.h” handshake structure
/**
* Handshake message types (section 7.4)
*/
typedef enum
{
hello_request = 0,
client_hello = 1,
server_hello = 2,
certificate = 11,
server_key_exchange = 12,
certificate_request = 13,
server_hello_done = 14,
certificate_verify = 15,
client_key_exchange = 16,
finished = 20
}
HandshakeType;
/**
* Handshake record definition (section 7.4)
*/
typedef struct
{
unsigned char msg_type;
unsigned int length; // 24 bits(!)
}
Handshake;
This structure is illustrated in Figure 6-3.
msg
type
handshake message
body (variable)
length
Figure 6-3: TLS handshake header
The send_handshake_message function that prepends this header to a hand-
shake message is shown in Listing 6-15.
Listing 6-15: “tls.c” send_handshake_message
static int send_handshake_message( int connection,
int msg_type,
const unsigned char *message,
int message_len )
{
Handshake record;
short send_buffer_size;
unsigned char *send_buffer;
Search WWH ::




Custom Search