Commit graph

20 commits

Author SHA1 Message Date
Valerio Setti 4fc6506a8a random: enable AES support CTR_DRBG CSPRNG when it relies on Mbed TLS
PR #72475 disabled default enabling of many Mbed TLS features
including AES. This means that now it must be explicitly added
when required.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-03 16:13:05 -04:00
Valerio Setti a15af0be9f mbedtls: fix Mbed TLS Kconfig options
PR #72475 disabled default enabling of most Mbed TLS features.
This means that:

- CONFIG_MBEDTLS_CIPHER_AES_ENABLED needs to be manually enabled
  when required;
- CONFIG_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC does not need to
  be (almost) always added because there is no default RSA
  key-exchange enabled, so PSA can be built without RSA support.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-06-03 09:55:58 +02:00
Valerio Setti c36d9ec3a8 test: mbedtls: do not enable USE_PSA and all PSA features
Before #72243 Mbed TLS was not using
USE_PSA and all PSA features were not enabled. After #72243
if BUILD_WITH_TFM is set:
- USE_PSA in Mbed TLS is enabled by default and
- all PSA features are enabled.

This commits reverts both changes for tests/crypto/mbedtls
test case.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-31 08:05:37 +02:00
Valerio Setti dfae5ba7de mbedtls: fix entropy module enablement
- Do not set CONFIG_MBEDTLS_ZEPHYR_ENTROPY in
  tests/crypto/mbedtls because this can cause test failure on
  real devices in which test thread do not have access to
  drivers.
- make MBEDTLS_PSA_CRYPTO_RND_SOURCE depending on
  MBEDTLS_PSA_CRYPTO_C because it only makes sense when the
  latter is defined

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-15 14:55:16 +02:00
Valerio Setti a58f8eb3ed tests: mbedtls: add missing CONFIGS
CONFIG_MINIMAL_LIBC was required for:
- CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS
- CONFIG_MINIMAL_LIBC_RAND

while CONFIG_ENTROPY_GENERATOR and CONFIG_MBEDTLS_ZEPHYR_ENTROPY
are required for CRYPTO_C.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-05-09 10:27:30 +02:00
Anas Nashif 345735d0a8 tests: remove CONFIG_ZTEST_NEW_API in all tests
Remove all usage of CONFIG_ZTEST_NEW_API from tests and sample as this
is now enabled by default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-10-20 15:04:29 +02:00
Enjia Mai ae30549207 tests: crypto: move the mbedtls test to new ztest API
Migrate the testsuite tests/crypto/mbedtls to the new
ztest API.

Signed-off-by: Enjia Mai <enjia.mai@intel.com>
2022-09-01 20:36:15 -04:00
Marcin Niestroj 945b5085c5 tests: crypto: mbedtls: remove default mbedTLS options
Whenever MBEDTLS_BUILTIN is selected then
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h" is set as a default value.
It is even impossible to change it, as without CUSTOM_MBEDTLS_CFG_FILE it
is just a hidden (not configurable by user) Kconfig option.

Remove explicit configuration from prj.conf.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-06-23 09:10:03 +02:00
Stephanos Ioannidis 4735e10630 libc: minimal: Introduce CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS
This commit introduces a new configuration called
`CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS`, which enables the
traditional non-reentrant (i.e. not thread-safe) version of the C
standard library functions such as rand() and gmtime() when the
respective configs are enabled.

The non-reentrant functions make use of the globals and require an
additional memory partition (MPU region), which is scarce on low-end
devices, when CONFIG_USERSPACE=y.

The purpose of this option is to classify the MPU resource intensive
functions as a separate category and only enable them when there is a
demand for such.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-01 11:03:38 +02:00
Carles Cufi 4b8f1c04ab kconfig: Rename the ZTEST stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Yasushi SHOJI 5e535a8551 tests: crypto: mbedtls: Remove local implementation of rand()
When MBEDTLS_RSA_C is defined, mbedtls define its local version of
rand() function.  Since we already have rand() in our minimal libc, we
can safely remove this.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-07-20 13:32:36 -04:00
Andrew Boie 7b1ee5cf13 tests: CONFIG_TEST_USERSPACE now off by default
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.

Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.

