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

Nuvoton: Remove TRNG support #11736

Merged
merged 1 commit into from Nov 15, 2019
Merged

Conversation

@ccli8
Copy link
Contributor

ccli8 commented Oct 23, 2019

Description

This PR removes TRNG for the targets below which don't have real TRNG.

  • NUMAKER_PFM_NUC472
  • NUMAKER_PFM_M487
  • NUMAKER_IOT_M487

On targets without TRNG, to run mbedtls applications which require entropy source, there are two alternatives: custom entropy source and NV seed. Check #11680.

Related PR

Follow-up of #11176 (comment)

Pull request type

[ ] Fix
[ ] Refactor
[x] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@yanesca @kjbracey-arm

@ciarmcom ciarmcom requested review from kjbracey-arm, Ronny-Liu, yanesca and ARMmbed/mbed-os-maintainers Oct 23, 2019
@ciarmcom

This comment has been minimized.

Copy link
Member

ciarmcom commented Oct 23, 2019

@ccli8, thank you for your changes.
@yanesca @kjbracey-arm @Ronny-Liu @ARMmbed/mbed-os-maintainers please review.

@ccli8

This comment has been minimized.

Copy link
Contributor Author

ccli8 commented Oct 31, 2019

Update?

@ccli8

This comment has been minimized.

Copy link
Contributor Author

ccli8 commented Nov 11, 2019

@yanesca

This comment has been minimized.

Copy link
Contributor

yanesca commented Nov 12, 2019

@jainvikas8 Could you please review this PR?

@Patater Patater requested review from jainvikas8 and removed request for yanesca Nov 12, 2019
@@ -118,10 +118,6 @@ struct pwmout_s {
uint32_t pulsewidth_us;
};

