Skip to content

Move tests/data_files to data_files in framework - #18

Merged
ronald-cron-arm merged 239 commits into
mainfrom
dev/davidhorstmann-arm/add-test-data-files
Jul 9, 2024
Merged

Move tests/data_files to data_files in framework#18
ronald-cron-arm merged 239 commits into
mainfrom
dev/davidhorstmann-arm/add-test-data-files

Conversation

@davidhorstmann-arm

@davidhorstmann-arm davidhorstmann-arm commented May 9, 2024

Copy link
Copy Markdown
Contributor

Move tests/data_files to the framework with history. Partial fix for #17.

daantimmer and others added 16 commits October 18, 2023 16:15
Signed-off-by: Daan Timmer <8293597+daantimmer@users.noreply.github.com>
A large block of code is only reachable if MBEDTLS_PK_USE_PSA_EC_DATA is
enabled, i.e. if MBEDTLS_USE_PSA_CRYPTO is enabled with driver-only ECC.
Compilers are likely to figure it out, but still, for clarity and
robustness, do guard that block of code with the appropriate conditional
compilation guard.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Troy-Butler <squintik@outlook.com>
Signed-off-by: Troy-Butler <squintik@outlook.com>
Replace relevant Mbed TLS API config options with their PSA
API equivalents.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Replace relevant Mbed TLS API config options with their PSA
API equivalents.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
…se_psa

Replace relevant Mbed TLS API config options with their PSA
API equivalents.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
When trying to decrypt data with an invalid key, we found that `mbedtls`
returned `0x6200` (`-25088`), which means "_CIPHER - Input data contains
invalid padding and is rejected_" from `mbedtls_cipher_finish`, but it also
set the output len as `18446744073709551516`.

In case we detect an error with padding, we leave the output len zero'ed
and return `MBEDTLS_ERR_CIPHER_INVALID_PADDING`. I believe that the current
test cases are sufficient, as they fail if I return the alternative code
`MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA`, so they do already expect a padding
failure, but now we don't change the output len in the error case.

Here's a reference for the way `openssl` checks the padding length:
  - https://github.com/openssl/openssl/blob/1848c561ec39a9ea91ff1bf740a554be274f98b0/crypto/evp/evp_enc.c#L1023
  - openssl/openssl@b554eef

Signed-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andre Goddard Rosa <agoddardrosa@roku.com>
Signed-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andre Goddard Rosa <agoddardrosa@roku.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
…cases

With the robustness fix:
`PASSED (125 suites, 26639 tests run)`

Without the robustness fix:
`FAILED (125 suites, 26639 tests run)`

Signed-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andre Goddard Rosa <agoddardrosa@roku.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
On the CI, the git version when running on
Ubuntu 16.04 is 2.7 and it does not support
the "--recurse-submodules" option of
"git ls-files" thus do not use it.

Another argument to not use it is that
when TF-PSA-Crypto will be a submodule of
mbedtls we will not want check_files.py to
check the TF-PSA-Crypto files as well.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
tom-daubney-arm and others added 10 commits May 14, 2024 16:09
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Unfortunately this compiler complains about a variable potentially being
used un-initialized.  Silence the warning by initializing it to a sane
default.

Signed-off-by: Patrick Wildt <pwildt@google.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
Signed-off-by: Turiiya <34311583+ttytm@users.noreply.github.com>
Alert if all tests are filtered out or skipped: that probably indicates a
test script that set up an unintended configuration or an overly strict
filter. You can pass `--min 0` to bypass this check. You can pass `--min`
with a larger value to require that many test cases to run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
psa_crypto_mac.c uses mbedtls_cipher_xxx() functions to perform
CMAC operations. Therefore we need to enable CIPHER_C when
PSA CMAC is builtin.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
gilles-peskine-arm and others added 18 commits July 3, 2024 14:41
…padding-len-on-aes-128-cbc-decryption

Add invalid `padding_len` check in `get_pkcs_padding`
Replace MBEDTLS_MD_CAN_SHA224 with PSA_WANT_ALG_SHA_224
Since MD_OR_USE_PSA_INIT() can fail and jump to the "exit"
label it should be placed after all initializations has been
done. This issue was discovered by Coverity testing.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
Replace MBEDTLS_MD_CAN_RIPEMD160 with PSA_WANT_ALG_RIPEMD160
tests_suite_debug: fix psa initialization
Replace MBEDTLS_MD_CAN_SHA384 with PSA_WANT_ALG_SHA_384
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
Replace MBEDTLS_MD_CAN_SHA3_512 with PSA_WANT_ALG_SHA3_512
…cm_star-iv_length_enforcement

psa_cipher_decrypt CCM*: fix rejection of messages shorter than 3 bytes
Fix NULL argument handling in mbedtls_xxx_free() functions
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
Replace MBEDTLS_MD_CAN_SHA3_256 with PSA_WANT_ALG_SHA3_256
Signed-off-by: David Horstmann <david.horstmann@arm.com>
Tell the test certificate generation script to get the jinja template
from, and output the resulting header to, the framework repo.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
@davidhorstmann-arm
davidhorstmann-arm force-pushed the dev/davidhorstmann-arm/add-test-data-files branch from fd307a9 to 1b173ae Compare July 5, 2024 14:51
@davidhorstmann-arm

Copy link
Copy Markdown
Contributor Author

Rebased by doing the following actions:

  • Recreate the file-move commit on top of latest development from mbedtls and the latest main from the framework
  • Cherry-pick one commit from the existing branch. There were no conflicts.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tom-daubney-arm tom-daubney-arm added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members. needs-reviewer This PR needs someone to pick it up for review labels Jul 8, 2024

@tom-daubney-arm tom-daubney-arm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM - thanks!

@ronald-cron-arm

Copy link
Copy Markdown
Contributor

Validated by the CI of #9249 (dev) and #9375 (3.6), merging.

@ronald-cron-arm
ronald-cron-arm merged commit 8853c84 into main Jul 9, 2024
bjwtaylor pushed a commit to bjwtaylor/mbedtls-framework that referenced this pull request Jul 9, 2026
scripts: add generate_ssl_session_reset_check.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Design and code approved - may be waiting for CI or backports

Projects

No open projects

Development

Successfully merging this pull request may close these issues.