- Changed the used random function pointer to more flexible format. Renamed havege_rand() to havege_random() to prevent mistakes. Lots of changes as a consequence in library code and programs

This commit is contained in:
Paul Bakker 2011-11-27 21:07:34 +00:00
parent 880ac7eb95
commit a3d195c41f
31 changed files with 232 additions and 119 deletions

View file

@ -359,7 +359,7 @@ have_ciphersuite:
static int ssl_write_server_hello( ssl_context *ssl )
{
time_t t;
int ret, i, n;
int ret, n;
unsigned char *buf, *p;
SSL_DEBUG_MSG( 2, ( "=> write server hello" ) );
@ -388,8 +388,10 @@ static int ssl_write_server_hello( ssl_context *ssl )
SSL_DEBUG_MSG( 3, ( "server hello, current time: %lu", t ) );
for( i = 28; i > 0; i-- )
*p++ = (unsigned char) ssl->f_rng( ssl->p_rng );
if( ( ret = ssl->f_rng( ssl->p_rng, p, 28 ) ) != 0 )
return( ret );
p += 28;
memcpy( ssl->randbytes + 32, buf + 6, 32 );
@ -413,9 +415,8 @@ static int ssl_write_server_hello( ssl_context *ssl )
ssl->resume = 0;
ssl->state++;
for( i = 0; i < n; i++ )
ssl->session->id[i] =
(unsigned char) ssl->f_rng( ssl->p_rng );
if( ( ret = ssl->f_rng( ssl->p_rng, ssl->session->id, n ) ) != 0 )
return( ret );
}
else
{
@ -823,8 +824,9 @@ static int ssl_parse_client_key_exchange( ssl_context *ssl )
*/
ssl->pmslen = 48;
for( i = 0; i < ssl->pmslen; i++ )
ssl->premaster[i] = (unsigned char) ssl->f_rng( ssl->p_rng );
ret = ssl->f_rng( ssl->p_rng, ssl->premaster, ssl->pmslen );
if( ret != 0 )
return( ret );
}
}