-
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
Evolution of md.h in 4.0 #8450
Comments
The general wisdom for API transitions is to have one full major version cycle where the new API is stable and the old API is present but deprecated. In Mbed TLS 3, we're at an intermediate stage where the new API is stable but old API is not deprecated. Because hashes are so ubiquitous, and because we already have code in
I'm not sure what to do about HMAC. I don't think it's hard to implement it on top of PSA. (Note that |
Minor: I don't think HKDF belongs on that list: it does have a PSA alternative, whose built-in implementation (currently in Also, I think migrating internal users of HMAC to PSA is work indeed, but relatively easy work, though. |
Note (just for reference, I don't think it influences the decision to keep MD or not): currently (with
|
Aw, I think I forgot a work item for "option 2 (remove)": what about uses of types from
Actually, I say that's a work item for option 2, but that's something we probably still want to do with option 1 anyway. |
We definitely need to remove those or provide alternatives. |
"This gives users more time to move to PSA. People who were using low-level hash modules need to migrate immediately, but those who were using the generic MD API for hashes and HMAC can migrate at a convenient time between now and 5.0." Users who want to use AFAICT it is very low impact to break these cases. In the X.509 case, it's trivial for the user (pass So I am in favour of removal. |
That's the plan. The cost of keeping it is small and the cost of tearing out of our code base is large. |
This issue is meant as a place to discuss what we want to do with MD in 4.0.
There are two main options:
Note: MD currently provides functionality similar to two PSA Crypto families:
psa_hash_xxx()
andpsa_mac_xxx()
(HMAC). It provides both streaming and one-shot API for each family.Note: for low-level hash modules (
sha256.h
etc) I think the plan is to remove them from the public API, regardless of what we do with MD.Rationale for option 1 (keep)
This gives users more time to move to PSA. People who were using low-level hash modules need to migrate immediately, but those who were using the generic MD API for hashes and HMAC can migrate at a convenient time between now and 5.0.
Work needed for option 1 (keep)
In 4.0:
mbedtls_md_info_from_string()
,mbedtls_md_get_name()
- see Remove parts of md, cipher and pk #8133 item 1mbedtls_md_list()
as well (not used in the library)mbedtls_md_info_t
from the API in order to make it slicker but that would require users to change their code, so it runs against the stated goal. (Alternatively, we can keep the structure but later make it trivial as it has no public field.)In 4.0 or 4.x:
Rationale for option 2 (remove)
This leaves us with only one hashing/HMAC API to maintain, document and test. For new users, this also gives more clarity.
Work needed for option 2 (remove)
In 4.0:
md.h
to an internal location and adapt all files that#include
it.psa/hmac_demo
andhash/md_hmac_demo.c
going in that direction, and an example programpsa_hash.c
.)In 4.0 or 4.x:
Other options
The text was updated successfully, but these errors were encountered: