Skip to content
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

Disable MBEDTLS_CONFIG_HW_SUPPORT on STM targets. #8142

Merged
merged 1 commit into from
Oct 6, 2018

Conversation

moranpeker
Copy link
Contributor

@moranpeker moranpeker commented Sep 16, 2018

Description

Disable MBEDTLS_CONFIG_HW_SUPPORT on all STM targets.
Fix issue: #6545

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

@@ -2373,6 +2373,7 @@
"MBED_CONNECT_ODIN": {
"inherits": ["MODULE_UBLOX_ODIN_W2"],
"release_versions": ["5"],
"macros_add": ["MBEDTLS_CONFIG_HW_SUPPORT"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it not be removed, I believe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is should be disabled for the all three as CONNECT_ODIN and MTB boards are using same WIFI binary driver.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, but if you ADD the CONFIG_HW_SUPPORT, then you are again activating it - i.e. reversing the 1st change done to the common target fíle. In my humble opinion these macros_add changes should not be done, we should ONLY do the common target removal.

@moranpeker moranpeker changed the title Disable MBEDTLS_CONFIG_HW_SUPPORT on UBLOX_EVK_ODIN_W2 target. Disable MBEDTLS_CONFIG_HW_SUPPORT on UBLOX_ODIN_W2 target. Sep 17, 2018
@moranpeker moranpeker force-pushed the disable-HW-acceleration branch from fd28d78 to ae906df Compare September 17, 2018 11:13
@0xc0170 0xc0170 requested a review from a team September 17, 2018 12:00
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 17, 2018

As in the referenced issue, disabling it for other platforms comes in a separate PR ?

@0xc0170 0xc0170 requested a review from Patater September 17, 2018 12:05
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 20, 2018

As in the referenced issue, disabling it for other platforms comes in a separate PR ?

@moranpeker Please review this one, what shall happen to other platforms?

@JanneKiiskila
Copy link
Contributor

Can we get this to next patch release, please.
@0xc0170 @adbridge

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 25, 2018

We can proceed with this one, but as I understood also other platforms are affected and should be updated (I haven't yet seen PR neither an action that will take care of it).

@JanneKiiskila
Copy link
Contributor

Ah, OK - it can't be done for this target alone, it should be done to all STM targets (I assume the driver is shared amongst all STM targets).

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 25, 2018

@Patater should MBEDTLS_CONFIG_HW_SUPPORT be removed from targets (the issue referenced above states that it's broken - not specifying other platforms, just some stm32) ? This PR removes it so far only for odin target.

@cmonr
Copy link
Contributor

cmonr commented Sep 26, 2018

@ARMmbed/team-st-mcd Thoughts on #8142 (comment) ?

@Patater
Copy link
Contributor

Patater commented Sep 26, 2018

Yes, hardware acceleration should be removed from all targets that fail testing. At the time this PR was made, only UBLOX_ODIN_W2 was known to fail testing.

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 26, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 26, 2018

Build : FAILURE

Build number : 3160
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8142/

@asifrizwanubx
Copy link
Contributor

asifrizwanubx commented Sep 27, 2018

Hello,
Please do not merge !
Did anyone prove that the CRYPTO HW ACCELERATION is failing on non-ublox boards ?
Could you show me where you point the evidences of this ?

Kind regards

@adustm
#6545 (comment) reported that issue on non-ublox board. But still I agree with you, @teetak01 could you please confirm it? because you have some results on different boards.

@LMESTM
Copy link
Contributor

LMESTM commented Sep 27, 2018

@adustm
#6545 (comment) reported that issue on non-ublox board. But still I agree with you, @teetak01 could you please confirm it? because you have some results on different boards.

the TARGET_STM32F437xG based is TARGET_UBLOX_C030

@asifrizwanubx
Copy link
Contributor

then is there any other target which support CRYPTO HW ACCELERATION working?

@adustm
Copy link
Member

adustm commented Sep 28, 2018

Hello,
I managed to reproduce the issue on NUCLEO_F439ZI (hw crypto)

Only the SHA256 hw acceleration is causing the problem. This PR is doing more than simply removing SHA256 as it removes every HW acceleration...
You may want to transform it into

--- a/features/mbedtls/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/mbedtls_device.h
+++ b/features/mbedtls/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/mbedtls_device.h
@@ -22,7 +22,6 @@

 #define MBEDTLS_AES_ALT

-#define MBEDTLS_SHA256_ALT

 #define MBEDTLS_SHA1_ALT

(+the same for other devices)
Thanks you for having waited until I managed to prove this.

@asifrizwanubx
Copy link
Contributor

I managed to reproduce the issue on NUCLEO_F439ZI (hw crypto)

Could you please share how did you reproduce it?

Only the SHA256 hw acceleration is causing the problem. This PR is doing more than simply removing SHA256 as it removes every HW acceleration...

I agree with you on that.

@adustm
Copy link
Member

adustm commented Oct 1, 2018

Could you please share how did you reproduce it?

It is not plug and play... You have to know that NUCLEO_F439ZI = NUCLEO_F429ZI + hw crypto functionality. Both platforms are 100 % compatible.

mbed import https://github.com/ARMmbed/mbed-cloud-client-example
-> I have mbed-cloud-client v 2.0.0 and mbed-os v 5.10

mbed config -G CLOUD_SDK_API_KEY <API_KEY>
mbed target NUCLEO_F439ZI
mbed toolchain GCC_ARM
mbed device-management init -d arm.com --model-name example-app --force -q

Then a task to find every NUCLEO_F429ZI in any json file, any cpp file, any heady file to make sure the NUCLEO_F439ZI has the same declarations and settings than the NUCLEO_F429ZI
Another taks to find every TARGET_NUCLEO_F429ZI directory and make sure that it is copied as TARGET_NUCLEO_F439ZI directory
mbed-cloud-client-example modified files

        modified:   configs/eth_v4.json
        modified:   configs/eth_v6.json
        modified:   configs/mesh_6lowpan.json
        modified:   configs/mesh_thread.json
        modified:   configs/wifi_esp8266_v4.json
        modified:   mbed_app.json
        modified:   mbed_cloud_client_user_config
        modified:   mbed_cloud_dev_credentials.c
        modified:   mbed_lib.json
        modified:   update_default_resources.c

mbed-cloud-client-example/mbed-cloud-client modified files

        modified:   mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_crypto_only.h
        modified:   mbed-client-pal/Configs/pal_config/mbedOS/mbedOS_default.h
mbed-cloud-client-example/mbed-cloud-client Untracked files:
        mbed-client-pal/Configs/pal_config/mbedOS/TARGET_NUCLEO_F439ZI/

mbed-cloud-client-example/mbed-os modified files

        modified:   components/storage/blockdevice/COMPONENT_SD/config/mbed_lib.json
        modified:   features/mbedtls/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/mbedtls_device.h
        modified:   targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_NUCLEO_F439ZI/system_clock.c
        modified:   targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/TOOLCHAIN_ARM_MICRO/startup_stm32f439xx.S
        modified:   targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/TOOLCHAIN_ARM_MICRO/stm32f439xx.sct
        modified:   targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/TOOLCHAIN_GCC_ARM/STM32F439ZI.ld
        modified:   targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/TOOLCHAIN_GCC_ARM/startup_stm32f439xx.S
        modified:   targets/targets.json

mbed-cloud-client-example/mbed-os Untracked files

        features/FEATURE_BOOTLOADER/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_NUCLEO_F439ZI/
        targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/system_init_pre.c

I have copied the bootloader file from the NUCLEO_F429ZI, because I don't know how to create one. This means that this binary file is compiled with sw crypto if any mbedtls functions inside.

mbed compile
drag and drop

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 1, 2018

#8142 (comment)

@moranpeker @Patater Please review the proposal

@adustm
Copy link
Member

adustm commented Oct 2, 2018

Hello,
Could you remind me if disabling MBEDTLS_CONFIG_HW_SUPPORT is also disabling the hardware random generator (RNG) ?
If it is the case, you really should consider disabling hw acceleration directly from the mbedtls_device.h files, otherwise entropy HW source will no more be granted.

Kind regards

@moranpeker moranpeker force-pushed the disable-HW-acceleration branch from e1d0cc1 to 333f087 Compare October 2, 2018 11:45
@moranpeker
Copy link
Contributor Author

Hi,
I just update the PR according to @adustm proposal.
Could you please re-review the changes?

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 5, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 5, 2018

Build : SUCCESS

Build number : 3244
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8142/

Triggering tests

/morph test
/morph mbed2-build

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 5, 2018

License issue, restarting

/morph mbed2-build

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 5, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Oct 5, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 5, 2018

IAR license issue, restarting

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Oct 5, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 5, 2018

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.