mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-05-09 16:52:12 +00:00
tinyCrypt: Write client's key share
This commit is contained in:
parent
a3c2c1712c
commit
621113fd3a
|
@ -3562,9 +3562,13 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl,
|
||||||
#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */
|
#endif /* MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED */
|
||||||
#if defined(MBEDTLS_USE_TINYCRYPT)
|
#if defined(MBEDTLS_USE_TINYCRYPT)
|
||||||
if( mbedtls_ssl_suite_get_key_exchange( ciphersuite_info )
|
if( mbedtls_ssl_suite_get_key_exchange( ciphersuite_info )
|
||||||
== MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA)
|
== MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA ||
|
||||||
|
mbedtls_ssl_suite_get_key_exchange( ciphersuite_info )
|
||||||
|
== MBEDTLS_KEY_EXCHANGE_ECDHE_RSA )
|
||||||
{
|
{
|
||||||
const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
|
const struct uECC_Curve_t * uecc_curve = uECC_secp256r1();
|
||||||
|
((void) n);
|
||||||
|
((void) ret);
|
||||||
|
|
||||||
if( !uECC_make_key( ssl->handshake->ecdh_ownpubkey,
|
if( !uECC_make_key( ssl->handshake->ecdh_ownpubkey,
|
||||||
ssl->handshake->ecdh_privkey,
|
ssl->handshake->ecdh_privkey,
|
||||||
|
@ -3573,13 +3577,13 @@ static int ssl_out_client_key_exchange_write( mbedtls_ssl_context *ssl,
|
||||||
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Write the client share. */
|
if( (size_t)( end - p ) < 2 * NUM_ECC_BYTES + 2 )
|
||||||
((void) p);
|
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
||||||
((void) end);
|
|
||||||
((void) ret);
|
|
||||||
((void) n);
|
|
||||||
|
|
||||||
mbedtls_platform_zeroize( ssl->handshake->ecdh_privkey, NUM_ECC_BYTES );
|
*p++ = 2 * NUM_ECC_BYTES + 1;
|
||||||
|
*p++ = 0x04; /* uncompressed point presentation */
|
||||||
|
memcpy( p, ssl->handshake->ecdh_ownpubkey, 2 * NUM_ECC_BYTES );
|
||||||
|
p += 2 * NUM_ECC_BYTES;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#elif defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
|
#elif defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
|
||||||
|
|
Loading…
Reference in a new issue