Comments (6)
@mpg Right, at the API level we don't want to commit whether the public key is calculated at generation time or each time it's needed. So there will be both an interruptible generate-key-pair and an interruptible export-public-key.
In Mbed TLS, since we don't keep the public key around (because it makes driver support easier), we should have psa_generate_key
call mbedtls_ecp_gen_privkey
rather than mbedtls_ecp_gen_key
(which dates back from when we were keeping the mbedtls_ecp_keypair
object around, instead of just keeping the export form of the key which only contains the private value).
from mbedtls.
Do we really need interruptible keypair generation?
ECC private key generation is very fast: it's essentially a symmetric operation. The costly part of ECC key pair generation is calculating the public key. The way Mbed TLS is structured, we don't store the public key, we recalculate it each time it's needed. So we don't need interruptibility for psa_generate_key
. The same applies to FFDH.
RSA private key generation is slow, but we have no demand for interruptible RSA. And even if we did, RSA private key generation is so slow that it typically wouldn't be done in contexts where interruptibility is required.
from mbedtls.
I'm going off the spec sheet on #7293 to be honest - tagging @mpg for further discussion on this.
from mbedtls.
The way Mbed TLS is structured, we don't store the public key, we recalculate it each time it's needed.
As far as I can tell we call mbedtls_ecp_gen_key()
from PSA, which calculates the public key as well.
from mbedtls.
As far as I can tell we call mbedtls_ecp_gen_key() from PSA, which calculates the public key as well.
Ah, indeed. So this ticket should morph into making PSA call code that doesn't waste time calculating the public key. (It wasn't a waste of time when originally written, because back then we kept the public key in memory.) I guess mbedtls_ecp_gen_privkey
instead of mbedtls_ecp_gen_key
. We should do this for 3.6 too.
from mbedtls.
I think Andrew has summarized things quite clearly here: ARM-software/psa-api#198
It seems to me that PSA Crypto implementation are free to compute the public key either during keygen or when exporting it (or both, as we're currently doing, though that's silly of course). So, I think the PSA Crypto API needs both interruptible keygen and interruptible export-public in order to preserve implementation freedom.
OTOH, our implementation should indeed be changed to not compute the public key during keygen only to discard it right away. Once that's done, I guess we could choose not to implement interruptible keygen and instead have our documentation say that ECC keygen is fast enough.
However, doing so would create a compatibility constraint: once we promise ECC keygen is fast enough, we're not allowed to change that in a minor release. Otherwise, people who have working code calling non-interruptible keygen would have to change their code in order to start calling interruptible keygen when upgrading, which is contrary to our compatibility promises.
So, in order to avoid imposing that compatibility constraint on ourselves, we might want to implement interruptible keygen right away. The implementation would probably be relatively as complete()
would always complete the work the first time it's called. But the documentation would not promise it to be so (and perhaps even include a warning that this may change in the future, in case people notice and start wrongly thinking they can rely on this).
Then we'd be free to change our strategy about when the public part is computed and whether it's stored whenever we please.
Wdyt?
from mbedtls.
Related Issues (20)
- mbedtls_pk_sign_ext() returned -16000 (-0x3e80) HOT 1
- Do not perform adjustments on legacy crypto from PSA, when MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C HOT 2
- Can't disable certificate verification with TLSv1.3 HOT 2
- MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET breaks backwards-compatibility? HOT 1
- Clean up psk_list in ssl-opt.sh
- Support the `crypto_config.h` usage in depends.py
- Update the `cipher_id` domain to use PSA macros in `depends.py`
- Update the `cipher_chaining` domain to use PSA macros in `depends.py`
- Update the `curves` domain to use PSA macros in `depends.py`
- Update the `hashes` domain to use PSA macros in `depends.py`
- Update the `pkalgs` domain to use PSA macros in `depends.py`
- Guidance to remove check_config.h inclusion from mbedtls_config.h
- CMake: Dependency scope HOT 4
- Remove hkdf.c HOT 2
- Protect against spurious definitions of derived symbols
- 2.28 only: build broken when `check_config.h` is not included HOT 1
- Missing include stdlib.h and stdio.h in some platform configurations
- MbedTLS v3.6.0 - Compilation errors and warnings HOT 1
- Implement tf_psa_crypto_config.py
- Adapt config.py to configuration file split
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbedtls.