Skip to content

Update Mbed TLS and Mbed Crypto to latest as of 2019-12-20 #12150

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 3 commits into from
Feb 10, 2020

Conversation

Patater
Copy link
Contributor

@Patater Patater commented Dec 20, 2019

Summary of changes

Upgrade to Mbed TLS 2.20.0d1 and Mbed Crypto 3.0.0d0.

Migration actions required

None

Documentation

None


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[X] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Release Notes

What behavior changes are being made?
For security and NIST SP 800-90A compliance reasons, CTR DRBG now grabs a nonce from the entropy source if needed to provide the maximum security strength. A previously unused-before-seeding member of the CTR DRBG context, mbedtls_ctr_drbg_context::reseed_counter, is used to hold the number of bytes the user has requested to include from the nonce via mbedtls_ctr_drbg_set_nonce_len(), or -1 to indicate that the entropy nonce length was not set explicitly. This means applications that were depending on a reseed_counter value of 0 to mean "not yet seeded" will need to instead handle errors from calls to mbedtls_ctr_drbg_seed().

What is being deprecated?
A few PSA Crypto asymmetric cryptography functions and macros, key usage definitions, and error code definitions have been renamed to better reflect their operation and to improve readability.

Why is this being deprecated?
The PSA Crypto API continues to develop as it heads towards its 1.0 release. Mbed Crypto 3.0.0d0 implements more of PSA Crypto 1.0b3 than was implemented in Mbed Crypto 2.x, and this brings along some API deprecations.

Mbed Crypto includes backwards compatibility macros (by way of psa/crypto_compat.h) to provide source-level backwards compatibility, although it's recommended to stop using the deprecated APIs as soon as you are able to.

Migration
To avoid using deprecated APIs, users of PSA Crypto should update to the new version of API.

Old New
psa_asymmetric_sign() psa_sign_hash()
psa_asymmetric_verify() psa_verify_hash()
PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE() PSA_SIGNATURE_MAX_SIZE()
PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE() PSA_SIGN_OUTPUT_SIZE()
PSA_KEY_USAGE_SIGN PSA_KEY_USAGE_SIGN_HASH
PSA_KEY_USAGE_VERIFY PSA_KEY_USAGE_VERIFY_HASH
PSA_ERROR_UNKNOWN_ERROR PSA_ERROR_GENERIC_ERROR
PSA_ERROR_OCCUPIED_SLOT PSA_ERROR_ALREADY_EXISTS
PSA_ERROR_EMPTY_SLOT PSA_ERROR_DOES_NOT_EXIST
PSA_ERROR_INSUFFICIENT_CAPACITY PSA_ERROR_INSUFFICIENT_DATA
PSA_ERROR_TAMPERING_DETECTED PSA_ERROR_CORRUPTION_DETECTED

@ciarmcom ciarmcom requested review from a team December 20, 2019 14:00
@ciarmcom
Copy link
Member

@Patater, thank you for your changes.
@ARMmbed/mbed-os-tls @ARMmbed/mbed-os-crypto @ARMmbed/mbed-os-maintainers please review.

@Patater
Copy link
Contributor Author

Patater commented Dec 20, 2019

CI Started

@mbed-ci
Copy link

mbed-ci commented Dec 20, 2019

Test run: FAILED

Summary: 3 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

Update Mbed OS's PSA Crypto service to work with Mbed Crypto 3.x.

- psa_asymmetric_verify() is now called psa_verify_hash().
- psa_asymmetric_sign() is now called psa_sign_hash().

Compatibilty wrappers are provided via crypto_compat.h for source-level
backwards compatibility.
@Patater Patater force-pushed the update-tls-crypto-20191220 branch from 37d6ae7 to 689274b Compare December 20, 2019 16:01
@Patater
Copy link
Contributor Author

Patater commented Dec 20, 2019

CI Started

@mbed-ci
Copy link

mbed-ci commented Dec 20, 2019

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_cloud-client-pytest
  • jenkins-ci/mbed-os-ci_greentea-test

@bulislaw
Copy link
Member

It's a major change of crypto and i think some APIs moved, do we need a release note?

@adbridge
Copy link
Contributor

It's a major change of crypto and i think some APIs moved, do we need a release note?

@Patater That is mandatory for a major change. All sections of the template header should be filled in please.

@gilles-peskine-arm
Copy link

@adbridge @bulislaw I can write some release notes. I'm not familiar with Mbed OS documentation and release processes, can you point me to some guidelines or examples and let me know where to submit the text?

@bulislaw
Copy link
Member

Hey @gilles-peskine-arm have a look here #11687 you guys in TLS tend to write the best release notes :)

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

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

As requested previously, please add release notes for this update.

@Patater
Copy link
Contributor Author

Patater commented Jan 7, 2020

@bulislaw @0xc0170 I've updated this PR with release notes describing the API changes. No breaking change knowingly intended with this PR, but there are new PSA Crypto API deprecations.

@0xc0170 0xc0170 self-requested a review January 7, 2020 12:41
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 7, 2020

CI restarted

@0xc0170 0xc0170 added the release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 label Jan 7, 2020
@mbed-ci
Copy link

mbed-ci commented Jan 7, 2020

Test run: FAILED

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

Failed test jobs:

  • jenkins-ci/mbed-os-ci_cloud-client-pytest

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 7, 2020

mbed-os-ci_cloud-client restarted

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 8, 2020

@Patater It was at least 2x restarted. The failures are most probably valid and related to these changes. Please verify

@Patater
Copy link
Contributor Author

Patater commented Jan 10, 2020

@Patater It was at least 2x restarted. The failures are most probably valid and related to these changes. Please verify

I found a bug in Client's PAL that will need to be fixed before we can merge this. I raised a PR to fix the issue in Client.

@mergify mergify bot added the needs: work label Jan 20, 2020
@adbridge adbridge added release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0 and removed release-version: 6.0.0-alpha-1 First pre-release version of 6.0.0 labels Jan 22, 2020
@Patater
Copy link
Contributor Author

Patater commented Jan 23, 2020

The fix to Client will be released with version 4.3.0 of Client.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 6, 2020

The fix to Client will be released with version 4.3.0 of Client.

It was released this week, shall we progress with this PR now?

@Patater
Copy link
Contributor Author

Patater commented Feb 6, 2020

The fix to Client will be released with version 4.3.0 of Client.

It was released this week, shall we progress with this PR now?

Yes, please. Could we kick off CI and see if, now that CI will be testing with 4.3.0, anything will break?

Thanks!

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 7, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Feb 7, 2020

Test run: SUCCESS

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING-CHANGE release-version: 6.0.0-alpha-2 Second pre-release version of 6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants