Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver-only ECC: TLS: avoid use of mbedtls_ecp_point_write_binary() (with USE_PSA) #7405

Closed
mpg opened this issue Apr 5, 2023 · 2 comments
Closed
Assignees
Labels
component-tls enhancement size-s Estimated task size: small (~2d)

Comments

@mpg
Copy link
Contributor

mpg commented Apr 5, 2023

Context: see #6839. This is a step towards sub-goal ECP.TLS.
Depends on: #7073

Currently TLS uses mbedtls_ecp_point_write_binary() in one place: client-side in the 1.2 static ECDH key exchanges, where we have a public key as a pk_context (from the peer's certificate) and want it in the PSA public key export/import format.

After #7073, we'll already have a copy of the key in this format inside the pk_context, so a simple memcpy() will do the trick. We can also get other information (ecdh_bits and ecdh_psa_type fields of the handshake structure) directly from the pk_context.

This task is to remove the call to mbedtls_ecp_point_write_binary() and all other ECP functions from ssl_get_ecdh_params_from_cert() when MBEDTLS_USE_PSA_CRYPTO is enabled.

@mpg mpg added enhancement component-tls size-s Estimated task size: small (~2d) labels Apr 5, 2023
@mpg mpg changed the title driver-only ECC: avoid use of mbedtls_ecp_point_write_binary() in TLS driver-only ECP: TLS: avoid use of mbedtls_ecp_point_write_binary() Apr 5, 2023
@mpg mpg changed the title driver-only ECP: TLS: avoid use of mbedtls_ecp_point_write_binary() driver-only ECP: TLS: avoid use of mbedtls_ecp_point_write_binary() (with USE_PSA) Jun 5, 2023
@mpg mpg changed the title driver-only ECP: TLS: avoid use of mbedtls_ecp_point_write_binary() (with USE_PSA) driver-only ECC: TLS: avoid use of mbedtls_ecp_point_write_binary() (with USE_PSA) Jun 15, 2023
@valeriosetti
Copy link
Contributor

valeriosetti commented Jun 15, 2023

@mpg I was checking the code, but it seems to me that what is being requested by this issue is already addressed by some previous PR (#7554):

memcpy(ssl->handshake->ecdh_psa_peerkey, peer_pk->pub_raw, peer_pk->pub_raw_len);

Am I correct?

@mpg
Copy link
Contributor Author

mpg commented Jun 16, 2023

As for #7406, I agree the main part has been done. Unlike #7406, I'm not seeing opportunities for further simplifications here, so I'm closing this issue.

@mpg mpg closed this as completed Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-tls enhancement size-s Estimated task size: small (~2d)
Projects
None yet
Development

No branches or pull requests

2 participants