Commit Graph

28 Commits (fc9e75bddc327ad372e58c868d206039b022db70)

Author SHA1 Message Date
Seppo Takalo fc9e75bddc Allow Devicekey::generate_root_of_trust() to define key size.
By default, generate 16 byte keys, to be compatible with bootloader.
But allow user to generate 32 byte keys as well.
2020-04-20 14:40:26 +03:00
Martin Kojtal ae0ec86d59
Merge pull request #12667 from boomer41/fix-devicekey
Add check for return code in DeviceKey to avoid injecting invalid ROT
2020-03-23 19:59:10 +01:00
Stephan Brunner c6e8ae56db
Use correct return value. 2020-03-23 09:26:30 +01:00
Stephan Brunner f01bc974ef
Add check for return code in DeviceKey to avoid injecting invalid ROT 2020-03-23 06:57:50 +01:00
Kimmo Vaisanen 29affbccab Remove explicit include of mbedtls/config.h
Including mbedtls/config.h should not be done explicitely. This prevents using MBEDTLS_CONFIG_FILE macro.
Correct config file is automatically included by other mbedtls header files.
2020-02-27 09:45:22 +02:00
Tymoteusz Bloch 0e7a53cdb1 DeviceKey Root of Trust generation refactored.
It's no longer automatically and silently created.
2020-02-18 16:32:20 +01:00
Seppo Takalo f0790cd7b2 Remove usage of Mbed TLS internal function from DeviceKey.
DeviceKey was using mbedtls_ssl_safer_memcmp() to compare result against
buffer of equal length, but zero content. This comparison makes no sense
as the entropy function is already returning proper error, if it fails.
2019-11-04 16:13:33 +02:00
Seppo Takalo 7f089ac074 Add empty unittest to generate zero baseline for untested files. 2019-11-04 16:12:36 +02:00
Chun-Chieh Li 1bb351f410 DeviceKey: Fix random key doesn't generate on MBEDTLS_ENTROPY_HARDWARE_ALT
Originally, when DEVICE_TRNG is defined, MBEDTLS_ENTROPY_HARDWARE_ALT will also be defined
accordingly to provide entropy source. This is fine for targets supporting TRNG. However, for
targets without TRNG, it is also possible to provide non-TRNG entropy source solution via the
define MBEDTLS_ENTROPY_HARDWARE_ALT. Related discussion can be found at:

https://github.com/ARMmbed/mbed-os/issues/11680
2019-10-22 17:06:12 +08:00
Yossi Levy f74d545a9d When reading ROT from KVStore the return ROT key size was ignored 2019-04-30 17:44:24 +03:00
Ron Eldor c94b5861e4 Add mbedtls platform setup and teardown to modules
Add calls to `mbedtls_platform_setup()`
and `mbedtls_platform_teardown()` to all modules and tests using Mbed TLS.
2019-02-18 11:43:32 +02:00
Yossi Levy d8d91c336a Adding MBEDTLS_ENTROPY_NV_SEED macro check in device key to allow key derivation when there is no TRNG but there is DRBG 2019-02-13 14:18:45 +02:00
Yossi Levy 2adf5db881 Adding a test if device key buffer has changed after calling to entropy func. this should enable as to eliminate some rare cases when the trng fail but still return success. 2019-01-10 10:18:44 +02:00
Stephan Brunner 9d8835741b
Fix security bug in DeviceKey 2019-01-07 18:04:33 +01: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
David Saada e073fb69b2 Change Device key to work with KVStore 2018-11-24 17:43:42 +02:00
Martin Kojtal bfb8b723c3 device key: fix coding style 2018-11-07 08:56:32 +00:00
Martin Kojtal f2cc21d038 device key: add memset include 2018-06-28 14:17:15 +01:00
Yossi Levy 7401aea36a Remove reset tests. Small change to cmac claculation in get_derived_key 2018-05-22 21:35:33 +03:00
Yossi Levy b95c5f79c0 Replace UINT16_MAX with (uint16_t)-1 because of build failure 2018-05-21 18:47:39 +03:00
Yossi Levy 492dc9f1fc Remove uneeded variables 2018-05-16 14:48:30 +03:00
Yossi Levy d816937975 Remove unnecessary remark 2018-05-16 13:24:46 +03:00
Yossi Levy bf9b2cb6c7 Fix for generate_key_by_trng 2018-05-16 12:17:20 +03:00
Yossi Levy d88f4b3084 Stricter parameter check 2018-05-16 11:44:45 +03:00
Yossi Levy 1cb43fa020 Fixing trng_get_bytes return status 2018-05-14 20:01:47 +03:00
Yossi Levy 789eb04617 Changed trng loop condition 2018-05-14 14:07:57 +03:00
Yossi Levy 73d1c8df93 Fix of error macros 2018-05-14 13:52:20 +03:00
Yossi Levy 98e83c2262 Implementing KDF in Counter Mode for key derivation function. Moving device key to features 2018-05-08 16:59:05 +03:00