-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
mbedtls: add a new Kconfig file for PSA_WANT logic #78531
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,140 @@ | ||||||
# Copyright (c) 2024 BayLibre SAS | ||||||
# SPDX-License-Identifier: Apache-2.0 | ||||||
|
||||||
# This file extends Kconfig.psa (which is automatically generated) by adding | ||||||
# some logic between PSA_WANT symbols. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
# Start by defining some internal symbols that can be used to check whether there | ||||||
# is some kind of support in the PSA Crypto API. | ||||||
|
||||||
config PSA_CAN_SOME_HASH | ||||||
bool | ||||||
default y if (PSA_WANT_ALG_MD5 || \ | ||||||
PSA_WANT_ALG_SHA_1 || \ | ||||||
PSA_WANT_ALG_SHA_224 || \ | ||||||
PSA_WANT_ALG_SHA_256 || \ | ||||||
PSA_WANT_ALG_SHA_384 || \ | ||||||
PSA_WANT_ALG_SHA_512 || \ | ||||||
PSA_WANT_ALG_SHA3_224 || \ | ||||||
PSA_WANT_ALG_SHA3_256 || \ | ||||||
PSA_WANT_ALG_SHA3_384 || \ | ||||||
PSA_WANT_ALG_SHA3_512) | ||||||
help | ||||||
Promptless symbol that can be used to check if there's any type of hash | ||||||
support enabled (no matter which algorithm) in the PSA Crypto API. | ||||||
|
||||||
config PSA_CAN_SOME_ECC | ||||||
bool | ||||||
default y if (PSA_WANT_ECC_BRAINPOOL_P_R1_256 || \ | ||||||
PSA_WANT_ECC_BRAINPOOL_P_R1_384 || \ | ||||||
PSA_WANT_ECC_BRAINPOOL_P_R1_512 || \ | ||||||
PSA_WANT_ECC_MONTGOMERY_255 || \ | ||||||
PSA_WANT_ECC_MONTGOMERY_448 || \ | ||||||
PSA_WANT_ECC_SECP_K1_192 || \ | ||||||
PSA_WANT_ECC_SECP_K1_256 || \ | ||||||
PSA_WANT_ECC_SECP_R1_192 || \ | ||||||
PSA_WANT_ECC_SECP_R1_224 || \ | ||||||
PSA_WANT_ECC_SECP_R1_256 || \ | ||||||
PSA_WANT_ECC_SECP_R1_384 || \ | ||||||
PSA_WANT_ECC_SECP_R1_521) | ||||||
help | ||||||
Promptless symbol that can be used to check if there's at least one family | ||||||
of elliptic curve enabled in the PSA Crypto API. | ||||||
|
||||||
config PSA_CAN_ECDSA | ||||||
bool | ||||||
default y if (PSA_WANT_ALG_ECDSA || PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \ | ||||||
PSA_CAN_SOME_ECC | ||||||
help | ||||||
Promptless symbol that can be used to check if the PSA Crypto API support | ||||||
ECDSA (either deterministic or not) for at least one curve family. | ||||||
|
||||||
config PSA_CAN_ECDH | ||||||
bool | ||||||
default y if PSA_WANT_ALG_ECDH && PSA_CAN_SOME_ECC | ||||||
help | ||||||
Promptless symbol that can be used to check if the PSA Crypto API support | ||||||
ECDH (either deterministic or not) for at least one curve family. | ||||||
|
||||||
config PSA_CAN_ECJPAKE | ||||||
bool | ||||||
default y if PSA_WANT_ECC_SECP_R1_256 && PSA_WANT_ALG_SHA_256 | ||||||
help | ||||||
Promptless symbol that can be used to check if the PSA Crypto API support | ||||||
EC-JPAKE. | ||||||
|
||||||
# Dependencies between KDF (key derivation function) algorithms and low-level | ||||||
# crypto ones. | ||||||
Comment on lines
+66
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are making such a comment, then it would make sense to properly cover all the sections. Because I think that this section stops at |
||||||
|
||||||
config PSA_WANT_ALG_HKDF | ||||||
depends on PSA_WANT_KEY_TYPE_HMAC | ||||||
depends on PSA_WANT_ALG_HMAC | ||||||
depends on PSA_CAN_SOME_HASH | ||||||
|
||||||
config PSA_WANT_ALG_HKDF_EXTRACT | ||||||
depends on PSA_WANT_ALG_HKDF | ||||||
|
||||||
config PSA_WANT_ALG_HKDF_EXPAND | ||||||
depends on PSA_WANT_ALG_HKDF | ||||||
|
||||||
config PSA_WANT_ALG_PBKDF2_HMAC | ||||||
depends on PSA_WANT_KEY_TYPE_HMAC | ||||||
depends on PSA_WANT_ALG_HMAC | ||||||
depends on PSA_CAN_SOME_HASH | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove all the |
||||||
|
||||||
config PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 | ||||||
depends on PSA_WANT_KEY_TYPE_AES | ||||||
depends on PSA_WANT_ALG_CMAC | ||||||
|
||||||
config PSA_WANT_ALG_TLS12_PRF | ||||||
depends on PSA_WANT_KEY_TYPE_HMAC | ||||||
depends on PSA_WANT_ALG_HMAC | ||||||
depends on (PSA_WANT_ALG_SHA_256 || \ | ||||||
PSA_WANT_ALG_SHA_384) | ||||||
|
||||||
config PSA_WANT_ALG_TLS12_PSK_TO_MS | ||||||
depends on PSA_WANT_KEY_TYPE_HMAC | ||||||
depends on PSA_WANT_ALG_HMAC | ||||||
depends on (PSA_WANT_ALG_SHA_256 || \ | ||||||
PSA_WANT_ALG_SHA_384) | ||||||
|
||||||
config PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS | ||||||
depends on PSA_WANT_ALG_SHA_256 | ||||||
|
||||||
# Mbed TLS makes assumptions on asymmetric key build symbols | ||||||
# (see modules/crypto/mbedtls/include/psa/crypto_adjust_config_key_pair_types.h): | ||||||
# - that PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_BASIC is automatically set whenever one of | ||||||
# IMPORT|EXPORT|GENERATE|DERIVE is set; | ||||||
# - and that PSA_WANT_KEY_TYPE_xxx_PUBLIC_KEY is automatically set whenever any of | ||||||
# IMPORT|EXPORT|GENERATE|DERIVE is set. | ||||||
# | ||||||
# Note: PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE is not supported in Mbed TLS so | ||||||
# it's not included in the list below. | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT | ||||||
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT | ||||||
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE | ||||||
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE | ||||||
select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT | ||||||
select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT | ||||||
select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY | ||||||
|
||||||
config PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE | ||||||
select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC | ||||||
select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY |
tomi-font marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.