This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.

tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.

Fixes: #15103 (and probably others)

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Flavio Ceolin 8b70ace563 crypto: tests: Change crypto tests to use Kconfig defined header
While it's possible to define which mbedTLS config header to use, our
samples should use config-tls-generic.h as default because this header
is configurable through Kconfig.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-06 21:11:31 -04:00
Andrew Boie aa26d9926a tests: mbedtls: don't use stdout console
This redirects PRINT() to printf() and not printk() and
was causing stack overflows on some platforms.

Fixes: #8033

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2018-05-30 15:55:18 -05:00
Andy Ross 61c0189b91 tests/crypto/mbedtls: Disable CONFIG_FORCE_NO_ASSERT
The root cause for this issue was found in
https://github.com/zephyrproject-rtos/zephyr/issues/6470
so this kconfig isn't needed anymore.

This is a partial reversion of 6eef2f14.  The actual feature is left
in place, as it's plausibly useful in other contexts (otherwise
assertions enabled by sanitycheck can't be disabled by the app as
they're passed in via CFLAGS).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-03-06 14:13:56 -08:00
Andy Ross 6eef2f1485 misc: Add a FORCE_NO_ASSERT kconfig directive
The mbedtls test is hitting a compiler bug where two subtests will
soft fail on qemu_xtensa when assertions are enabled.  This is despite
the fact that:

+ The failure is entirely internal to the mbedtls suite.
+ The mbedtls code does not use zephyr asserts
+ The mbedtls code does not call into zephyr code that might assert.
+ The behavior persists even when an irq_lock() is held across the
  entire test, ruling out any asserts in interrupt/exception context.
+ And EVEN WHEN the mbedtls library blobs are bytewise identical
  between assert and non-assert cases.

The bug seems to be a layout thing where the mbedtls code behavior
differently based on code address and/or link-time optimizations
(xtensa has a few).

Unfortunately sanitycheck enables assertions by setting CFLAGS
directly and not via kconfig, so we can't fix this by turning the
feature off in an app right now.  This patch adds a simple "override"
flag that can be set by apps like this that hit bugs.

Again, note that zephyr assertions are not used nor needed by this one
test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-02-16 10:44:29 -05:00
Paul Sokolovsky 42680b07af mbedtls: Switch default MBEDTLS_CFG_FILE to config-mini-tls1_2.h
The previous default, "config-threadnet.h", is more or less arbitrary
choice made in a commit 312def2c78 1.5 years ago. In particular,
it's not related to Thread support in Zephyr per se (there was no
such support at that time).

It doesn't make sense to have a default intended for a particular,
not widely used (yet) protocol. Instead, the default should work
out of the box with a contemporary widely deployed arrays of TLS
servers, which are HTTPS server. config-mini-tls1_2.h works with
https://google.com, and by extension, with many other servers on
the Internet.

So, have that as the default, and let applications with special
needs to override that to what they need.

Addresses: #6132

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-02-15 12:35:31 -05:00
Niranjhana N 4e40b843e4 tests: mbedtls: convert to ztest
- replaced CONFIG_MAIN_STACK_SIZE with CONFIG_ZTEST_STACKSIZE
  in the config file
- split the main file into two files:
    - main.c has ztest entry and runs separate functions for ztest
    - mbedtls.c has the original routines

JIRA: ZEP-2449

Signed-off-by: Niranjhana N <niranjhana.n@intel.com>
2017-08-07 22:39:47 -04:00
Anas Nashif 8d108c9d59 tests: mbedtls: cleanup prj.conf
Remove platform specific option CONFIG_ARC_INIT and a copy/pasted
comment with "#nothing here".

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-05 12:43:13 -04:00
Anas Nashif 0772abff24 tests: rename test directory test_mbedtls -> mbedtls
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04:00
Renamed from tests/crypto/test_mbedtls/prj.conf (Browse further)