@@ -12,69 +12,34 @@ if JWT
1212
1313choice
1414 prompt "JWT signature algorithm"
15- default JWT_SIGN_RSA
15+ default JWT_SIGN_RSA_PSA
1616 help
1717 Select which algorithm to use for signing JWT tokens.
1818
19- config JWT_SIGN_RSA
20- bool "Use RSA signature (RS-256)"
21-
22- config JWT_SIGN_ECDSA
23- bool "Use ECDSA signature (ES-256)"
24-
25- endchoice
26-
27- choice
28- default JWT_USE_PSA
29- prompt "Select crypto library to be used"
19+ config JWT_SIGN_RSA_LEGACY
20+ bool "Use RSA signature (RS-256). Use Mbed TLS as crypto library."
21+ depends on CSPRNG_ENABLED
22+ select MBEDTLS
23+ select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
3024
31- config JWT_USE_PSA
32- bool "PSA crypto API library "
25+ config JWT_SIGN_RSA_PSA
26+ bool "Use RSA signature (RS-256). Use PSA Crypto API. "
3327 select MBEDTLS if !BUILD_WITH_TFM
3428 select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
29+ select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
30+ select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT
31+ select PSA_WANT_ALG_RSA_PKCS1V15_SIGN
32+ select PSA_WANT_ALG_SHA_256
3533
36- config JWT_USE_LEGACY
37- bool "Legacy library: TinyCrypt for ECDSA, Mbed TLS for RSA"
38-
39- endchoice
40-
41- # Prompless Kconfigs to effectively select which algorithm and library will be used
42- # to sign the JWT. User's selections on the above choices will determine which
43- # element will be picked here.
4434config JWT_SIGN_ECDSA_PSA
45- bool
46- default y
47- depends on JWT_SIGN_ECDSA && JWT_USE_PSA
35+ bool "Use ECDSA signature (ES-256). Use PSA Crypto API."
36+ select MBEDTLS if !BUILD_WITH_TFM
37+ select MBEDTLS_PSA_CRYPTO_C if !BUILD_WITH_TFM
4838 select PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
4939 select PSA_WANT_ALG_ECDSA
5040 select PSA_WANT_ECC_SECP_R1_256
5141 select PSA_WANT_ALG_SHA_256
5242
53- config JWT_SIGN_ECDSA_LEGACY
54- bool
55- default y
56- depends on JWT_SIGN_ECDSA && JWT_USE_LEGACY
57- select TINYCRYPT
58- select TINYCRYPT_SHA256
59- select TINYCRYPT_ECC_DSA
60- select TINYCRYPT_CTR_PRNG
61- select TINYCRYPT_AES
62-
63- config JWT_SIGN_RSA_PSA
64- bool
65- default y
66- depends on JWT_SIGN_RSA && JWT_USE_PSA
67- select PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
68- select PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT
69- select PSA_WANT_ALG_RSA_PKCS1V15_SIGN
70- select PSA_WANT_ALG_SHA_256
71-
72- config JWT_SIGN_RSA_LEGACY
73- bool
74- default y
75- depends on JWT_SIGN_RSA && JWT_USE_LEGACY
76- depends on CSPRNG_ENABLED
77- select MBEDTLS
78- select MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
43+ endchoice
7944
8045endif # JWT
0 commit comments