struct trng_s {

This comment has been minimized.

Copy link
@jainvikas8

jainvikas8 Nov 12, 2019

Contributor

It might be worth updating the Copyright (c) year at the beginning of these files (TARGET_M480/objects.h and TARGET_NUC472/objects.h).

This comment has been minimized.

Copy link
@ccli8

ccli8 Nov 13, 2019

Author Contributor

Changed year to 2019.

@jainvikas8

This comment has been minimized.

Copy link
Contributor

jainvikas8 commented Nov 12, 2019

I see mbed test --compile -n tests-mbed_hal-trng -m <target> -t ARMC6 skips the build of this test with this PR (NUMAKER_PFM_NUC472, NUMAKER_PFM_M487, NUMAKER_IOT_M487), but by following the comments above:

On targets without TRNG, to run mbedtls applications which require entropy source, there are two alternatives: custom entropy source and NV seed.

were you able to run tests-mbedtls-multi , tests-mbedtls-selftest, tests-netsocket-tls on these targets?

Does this PR require a special test case that would aid the targets without TRNG?

@ccli8 ccli8 force-pushed the OpenNuvoton:nuvoton_remove_trng branch from 6a25ee6 to 7a8b710 Nov 13, 2019
@ccli8

This comment has been minimized.

Copy link
Contributor Author

ccli8 commented Nov 13, 2019

tests-mbed_hal-trng and tests-netsocket-tls are skipped due to no TRNG support and so no entropy source provided. For tests-netsocket-tls, this can be fixed by adding custom entropy source outside mbed-os by MBEDTLS_ENTROPY_HARDWARE_ALT define and providing mbedtls_hardware_poll(...), same flow when TRNG is supported.

@ccli8

This comment has been minimized.

Copy link
Contributor Author

ccli8 commented Nov 13, 2019

Test report without TRNG and with custom entropy source

mbedgt: test suite report:
| target                 | platform_name    | test suite                     | result | elapsed_time (sec) | copy_method |
|------------------------|------------------|--------------------------------|--------|--------------------|-------------|
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-multi    | OK     | 12.61              | default     |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-selftest | OK     | 14.4               | default     |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | OK     | 200.65             | default     |
mbedgt: test suite results: 3 OK
mbedgt: test case report:
| target                 | platform_name    | test suite                     | test case                         | passed | failed | result | elapsed_time (sec) |
|------------------------|------------------|--------------------------------|-----------------------------------|--------|--------|--------|--------------------|
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-multi    | Crypto: sha256_multi              | 1      | 0      | OK     | 0.07               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-multi    | Crypto: sha256_split              | 1      | 0      | OK     | 0.03               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-selftest | mbedtls_entropy_self_test         | 1      | 0      | OK     | 0.0                |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-selftest | mbedtls_sha256_self_test          | 1      | 0      | OK     | 0.22               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-mbedtls-selftest | mbedtls_sha512_self_test          | 1      | 0      | OK     | 0.14               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_CONNECT_INVALID         | 1      | 0      | OK     | 3.4                |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_ECHOTEST                | 1      | 0      | OK     | 17.82              |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_ECHOTEST_BURST          | 1      | 0      | OK     | 19.03              |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_ECHOTEST_BURST_NONBLOCK | 1      | 0      | OK     | 18.71              |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_ECHOTEST_NONBLOCK       | 1      | 0      | OK     | 18.49              |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_ENDPOINT_CLOSE          | 1      | 0      | OK     | 4.27               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_HANDSHAKE_INVALID       | 1      | 0      | OK     | 2.2                |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_NO_CERT                 | 1      | 0      | OK     | 9.73               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_OPEN_DESTRUCT           | 1      | 0      | OK     | 0.02               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_OPEN_LIMIT              | 1      | 0      | OK     | 0.02               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_OPEN_TWICE              | 1      | 0      | OK     | 0.0                |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_RECV_TIMEOUT            | 1      | 0      | OK     | 7.78               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_SEND_CLOSED             | 1      | 0      | OK     | 4.03               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_SEND_REPEAT             | 1      | 0      | OK     | 60.81              |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_SEND_TIMEOUT            | 1      | 0      | OK     | 8.38               |
| NUMAKER_IOT_M487-ARMC6 | NUMAKER_IOT_M487 | mbed-os-tests-netsocket-tls    | TLSSOCKET_SEND_UNCONNECTED        | 1      | 0      | OK     | 0.0                |
mbedgt: test case results: 21 OK
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2015-2016 Nuvoton
* Copyright (c) 2019 Nuvoton

This comment has been minimized.

Copy link
@jainvikas8

jainvikas8 Nov 13, 2019

Contributor

Would be preferred to follow the old format here - 2015-2019

This comment has been minimized.

Copy link
@ccli8

ccli8 Nov 13, 2019

Author Contributor

Changed to 2015-2019.

These targets below just support PRNG, not real TRNG. They cannot annouce TRNG.

-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M487
-   NUMAKER_IOT_M487

On targets without TRNG, to run mbedtls applications which require entropy source,
there are two alternatives to TRNG:

-   Custom entropy source:
    Define MBEDTLS_ENTROPY_HARDWARE_ALT and provide custom mbedtls_hardware_poll(...)
-   NV seed:
    1.  Define MBEDTLS_ENTROPY_NV_SEED
    2.  Define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO/MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and provide custom mbedtls_nv_seed_read(...)/mbedtls_nv_seed_write(...).
    3.  Don't define MBEDTLS_PSA_INJECT_ENTROPY. Meet mbedtls_psa_inject_entropy(...) undefined and then provide custom one, which must be compatible with mbedtls_nv_seed_read(...)/mbedtls_nv_seed_write(...) above.
    4.  For development, simulating partial provision process, inject entropy seed via mbedtls_psa_inject_entropy(...) pre-main.
@ccli8 ccli8 force-pushed the OpenNuvoton:nuvoton_remove_trng branch from 7a8b710 to aae04b2 Nov 13, 2019
@jainvikas8

This comment has been minimized.

Copy link
Contributor

jainvikas8 commented Nov 13, 2019

@0xc0170 Please, can we start the CI on this.

@0xc0170

This comment has been minimized.

Copy link
Member

0xc0170 commented Nov 13, 2019

CI started

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Nov 13, 2019
@mbed-ci

This comment has been minimized.

Copy link

mbed-ci commented Nov 13, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test
@0xc0170

This comment has been minimized.

Copy link
Member

0xc0170 commented Nov 14, 2019

Test failed because of #11862, we will investigate

@adbridge

This comment has been minimized.

Copy link
Contributor

adbridge commented Nov 15, 2019

CI restarted

@mbed-ci

This comment has been minimized.

Copy link

mbed-ci commented Nov 15, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 2
Build artifacts

@adbridge

This comment has been minimized.

Copy link
Contributor

adbridge commented Nov 15, 2019

Looks like we may have another ci issue...

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Nov 15, 2019
@0xc0170 0xc0170 merged commit 30145b1 into ARMmbed:master Nov 15, 2019
27 checks passed
27 checks passed
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/jenkins/pr-merge Manually fixed status
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/build-ARM Success
Details
jenkins-ci/build-GCC_ARM Success
Details
jenkins-ci/build-IAR Success
Details
jenkins-ci/cloud-client-test Success
Details
jenkins-ci/dynamic-memory-usage RTOS ROM(+0 bytes) RAM(+0 bytes)
Details
jenkins-ci/exporter Success
Details
jenkins-ci/greentea-test Success
Details
jenkins-ci/mbed2-build-ARM Success
Details
jenkins-ci/mbed2-build-GCC_ARM Success
Details
jenkins-ci/mbed2-build-IAR Success
Details
jenkins-ci/unittests Success
Details
travis-ci/astyle Success!
Details
travis-ci/docs Success!
Details
travis-ci/doxy-spellcheck Success!
Details
travis-ci/events Success! Runtime is 8659 cycles.
Details
travis-ci/gitattributestest Success!
Details
travis-ci/include_check Success!
Details
travis-ci/licence_check Success!
Details
travis-ci/littlefs Success! Code size is 8420B.
Details
travis-ci/psa-autogen Success!
Details
travis-ci/tools-py2.7 Success!
Details
travis-ci/tools-py3.5 Success!
Details
travis-ci/tools-py3.6 Success!
Details
travis-ci/tools-py3.7 Success!
Details
@ccli8 ccli8 deleted the OpenNuvoton:nuvoton_remove_trng branch Nov 18, 2019
@ccli8 ccli8 restored the OpenNuvoton:nuvoton_remove_trng branch Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.