Commit Graph

282 Commits (23cd1aa083cc099ce3ce2a0a024da3578d711204)

Author SHA1 Message Date
avolinski f976ce3c18 Temporary disable Crypto HW accelerator on STM32F439xI chipset due to issue: https://github.com/ARMmbed/mbed-os/issues/10095 2019-03-14 17:00:06 +02:00
Simon Butcher 5285b39c01 Update Mbed TLS to the latest development version
This updates Mbed TLS to the latest development version, commit 535ee4a35b9c
in the Mbed TLS repo.
2019-03-03 23:04:00 +00:00
Simon Butcher 86825a65b6 Move the Mbed TLS target to the development branch
Before moving to the new release of Mbed TLS, this moves the default imported
version of Mbed TLS to the development branch, and will import the HEAD of the
branch, not just a specific release.
2019-03-03 22:59:00 +00:00
Simon Butcher 21c6c90519 Make the storage configs dependent on the PSA label
This commit makes the storage configurations - setting
MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C and unsetting
MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C - dependent on the PSA label being defined for
the target.

Previously these symbols were always defined for all platforms which could
cause problems for targets that don't yet support PSA.
2019-03-03 22:55:38 +00:00
Jaeden Amero d63677f207 crypto: Update to Mbed Crypto 1.0.0d7 2019-02-27 07:24:50 +00:00
Jaeden Amero e5c1e0b7a7 crypto: Update to Mbed Crypto 1.0.0d6 2019-02-22 09:54:01 +00:00
Jaeden Amero c101a224bc crypto: Update to Mbed Crypto 1.0.0d5 2019-02-22 09:53:59 +00:00
David Saada 41eb5cbfd9 Implement PSA protected storage & restructure PSA storage implementation
- Move all PSA storage code under psa/storage directory
- Create a global PSA error codes header, eliminating ITS specific ones
- Create a common header file for PSA storage type definitions,
  eliminating ITS specific ones
- Create a common implementation for PS & ITS
- Implement protected storage feature
- Change ITS test to be common to PS as well
2019-02-21 20:58:59 +02:00
Jaeden Amero fdc57f88cf crypto: Update to Mbed Crypto 1.0.0d4 2019-02-20 22:21:16 +02:00
Jaeden Amero 4a25069611 crypto: Update Mbed Crypto to 1.0.0d3 2019-02-20 11:31:30 +02:00
Ron Eldor 77f9faf46c Use a mutex in platform setup \ teardown functions
Use a singleton Mutex in platforms_alt functions, to be shared
with the trng function, to save RAM. Rename `platform_alt.c`
to `platform_alt.cpp` as the mutex is in a `singletonPtr`
template class.
2019-02-18 11:43:32 +02:00
Cruz Monrreal b820ec8922
Merge pull request #9561 from theotherjimmy/test-resources
Tools changes for bare metal
2019-02-13 12:31:54 -06:00
Alexander Zilberkant 4a204015ac Simplify entropy seed injection configuration
Move NVSEED callbacks configuration to a header file
2019-02-05 15:48:41 +02:00
Alexander Zilberkant 0622cc9865 Add header guard 2019-02-05 15:48:41 +02:00
Alexander Zilberkant 6e87615dc4 Fix compilation warning
Fix warning in entropy.c caused by injecting seed read & write callbacks
2019-02-05 15:48:41 +02:00
Martin Kojtal dcba5ffa3c
Merge pull request #9529 from kfnta/its_crypto
RollUp PR Crypto with ITS
2019-02-04 17:14:05 +01:00
Oren Cohen 156d3b785b Replace psa_prot_internal_storage.h with psa/internal_trusted_storage.h 2019-01-31 17:17:54 +02:00
Jaeden Amero 84ec1f7f1f crypto: Update to Mbed Crypto 1.0.0d2 2019-01-31 17:17:52 +02:00
Kevin Bracey 983503f9ee Mutex-protect mbedtls_hardware_poll
Like all HAL APIs, the calls in trng_api.h are not expected to
be thread-safe.

All current accesses to the TRNG HAL are currently via
`mbedtls_hardware_poll`.  Mbed TLS does not currently serialise these
calls itself, as `MBEDTLS_THREADING_C` is not enabled. But even if
Mbed TLS's own accesses were serialised, there are other direct
users of `mbedtls_hardware_poll` such as randLIB, that need to use
direct calls due to lack of API to extract entropy from Mbed TLS.

