Cryptography Reference
In-Depth Information
parameters->server_public_key.modulus = malloc( sizeof( huge ) );
parameters->server_public_key.exponent = malloc( sizeof( huge ) );
set_huge( parameters->server_public_key.modulus, 0 );
set_huge( parameters->server_public_key.exponent, 0 );
parameters->unread_buffer = NULL;
parameters->unread_length = 0;
}
You can easily match the remaining function calls with the sequence diagram
in Figure C-2. If this function runs to completion, the caller can assume that a
secure channel has been successfully negotiated and, for the most part, does
not need to worry about it again. An implementation of each of the handshake
functions is presented next.
SSL Client Hello
The client is responsible for initiating an SSL handshake by sending the
ClientHello message. If this isn't the fi rst message that is sent, the server responds
with an error and shuts down the socket. So what does this message look like?
Listing C-10 defi nes in in C struct form.
Listing C-10: “ssl.h” ClientHello declaration
typedef struct
{
unsigned char version_major;
unsigned char version_minor;
unsigned short cipher_specs_length;
unsigned short session_id_length;
unsigned short challenge_length;
unsigned char *cipher_specs;
unsigned char *session_id;
unsigned char *challenge;
}
ClientHello;
I examine the specifi cs of the wire format in a minute, but fi rst examine the
contents of the client hello message. As you see, the client starts by announcing
the version of SSL that it understands. You might expect this to be 2.0, but SSLv2
is actually version 0.2! Although SSLv2 was pretty widespread at one time, the
designers considered it to be fairly experimental when it was proposed. It was
never even actually offi cially “released.”
Following the version number are the cipher specs that this client understands,
a sessionID , and the challenge token. I have discussed the cipher specs and
the challenge token, and session IDs are in place to support session resumption
as detailed in Chapter 8.
 
Search WWH ::




Custom Search