Merging Mbed Crypto back into Mbed TLS #374
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto#374
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We are going to merge Mbed Crypto back into Mbed TLS. This means that there will be a single repository, https://github.com/ARMmbed/mbedtls, hosting both the cryptography part of the library and the X.509 and TLS parts. Mbed TLS will be the implementation of the
mbedtls_xxxcryptography, X.509 and TLS APIs as well as the reference implementation of the PSA Cryptography API.Rationale
Mbed Crypto and Mbed TLS were separated to facilitate independent development of the two products. However this has had limited benefits, because the two products share most of their infrastructure (build and test scripts, continuous integration, etc.) and are maintained by the same team. Conversely, separating the product has costs: synchronizing changes between the two repositories adds maintenance overhead, building and testing is more complicated. Merging Mbed Crypto back into Mbed TLS avoids these overheads.
PSA Cryptography Implementation will continue to actively happen in Mbed TLS repository. In future, we intend to have a PSA Cryptography reference implementation as a separate product, without the legacy of the
mbedtls_xxxcryptography APIs. Mbed Crypto as it currently is does not fulfill this purpose due to the need to maintain the existingmbedtls_xxxAPIs.Timeline
Note: all dates are tentative and subject to change.
mbedtls_xxxAPIs. Mbed TLS will retain somembedtls_xxxcryptography APIs for backward compatibility duringa transition period.
Impact for users of Mbed TLS
You can keep using Mbed TLS as usual. If you clone the git repository, you won't need submodule support in your infrastructure anymore. The crypto part of the library will no longer be in the
crypto/subdirectory.Impact for users of Mbed Crypto
You can build
libmbedcryptofrom the Mbed TLS repository (this has always been possible). If you want to build only the crypto library in its default configuration, runscripts/config.py cryptobefore you build. For more details, see our guide on building Mbed/PSA Crypto from the Mbed TLS repository below.Impact for contributors to Mbed Crypto and Mbed TLS
During the transition period, we will keep merging pull requests in both repositories. However, there will be a short freeze on merging pull requests that make structural changes such as adding or removing files, or modify files that are shared between the two repositories. Changes that only affect crypto-only files can still be made in the Mbed Crypto repository, and changes that only affect X.509/TLS-only files can still be made in the Mbed TLS repository.
Once we merge the crypto files back into Mbed TLS, changes to crypto code will need to be made there. After this point, Mbed Crypto pull requests can be re-raised in Mbed TLS with few or nor modifications, since Mbed TLS will have the same file structure. If you have an open pull request in the Mbed Crypto repository at the cutover date, we'll let you know how to proceed.
The project remains committed to the continued development and maintenance of both Mbed TLS and PSA Cryptography API reference implementation. Merging Mbed Crypto back into Mbed TLS repository is to avoid the overheads in the short term as explained in Rationale Section above.
Building Mbed/PSA Crypto from the mbedtls repo
This comment explains how to build the Mbed Crypto library (the current
incarnation of the PSA Crypto library) from the mbedtls repository. This will
be especially useful after mbed-crypto has been merged back to the mbedtls
repository, which will then be the only source for it.
The intended audience is users of Mbed Crypto or PSA Crypto who are currently
getting it from the mbed-crypto repository, and will need to get it from the
mbedtls repository after the merge. Users who are already getting Mbed Crypto
from the mbedtls repository and building it as part of Mbed TLS are
unaffected.
Summary
scripts/config.py cryptobefore you build;libmbedcrypto.aorlibmbedcrypto.so;When using the default config.h
You can just build as usual (using
makeorcmake+make) and only keeplibmbedcrypto.afrom the build results, discarding the other libraries.Alternatively, if you want to avoid building the X.509 and TLS libraries
before discarding them, you can run
scripts/config.py cryptobefore runningmake(possibly aftercmake). This will still create empty files for theX.509 and TLS libraries, but not waste resources building them.
When starting from the default config.h and adapting it with config.py
If you're using a custom
config.hderived from the default one by running anumber of
scripts/config.py set/unset XXXcommands, then you can just appendscripts/config.py cryptoto your list of existing calls toconfig.pyandbuild as usual.
Again, this will create empty files for the X.509 and TLS libraries, but not
waste resources building them. Just discard those files and use
libmbedcrypto.aas usual.Unlike the case of using the default config, running
scripts/config.py cryptois required here, to avoidcheck_config.hcomplaining if your customcrypto build is not compatible with the default TLS options.
When using a user config file
If you're starting from the default
config.hbut customizing it using a userconfig file, by setting the
MBEDTLS_USER_CONFIG_FILE, then you can just runscripts/config.py cryptobefore your build as usual. This will modify thedefault
config.hbut will keep your user config file unchanged.Again, this will create empty files for the X.509 and TLS libraries, but not
waste resources building them. Just discard those files and use
libmbedcrypto.aas usual.Unlike the case of using the default config, running
scripts/config.py cryptois required here, to avoidcheck_config.hcomplaining if your customcrypto build is not compatible with the default TLS options.
When using a standalone config.h
If you're using a custom stand-alone
config.h, that is one that's maintainedindependently and replaces the default one (either by overwriting it with your
file, or setting
MBEDTLS_CONFIG_FILEin your build environment), then youcan just keep your file as is (assuming you're only setting crypto options in
it) and build as usual.
Again, this will create empty files for the X.509 and TLS libraries, but not
waste resources building them. Just discard those files and use
libmbedcrypto.aas usual.If you custom standalone
config.hwas not clean and included X.509 or TLSsettings despite targeting Mbed Crypto, you might get errors from
check_config.h. These would be resolved by runningscripts/config.py -f <path_to/your_config.h> cryptojust one time. After that you can keep usingand maintaining your standalone
config.has usual.Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-1049
Mbed Crypto is now merged back into Mbed TLS (via https://github.com/ARMmbed/mbedtls/pull/3085).
It would be nice if the
README.mdfile of of mbed-crypto indicates that this repo is no longer being updated, points to this issue and to the Mbed TLS repository.@hug-dev Incoming