-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Handshake takes too long time. #9288
Comments
How much time is spent in CPU computation vs network exchanges? What is the underlying network protocol? What cipher suite, protocol version and options are negotiated? Realistically, this is the most obvious adjustment variable: make sure that you're using the fastest cryptographic primitives for your configuration.
|
The time spent in the while loop is around 8 seconds. mbedtls_ssl_init(&ssl); // Set up SSL/TLS configuration // Specify the elliptic curves to use (secp256r1 and Curve25519) // Specify the ciphersuites to use (ChaCha20-Poly1305 first) // Setup SSL context // Cleanup |
Note that the client and server can authenticate using different algs, so if you're trying to minimize the load on the client, for a handshake with client authentication you best bet is still ECDHE-RSA + provisioning an ECDSA certificate on the client. To put some numbers on what you wrote (generated with
When A authenticates itself to B: A will perform RSA-private or ECDSA-sign, and B will perform RSA-public or ECDSA-verify. Server authentication is mandatory, and as a client we want that to use RSA so we do a cheap RSA-public; client authentication is optional but if we do it we want to perform the cheaper ECDSA-sign. So, as a client who doesn't want to perform too much computation, we want ECDHE-RSA all the time, and if we authenticate ourselves, we want to do so using an ECC certificate. (Note: ECDHE-RSA is for TLS 1.2, with TLS 1.3 the negociation is different, I guess we want to use
The last comparisons I've done are quite old (Mbed TLS 2.23) but the answer is "it depends" - on the platform, your config of Mbed TLS, and the distribution of operations you're doing. For speed, you want to keep the default values of
So overall if you care, you need to measure it on your board with a realistic workload. |
Suggested enhancement
This code takes too long time - around 8 seconds:
How can we speedup handshake process?
This delay affects our connection process duration.
We are connecting to AWS IoT MQTT broker.
We are using ARM Cortex M3 processor running at 32MHz.
The text was updated successfully, but these errors were encountered: