tinyCrypt: Don't store public ECDH-share in handshake struct

Instead, write it to the message buffer directly.
This commit is contained in:
Hanno Becker 2019-07-24 12:45:52 +01:00
parent b1626fb619
commit 8295ff0b04
3 changed files with 14 additions and 20 deletions

View file

@ -3576,19 +3576,17 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl,
((void) n);
((void) ret);
if( !uECC_make_key( ssl->handshake->ecdh_ownpubkey,
ssl->handshake->ecdh_privkey,
uecc_curve ) )
{
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
}
if( (size_t)( end - p ) < 2 * NUM_ECC_BYTES + 2 )
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
*p++ = 2 * NUM_ECC_BYTES + 1;
*p++ = 0x04; /* uncompressed point presentation */
memcpy( p, ssl->handshake->ecdh_ownpubkey, 2 * NUM_ECC_BYTES );
if( !uECC_make_key( p, ssl->handshake->ecdh_privkey,
uecc_curve ) )
{
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
}
p += 2 * NUM_ECC_BYTES;
}
else