Skip to content

Nuvoton: Remove TRNG support #11736

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

Merged
merged 1 commit into from
Nov 15, 2019
Merged

Conversation

ccli8
Copy link
Contributor

@ccli8 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, Ronny-Liu, yanesca and a team October 23, 2019 11:00
@ciarmcom
Copy link
Member

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

@ccli8
Copy link
Contributor Author

ccli8 commented Oct 31, 2019

Update?

@ccli8
Copy link
Contributor Author

ccli8 commented Nov 11, 2019

@yanesca @kjbracey-arm

@yanesca
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 November 12, 2019 10:28
@@ -118,10 +118,6 @@ struct pwmout_s {
uint32_t pulsewidth_us;
};

struct trng_s {
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed year to 2019.

@jainvikas8
Copy link
Contributor

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
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
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
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 nuvoton_remove_trng branch from 7a8b710 to aae04b2 Compare November 13, 2019 10:01
@jainvikas8
Copy link
Contributor

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

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 13, 2019

CI started

@mbed-ci
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
Copy link
Contributor

0xc0170 commented Nov 14, 2019

Test failed because of #11862, we will investigate

@adbridge
Copy link
Contributor

CI restarted

@mbed-ci
Copy link

mbed-ci commented Nov 15, 2019

Test run: SUCCESS

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

@adbridge
Copy link
Contributor

Looks like we may have another ci issue...

@0xc0170 0xc0170 merged commit 30145b1 into ARMmbed:master Nov 15, 2019
@ccli8 ccli8 deleted the nuvoton_remove_trng branch November 18, 2019 01:56
@ccli8 ccli8 restored the nuvoton_remove_trng branch November 18, 2019 10:54
@cyliangtw cyliangtw deleted the nuvoton_remove_trng branch March 9, 2023 05:29
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.

7 participants