Commit Graph

34 Commits (af3a7656a442d47f97d84569e96135b17ad9880c)

Author SHA1 Message Date
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
Ron Eldor e0571c0bf2 Change to mbedtls_platform_zeroize()
Change the use of the local static function `mbedtls_zeroize()` to
the Mbed TLS platform function `mbedtls_platform_zeroize()`.
2019-01-01 13:56:58 +02: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
Ron Eldor 244647088e Update the CC310 readme file
Update the Cryptocell 310 readme file with the binary library version
information.
2018-12-18 18:08:15 +02:00
Ron Eldor 03a2e07539 Update the CC310 GCC_ARM libraries
Update the cryptocell 310 GCC_ARM libraries with known version.
The libraries were built from the Cryptocell 310 release
version 1.1.0.1285, using arm-none-eabi-gcc 6.3.1 20170620 (release) (release).
2018-12-18 18:08:06 +02:00
Ron Eldor 297c0e43a4 Update the CC310 ARM libraries
Update the cryptocell 310 ARM libraries with known version.
The libraries were built from the Cryptocell 310 release version
1.1.0.1285, using `ARM Compiler 5.06 update 4 (build 422)`.
2018-12-18 18:04:51 +02:00
Ron Eldor 3a651a1144 Update the CC310 IAR libraries
Update the cryptocell 310 IAR libraries, since the previous ones were not
built correct. The libraries were built from the Cryptocell 310
release version 1.1.0.1285, using IAR version 7.80.1.11864.
2018-12-18 18:04:48 +02:00
Martin Kojtal 985afb8027
Merge pull request #8728 from RonEld/cryptocell_sha_alt_fixes
Fix issues in Cryptocell 310 shax_alt discovered by On Target Testing
2018-12-12 14:43:06 +01:00
Cruz Monrreal 79da14d1f4
Merge pull request #8797 from RonEld/cryptocell_ecc_errors_alt_fixes
Fix issues in Cryptocell 310 cc_internal discovered by On Target Testing
2018-11-30 17:51:50 -06:00
Ron Eldor bcbda3e621 Return not supported for internal process function
Return the `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` for the
internal process function, as it is not public.
2018-11-28 15:31:55 +02:00
Ron Eldor 7822fa8065 Style fixes
1. Change camelcase variables to Mbed OS style.
2. Remove functions declarations from the `_alt` header, since they
are now added from the module header regardless whether an alternative
implementation exists.
3. Remove the `extern "c"` declaration from the `_alt` headers.
4. Remove redundant extra lines.
2018-11-28 15:31:17 +02:00
Ron Eldor 5e0223f78f Add the platform generic errors
Replace the module specific errors with the `MBEDTLS_ERR_PLATFORM_XXX`
errors.
2018-11-26 15:33:17 +02:00
Ron Eldor 5ed3a64527 Return MBEDTLS_ERR_CCM_BAD_INPUT on invalid key
Return `MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE` only for valid key lengths,
that are not supported by Cryptocell 310. For other key sizes, return
`MBEDTLS_ERR_CCM_BAD_INPUT`
2018-11-26 15:33:16 +02:00
Ron Eldor 1b34927e83 Style fixes
1. Change camelcase variables to Mbed OS style.
2. Remove functions declarations from the `_alt` header, since they
are now added from the module header regardless whether an alternative
implementation exists.
3. Remove the `extern "c"` declaration from the `_alt` headers.
4. Remove whitespaces before opening parenthesis.
5. Fix alignment of function parameters.
6. Fix indentations.
7. Limit lines to 80 characters.
2018-11-26 15:32:46 +02:00
Ron Eldor c948eaad21 Fix issues in CC310 cc_internal discovered by OTT
Return `MBEDTLS_ERR_ECP_INVALID_KEY` when Cryptocell returns
`CRYS_ECPKI_BUILD_KEY_INVALID_PRIV_KEY_SIZE_ERROR`
or `CRYS_ECPKI_BUILD_KEY_INVALID_PUBL_KEY_SIZE_ERROR`,
When the key size is invalid. Found by the "ECDSA zero private parameter"
tests.
2018-11-26 15:09:00 +02:00
Ron Eldor d487c80d76 Additional fix for ccm_alt from On Target Testings
An additional fix for ccm_alt, when the message length is too big.
Check for specific error returned from CC310, and return
`MBEDTLS_ERR_CCM_BAD_INPUT`.
2018-11-26 15:02:19 +02:00
Ron Eldor 53c02d7457 Zeroize output buffer, upon authentication faliure.
Clear output buffer upon failure.
2018-11-26 15:01:02 +02:00
Ron Eldor 1aaff0e389 Return `MBEDTLS_ERR_CCM_AUTH_FAILED` where needed.
On authentication decryption, when the driver returns the relevant error,
return `MBEDTLS_ERR_CCM_AUTH_FAILED`.
2018-11-26 15:01:01 +02:00
Ron Eldor 4e7e0548d5 Fix memory overflow
Fix memory overflow, by adding a local buffer of type
`CRYS_AESCCM_Mac_Res_t `for the tag result, and copy to the input
parameter `tag`.
2018-11-26 14:59:59 +02:00
Ron Eldor 93e0f6493d Use mbedtls_platform_zeroize
Rplace calls to `mbedtls_zeroize()` to `mbedtls_platform_zeroize()`.
2018-11-26 14:57:43 +02:00
Ron Eldor 8cc8481a71 Add unsupported functions for CCM*.
Implement the CCM* functions, by returning `MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE`
2018-11-26 14:57:43 +02:00
Ron Eldor 9f4e752ef3 Modify HW accelerator drivers to new error code
Have the HW accelearation drivers return the platform module
errors about feature unsupported, and hw acceleration failure,
because the moduel specific errors will be removed.
2018-11-11 09:59:18 +02:00
Ron Eldor 2620508e12 Change Mbed TLS platform error code and value
Change error from `MBEDTLS_PLATFORM_HW_FAILED` to
`MBEDTLS_PLATFORM_HW_ACCEL_FAILED` and the value to 0x70,
as the previous value cannot be used as a low level error code.
2018-10-15 16:21:54 +03:00
Cruz Monrreal 3be076c196
Merge pull request #7099 from RonEld/platform_context_reference_count
Add reference counter for platform context
2018-09-02 20:47:19 -05:00
Ron Eldor a2531b5674 Fix build error on IAR
IAR fails to build when a variable is initialized with empty curly braces.
Added `{ { 0 } }` to fix that.
2018-09-02 10:48:31 +03:00
Ron Eldor 479438953f Rename error codes
1. Rename error codes to fit Mbed TLS error code names.
2. Remove the Invalid input error code, as it's not used anymore.
2018-08-29 19:02:57 +03:00
Ron Eldor 127b68fbbc Make the platform context a global variable
Make the platform context a global variable,
adding the refernce counter to it.
2018-08-28 20:29:26 +03:00
Ron Eldor c3b31bc500 Add Mbed TLS Platform module errors
1. Add error codes for platform setup \ teardown.
2. Reassign `reference_count` to 0 after terminating platform,
and remove condition for 0
2018-06-04 14:01:59 +03:00
Ron Eldor ca94a49eff Add reference counter for platform context
1. Move the `mbedtls_platform_context` to be platform code, in `features/mbedtls/platfrom/`.
2. Add static refernce counter, to setup and teardown the platform code only once.
3. Adjust Cryptocell porting accordingly.
2018-06-04 10:38:49 +03:00
Ron Eldor 9049860b25 Remove redundant Cryptocell libraries
Remove additional redundant libraries, that were accidently added in merges
2018-05-31 18:15:25 +03:00
Ron Eldor 77e87d3174 Check the size_t isn't larger than 32 bit
Assure that `size_t` isn't larger than 32 bit, with preprocessor check.
Using `#if SIZE_MAX > UINT_MAX`.
2018-05-23 08:37:27 +03:00
Ron Eldor d2bcf3c356 Change target name
Apply the CC changes to TARGET_MCU_NRF52840 , and not to
the DK target alone
2018-05-22 09:24:37 +03:00
Ron Eldor 23ba8bc1f5 Change Cryptocell target to a feature
Change the Cryptocell310 target to `FEATURE_CRYPTOCELL310`
2018-05-21 13:40:43 +03:00