Cryptography Reference
In-Depth Information
explicit_prime = 1,
explicit_char2 = 2,
named = 3
}
ec_curve_type;
typedef enum
{
compressed = 3,
uncompressed = 4
}
ec_point_type;
static char *parse_server_key_exchange( unsigned char *read_pos,
TLSParameters *parameters )
{
short length;
int i;
unsigned char *dh_params = read_pos;
HashAlgorithm hash_alg;
SignatureAlgorithm sig_alg;
hash_alg = read_pos[ 0 ];
sig_alg = read_pos[ 1 ];
read_pos += 2;
switch ( parameters->pending_send_parameters.suite )
{
case TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA:
{
unsigned char curve_type;
unsigned char curve;
unsigned char public_key_length;
unsigned char point_type;
read_pos = read_buffer( ( void * ) &curve_type, read_pos, 1 );
switch ( curve_type )
{
case named:
// named curve takes up two bytes, but only one is populated
read_pos += 1;
read_pos = read_buffer( ( void * ) &curve, read_pos, 1 );
switch ( curve )
{
case secp256r1:
get_named_curve( “prime256v1”,
&parameters->server_ecdh_params );
break;
default:
fprintf( stderr, “error, unsupported named curve %d\n”, curve );
(Continued)
Search WWH ::




Custom Search