The Wayback Machine - https://web.archive.org/web/20201109182236/https://github.com/ARMmbed/mbedtls/pull/3836
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

Do not set iv size for ECB mode ciphers #3836

Merged
merged 1 commit into from Nov 6, 2020

Conversation

@bensze01
Copy link
Contributor

@bensze01 bensze01 commented Oct 29, 2020

This PR fixes the mbedtls_cipher_info_t structures in library/cipher_wrap.c that erroneously declare that block ciphers in ECB mode use IVs. (The AES ECB mode ciphers were already correct).

Status

READY

Requires Backporting

Yes
Which branch?

Migrations

If there is any API change, what's the incentive and logic for it.

NO

Todos

  • Backported
@bensze01 bensze01 self-assigned this Oct 29, 2020
@bensze01 bensze01 added this to To Do in Mbed TLS Unified Board via automation Oct 29, 2020
@bensze01 bensze01 changed the title Do not set iv size for ECB Do not set iv size for ECB mode ciphers Oct 29, 2020
@bensze01 bensze01 force-pushed the bensze01:ecb_iv_fix branch from 7f3b256 to a2bf2b4 Oct 29, 2020
@ronald-cron-arm ronald-cron-arm self-requested a review Nov 3, 2020
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

The ECB code doesn't use the IV information, so this is unlikely to affect application code. The information is not used in the library (it's only used for CBC to do padding and in some AEAD code) so there's no test data to fix. Code that was calling mbedtls_cipher_set_iv(&ctx, iv, mbedtls_cipher_get_iv_size(&ctx)) for ECB will still work.

It would be good to have tests for this metadata but that's part of a large test gap so I won't request a non-regression test here.

Please write a changelog entry. Other than that looks good to me.

Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

LGTM

@bensze01 bensze01 force-pushed the bensze01:ecb_iv_fix branch from a2bf2b4 to 9d73771 Nov 6, 2020
Mbed TLS Unified Board automation moved this from To Do to In Progress Nov 6, 2020
@bensze01 bensze01 removed the needs: work label Nov 6, 2020
@@ -0,0 +1,3 @@
Bugfix
* Correct the default iv size for mbed_cipher_info_t structures using
MBEDTLS_MODE_ECB to 0, since ecb mode ciphers don't use ivs.

This comment has been minimized.

@ronald-cron-arm

ronald-cron-arm Nov 6, 2020
Contributor

Nitpick: ECB instead of ecb and while at it probably that "IV" is better than "iv".

This comment has been minimized.

@bensze01

bensze01 Nov 6, 2020
Author Contributor

Done.

ECB mode ciphers do not use IVs

Signed-off-by: Bence Szépkúti <[email protected]>
@bensze01 bensze01 force-pushed the bensze01:ecb_iv_fix branch from 9d73771 to a8e40dd Nov 6, 2020
@bensze01 bensze01 requested a review from ronald-cron-arm Nov 6, 2020
Copy link
Contributor

@ronald-cron-arm ronald-cron-arm left a comment

LGTM

@gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Nov 6, 2020

pr-merge passed but the status reporting to GitHub failed.

Mbed TLS Unified Board automation moved this from In Progress to Has Approval Nov 6, 2020
@gilles-peskine-arm gilles-peskine-arm merged commit e3994d7 into ARMmbed:development Nov 6, 2020
8 of 10 checks passed
8 of 10 checks passed
continuous-integration/jenkins/pr-merge This commit cannot be built
Details
PR-3836-merge Result analysis In progress
Details
DCO DCO
Details
PR-3836-head Pre Test Checks OK
Details
PR-3836-head Result analysis OK
Details
PR-3836-head TLS Testing All tests passed
Details
PR-3836-merge Pre Test Checks OK
Details
PR-3836-merge TLS Testing All tests passed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Mbed TLS Unified Board automation moved this from Has Approval to Done Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.