Skip to content

Conversation

@tomi-font
Copy link
Contributor

@tomi-font tomi-font commented Apr 28, 2025

Turn the MBEDTLS_RSA_FULL selects into depends on. This is how the other MBEDTLS_KEY_EXCHANGE_* Kconfig options are defined.

This is done to avoid circular dependencies.

At the same time update uses of the affected MBEDTLS_KEY_EXCHANGE_* Kconfig options to enable/disable the dependencies which used to be automatically handled.

valeriosetti
valeriosetti previously approved these changes Apr 28, 2025
tejlmand
tejlmand previously approved these changes Apr 28, 2025
Copy link
Contributor

@tejlmand tejlmand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depends on is generally recommended over select.
See: https://docs.zephyrproject.org/latest/build/kconfig/tips.html#select-pitfalls

So approving.

@github-actions
Copy link

github-actions bot commented Apr 29, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
mcuboot zephyrproject-rtos/mcuboot@8131548 (main) zephyrproject-rtos/mcuboot@990b1fc (upstream-sync) zephyrproject-rtos/mcuboot@81315483..990b1fcb

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

select MBEDTLS_PKCS1_V15
select MBEDTLS_PKCS1_V21
def_bool y
depends on MBEDTLS_RSA_C && MBEDTLS_PKCS1_V15 && MBEDTLS_PKCS1_V21
Copy link
Contributor

@valeriosetti valeriosetti May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this comment I don´t know if MBEDTLS_RSA_FULL still makes sense. It was OK when it was selecting all the other RSA related features, but now it makes less sense IMO. Since MBEDTLS_PKCS1_V15 and MBEDTLS_PKCS1_V21 are already gated by MBEDTLS_RSA_C we can just use

depends on MBEDTLS_PKCS1_V15 || MBEDTLS_PKCS1_V21

to express a dependency on legacy RSA support. Wdyt?

config MBEDTLS_SOME_AEAD_CIPHER_ENABLED
bool
default y
def_bool y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment.
While the change is technically OK, the scope of the commit is different so it would have been better to place it in a separate commits IMO. The same holds also for MBEDTLS_SOME_CIPHER_ENABLED and MBEDTLS_PSA_CRYPTO_CLIENT.

Copy link
Contributor

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I agree that depends on is to be preferred over select for Kconfig, I think we should draw a line between what the user/other subsystems need to imply/select and what should be automatically inferred by Kconfig.mbedtls.
Having Kconfigs as depends on instead of select-ed allows for maximum configurability, but OTOH the user/subsystem willing to use some key exchange will have to manually select all the required algorithms and key types. This is OK to me, but I've seen people complaining about this kind of complexity during meetings, so it maybe a bit overkilling.

@kartben kartben closed this May 7, 2025
@kartben kartben reopened this May 7, 2025
@kartben kartben closed this May 7, 2025
@kartben kartben reopened this May 7, 2025
@tomi-font tomi-font dismissed stale reviews from jukkar and nordicjm via 5d21e9e May 12, 2025 12:30
@tomi-font tomi-font force-pushed the mbedtls_fix_key_exchange_config branch from 6598caf to 5d21e9e Compare May 12, 2025 12:30
@tomi-font
Copy link
Contributor Author

@d3zd3z @ceolin please review

nordicjm
nordicjm previously approved these changes May 12, 2025
tomi-font and others added 2 commits May 13, 2025 10:30
Turn the MBEDTLS_RSA_FULL selects into depends on.
This is how the other MBEDTLS_KEY_EXCHANGE_* Kconfig options are defined.

This is done to avoid circular dependencies.

At the same time update uses of the affected MBEDTLS_KEY_EXCHANGE_*
Kconfig options to enable/disable the dependencies which used to be
automatically handled.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
Update Zephyr fork of MCUboot to revision:
  990b1fcb367e27056b282f183e819964fdbfe907

  - f76fba70 boot: bootutil: swap_scratch: Fix issue with bricking
    device
  - 7253f01c boot: bootutil: Refactor erase functionality to fix
    watchdog feeding
  - a98bff9f boot: zephyr: kconfig: Fix issues and re-order
  - 1b2d261d boot: zephyr: flash_map: Fix unused argument
  - 413eb384 boot: zephyr: flash_map: Fix missing include
  - 15b36f91 boot: zephyr: kconfig: enable dependencies of Mbed TLS
    Kconfig option
  - f6e8e88a boot: bootutil: Move erase function location
  - 5ef87c79 boot: zephyr: kconfig: Fix BOOT_SWAP_USING_MOVE
    description
  - bc18d7da boot: boot_serial: Fix issue with CBOR and setting
    image state

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@tomi-font tomi-font force-pushed the mbedtls_fix_key_exchange_config branch from 5d21e9e to 660e183 Compare May 13, 2025 07:31
@tomi-font tomi-font requested a review from nordicjm May 13, 2025 07:32
@sonarqubecloud
Copy link

@carlescufi carlescufi dismissed valeriosetti’s stale review May 13, 2025 10:09

Stale, please revisit

@carlescufi
Copy link
Member

@valeriosetti please revisit this PR, I dismissed your NACK because it was stale.

@tomi-font
Copy link
Contributor Author

@valeriosetti please revisit this PR, I dismissed your NACK because it was stale.

I know he is on vacation this week. I don't think he'll oppose in any way to merging this if @d3zd3z or @ceolin approves.


config MBEDTLS_PKCS1_V15
bool "RSA PKCS1 v1.5"
default y if UOSCORE || UEDHOC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this UOSCORE logic is an inverting dependencies. Shouldn't UOSCORE select MBEDTLS_PKCS1_V15 ?

I won't block it since there are other symbols following the same logic, but it is looking inverted to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. @valeriosetti was saying he might take care of changing this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry but I was out of office last week. Yes, I started some work to fix this dependency. It's not ready yet, but I hope to finalize it soon.

@nashif nashif merged commit ebfc7db into zephyrproject-rtos:main May 14, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.