Commit Graph

57 Commits (1d9c13ed5b0ebd6acde819e17a7a55174e3bbfce)

Author SHA1 Message Date
Hugues Kamba 65fbee1d33 NRF52840_DK: Fix baremetal linker error
Compile in the inclusion of cryptocell310 only if the library is included
in the build
2020-02-10 15:18:46 +00:00
Ron Eldor 33b7c8ea2e Fix Failure in cc ecdh_alt montgomery curve
Change the order of the input keys and output secret given and
returned from the CC API, to address correct endianity.
2019-09-18 16:48:45 +03:00
Martin Kojtal 21ebb725c5
Merge pull request #10991 from RonEld/update_readme_for_optin_in_modules
Explaining how to opt in modules
2019-09-06 11:41:41 +02:00
Martin Kojtal b9a6251c24
Merge pull request #10907 from RonEld/cc310_aes_port
Port aes cc310 driver
2019-08-23 11:47:17 +02:00
Ron Eldor 0b1b4cc908 Remove redundant file accidently added
Remove unneeded redundant file that was accidentally added.
2019-08-11 14:26:52 +03:00
Ron Eldor d09e3ef3b4 Style fixes
1. Remove redundant extra lines.
2. Have the function parameters aligned.
3. Remove redundant white spaces.
2019-08-11 14:03:34 +03:00
Seppo Takalo 54d7d7e4c3
Merge pull request #10913 from RonEld/sha512_cc310_porting
Port CC 310 sha 512 driver
2019-08-01 13:13:11 +03:00
Ron Eldor a1c5fcd9f7 Add a deinit function
Add a deinit function that will be called and check inside
whether context is initialized. This function is called for
freeing the CC context, instead of every time check that it's
initizliaed and free it.
2019-07-24 15:23:46 +03:00
Ron Eldor 4e29c8f939 Make the cmac context a typedef
Make the cmac context a typedef, to be compatible with c code.
2019-07-23 16:05:33 +03:00
Ron Eldor f492ce8405 Handle CC context correct
Initiate the CC context in the starts function and in the reset.
In the reset function, free aes context before.
Free the context in the finish function and reset function.
2019-07-23 16:05:27 +03:00
Ron Eldor 4cf3e1c1bc Style fixes
Remove redundant extra lines.
2019-07-23 13:54:09 +03:00
Amanda Butler 5ca5e74806
Edit Readme.md
Edit file, mostly for active voice, formatting and parallel construction.
2019-07-16 09:46:10 -05:00
Ron Eldor 2dcaecea3c Fix typo
suipport -> support
2019-07-09 11:42:37 +03:00
Ron Eldor a08b150546 Explaining how to opt in modules
Add a section in the CC Readme file explaining how to enable the optional module.
2019-07-08 18:43:39 +03:00
Ron Eldor 6b17df7685 Make the alternative sha512 optional
Have the alternative sha512 undefined by default,
in order not to break backwards compatability.
2019-07-08 18:32:18 +03:00
Ron Eldor a99ce834bd Make the alternative aes optional
Have the alternative aes undefined by default,
in order not to break backwards compatability.
`MBEDTLS_CTR_DRBG_USE_128_BIT_KEY` remains defined for better usability.
2019-07-08 18:29:52 +03:00
Ron Eldor 77d8b067bf Make the alternative cmac optional
Have the alternative cmac undefined by default,
in order not to break backwards compatability.
2019-07-08 18:27:54 +03:00
Ron Eldor a5aac1e4b6 Fix functionality issues
FIx some functionality issues for better visibility:
1. Allocate the context only for 128 bit key
2. Change oreder of freeing the resources.
2019-07-08 18:12:47 +03:00
Ron Eldor f5956ce90b Style fixes
Fix minor style fixes and typos:
1. Change file name to correct one.
2. Change copyright year.
3. Insert whitespaces before and after paranthesis.
4. Put `*` next to pointer name.
2019-07-08 18:10:48 +03:00
Ron Eldor 641c518c4e Port the cryptocell 310 cmac driver
Add support for CC310 CMAC driver returning
`MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` for key size other than 128 bits,
and for crypto algorithms other than AES( e.g. DES).
2019-07-02 18:50:28 +03:00
Ron Eldor 50d75394d3 Code improvements
1. Make common function for setting key, which receives
the direction as parameter.
2. Remove rediundant extra lines.
2019-07-01 13:37:26 +03:00
Ron Eldor a060c7b0cb Port CC 310 sha512 driver
Port the cc310 SHA512 driver, even though it is sw implementation.
Because the linker could not remove the cc310 sha512 implementation,
there was duplicate implementation of SHA512, without enabling
the sha512 alternative implementation.
2019-06-27 18:23:26 +03:00
Ron Eldor a58457d8a5 Port aes cc310 driver
Add support for CC310 AES driver,
returning `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED` for key size
other than 128 bits, and for AES modes not supported by the driver.
Use `MBEDTLS_CTR_DRBG_USE_128_BIT_KEY`.
2019-06-27 14:24:53 +03: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
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