As such it makes sense to treat `mbedtls_hardware_poll` as a de facto
public Mbed OS API, akin to the C++ veneers on top of the HAL, and add a
PlatformMutex there so that it is safe for multithreaded use.
2019-01-29 12:45:48 +02:00
Jaeden Amero c3223072dc crypto: Update to Mbed Crypto 1.0.0d1 2019-01-29 11:43:26 +02:00
Jaeden Amero 4a1584696c crypto: importer: Update with fetch
Instead of doing a "pull --rebase" to update to the latest development
branch, do a "fetch" followed by a "checkout" to update to the specified
release. This enables us to get any new tags created since the last
update to the development branch, and removes the noise of updating a
local "development" branch.
2019-01-29 11:43:25 +02:00
Jaeden Amero c74993bac4 crypto: Re-import Mbed Crypto 0.1.0b2
Use the Mbed-Crypto-specific importer script to re-import Mbed Crypto
0.1.0b2 to its new location.
2019-01-29 11:43:24 +02:00
Jaeden Amero b5cf455bb7 tls/crypto: Make mbed-crypto importer independent
Obtain the version of Mbed Crypto to use not from the Mbed TLS
submodule, but independently through the Mbed Crypto importer instead.
2019-01-29 11:43:24 +02:00
Ron Eldor cad40e1633 Rename the platform context varaiable
Rename the generic name `ctx` of `mbedtls_platform_context`
in `platform_alt.c` to a specific name `plat_ctx`, to avoid conflicts
when used as external in crypto modules.
2019-01-22 13:57:32 +02:00
Ron Eldor 4ea68829c5 Rename the platform specific crypto_platform
To avoid collisions between the psa `crypto_platform.h` file and the
platform specific `crypto_platform.h` file, for the init \ terminate
functions, rename the latter to `crypto_device_platform`.
2019-01-22 13:56:59 +02:00
Jimmy Brisson e201fdb6e9 Add placeholder libraries for things we probably refer to as libraries 2019-01-16 14:58:58 -06:00
Simon Butcher 7bf33f01f9 Parameterise repo used in Mbed TLS importer script
This commit makes the repo used to import new Mbed TLS versions into Mbed OS
a parameter, to allow CI scripts (and any other script or users) to specify
specific repos to use for testing.
2019-01-11 13:51:19 +00:00
Alastair D'Silva 2617c5d55b Don't use define checks on DEVICE_FOO macros (mbed code)
The DEVICE_FOO macros are always defined (either 0 or 1).

This patch replaces any instances of a define check on a DEVICE_FOO
macro with value test instead.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2018-12-20 10:16:42 +11:00
ccli8 ca44675086 [Nuvoton] Fix crypto AC management
1. For SHA AC, use atomic flag to manage its ownership.
   (1) Nuvoton SHA AC doesn't support SHA context save & restore, so S/W
       SHA fallback has been supported before. To make non-blocking 'acquire'
       semantics clearer, introduce 'try_acquire' to substitute for 'acquire'.
   (2) No biting CPU due to mechanism above.
   (3) No deadlock due to mechanism above.
2. For AES/DES/ECC AC, change to mutex to manage their ownership.
   (1) Change crypto-misc.c to crypto-misc.cpp to utilize C++ SingletonPtr
       which guarantees thread-safe mutex construct-on-first-use.
   (2) With change to crypto-misc.cpp, add 'extern "C"' modifier to CRYPTO_IRQHandler()
       to avoid name mangling in C++.
   (3) No priority inversion because mutex has osMutexPrioInherit attribute
       bit set.
   (4) No deadlock because these AC are all locked for a short sequence
       of operations rather than the whole lifetime of mbedtls context.
   (5) For double mbedtls_internal_ecp_init() issue, it has been fixed in upper
       mbedtls layer. So no need to change ecc init/free flow.
2018-12-19 10:17:39 +08:00
ccli8 b16b1dbeb9 [M487] Fix return error code when ECC H/W acceleratioin is failed 2018-12-14 17:28:30 +08:00
Janos Follath 71387e33f1 Mbed TLS: Fix ECC hardware double initialization
We initialized the ECC hardware before calling
mbedtls_ecp_mul_shortcuts(). This in turn calls
mbedtls_ecp_mul_restartable(), which initializes and frees the hardware
too. This issue has been introduced by recent changes and caused some
accelerators to hang.

We move the initialization after the mbedtle_ecp_mul_shortcuts() calls
to avoid double initialization.
2018-12-07 11:18:40 +00:00
Cruz Monrreal 3325070701
Merge pull request #8936 from RonEld/reduce_default_mpi_max_size
Reduce default MBEDTLS_MPI_MAX_SIZE
2018-12-04 12:22:15 -06:00
Martin Kojtal e02a8ab2f1
Merge pull request #8925 from Patater/crypto-storage-config-fixes
Fix PSA storage typo
2018-12-04 14:34:15 +01:00
Martin Kojtal 992bcbafdb
Merge pull request #8926 from Patater/mbedtls-2.15.1
mbedtls: Update Mbed TLS to 2.15.1
2018-12-04 09:32:30 +01:00
Ron Eldor edc09cf087 Add comment for reasoning for changing default
Add a comment in the `adjust-config.sh` script, for effects
and benefits of the new value.
2018-12-03 18:59:25 +02:00
Ron Eldor 097996c25a Reduce default MBEDTLS_MPI_MAX_SIZE
Reduce the default size of `MBEDTLS_MPI_MAX_SIZE` to 512 bytes,
as the default 1024 consumes much stack, and supporting RSA 4096 bit
may suffice at the moment.
2018-12-03 18:59:25 +02:00
Juho Eskeli 361d804e2e STM32L4: before calling HAL_CRYP_DeInit initialize the Instance member 2018-12-03 16:07:49 +02:00
Jaeden Amero f9417ac12b crypto: storage: Fix PSA_PS_ERROR_OFFSET typo
Correct typo of PSA_PS_ERROR_OFFSET to PSA_ITS_ERROR_OFFSET.
2018-11-30 15:36:22 +00:00
Jaeden Amero 74f93271ab mbedtls: Update Mbed TLS to 2.15.1 2018-11-30 15:29:34 +00:00
Netanel Gonen f1c5aeb70e add MBEDTLS_PSA_CRYPTO_C defined to K64F PSA target 2018-11-27 14:02:55 +02:00
Mohammad AboMokh 819594477c Refactor trng_get_bytes() 2018-11-27 12:15:52 +02:00
Mohammad AboMokh b9ea334f1f Change __WEAK to MBED_WEAK 2018-11-27 12:15:26 +02:00
mohammad1603 4cef73d2eb Update output_length in trng_get_bytes() provided by psa. 2018-11-27 11:56:58 +02:00
Danny Shavit e72d910754 Add a weak implementation for trng_get_bytes() 2018-11-27 11:56:49 +02:00
Netanel Gonen 4816266205 add comment to explain why (-1 * rc) is returned 2018-11-27 11:56:44 +02:00
Netanel Gonen ae0fa609a9 remove psa_its_get_info from seed read function 2018-11-27 11:56:42 +02:00
Mohammad AboMokh 0fde6af120 change MBEDTLS_RANDOM_SEED_ITS_UID define to be PSA_CRYPTO_ITS_RANDOM_SEED_UID 2018-11-27 11:56:36 +02:00
Mohammad AboMokh 7b2c924ac7 Adding defualt behaviour for platforms without TRNG.
If setting the MBEDTLS_PLATFORM_NV_SEED_ALT and MBEDTLS_ENTROPY_NV_SEED flags and not
setting MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and MBEDTLS_PLATFORM_NV_SEED_READ_MACRO flags
mbed-os will add an entropy source to the relevent partition - SPE in case of daul core or
in case of single core V7 to the main partition.

The defualt behaviour will be to read or write the data from the ITS.
2018-11-27 11:56:31 +02:00
Martin Kojtal 7a77e66472
Merge pull request #8643 from RonEld/feature_unsupported_error_support
Modify HW accelerator drivers to new error code
2018-11-26 10:59:14 +01:00
Jaeden Amero 3900b81d02 Update Mbed TLS to mbedtls-2.15.0 2018-11-23 22:54:09 +00:00