Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"

#if defined(MBEDTLS_AES_ALT)

/* Parameter validation macros based on platform_util.h */
#define AES_VALIDATE_RET( cond ) \
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_AES_BAD_INPUT_DATA )
#define AES_VALIDATE( cond ) \
MBEDTLS_INTERNAL_VALIDATE( cond )

#if defined(MBEDTLS_AES_ALT)

#include "crypto_common.h"
#include "cy_crypto_core.h"

Expand Down Expand Up @@ -107,7 +107,9 @@ static int aes_set_keys( mbedtls_aes_context *ctx, const unsigned char *key,
cy_en_crypto_aes_key_length_t key_length;
cy_en_crypto_status_t status;

AES_VALIDATE( ctx != NULL );
AES_VALIDATE_RET( ctx != NULL );
AES_VALIDATE_RET( key != NULL );


switch( keybits )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,5 @@ void cy_hw_sha_clone( void *ctxDst, const void *ctxSrc, uint32_t ctxSize,
CY_CRYPTO_CHECK_PARAM( shaBuffersDst != NULL );

Cy_Crypto_Core_MemCpy(((cy_hw_crypto_t *)ctxSrc)->base, ctxDst, ctxSrc, (uint16_t)ctxSize);
Cy_Crypto_Core_Sha_Init(((cy_hw_crypto_t *)ctxSrc)->base, hashStateDst, hashStateDst->mode, shaBuffersDst);
Cy_Crypto_Core_Sha_Init(((cy_hw_crypto_t *)ctxSrc)->base, hashStateDst, (cy_en_crypto_sha_mode_t)hashStateDst->mode, shaBuffersDst);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2669,21 +2669,31 @@ cy_en_crypto_ecc_curve_id_t cy_get_dp_idx(mbedtls_ecp_group_id gid)

switch( gid )
{
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
case MBEDTLS_ECP_DP_SECP192R1:
dp_idx = CY_CRYPTO_ECC_ECP_SECP192R1;
break;
#endif /* defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED) */
#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
case MBEDTLS_ECP_DP_SECP224R1:
dp_idx = CY_CRYPTO_ECC_ECP_SECP224R1;
break;
#endif /* defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED) */
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
case MBEDTLS_ECP_DP_SECP256R1:
dp_idx = CY_CRYPTO_ECC_ECP_SECP256R1;
break;
#endif /* defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) */
#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
case MBEDTLS_ECP_DP_SECP384R1:
dp_idx = CY_CRYPTO_ECC_ECP_SECP384R1;
break;
#endif /* defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED) */
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
case MBEDTLS_ECP_DP_SECP521R1:
dp_idx = CY_CRYPTO_ECC_ECP_SECP521R1;
break;
#endif /* defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) */

default:
dp_idx = CY_CRYPTO_ECC_ECP_NONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@

#include <string.h>

#if defined(MBEDTLS_SHA1_ALT)

/* Parameter validation macros based on platform_util.h */
#define SHA1_VALIDATE_RET(cond) \
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA1_BAD_INPUT_DATA )
#define SHA1_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond )

#if defined(MBEDTLS_SHA1_ALT)

void mbedtls_sha1_init( mbedtls_sha1_context *ctx )
{
SHA1_VALIDATE( ctx != NULL );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@

#include <string.h>

#if defined(MBEDTLS_SHA256_ALT)

/* Parameter validation macros based on platform_util.h */
#define SHA256_VALIDATE_RET(cond) \
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA256_BAD_INPUT_DATA )
#define SHA256_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond )

#if defined(MBEDTLS_SHA256_ALT)

void mbedtls_sha256_init( mbedtls_sha256_context *ctx )
{
SHA256_VALIDATE( ctx != NULL );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@

#include <string.h>

#if defined(MBEDTLS_SHA512_ALT)

/* Parameter validation macros based on platform_util.h */
#define SHA512_VALIDATE_RET(cond) \
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA512_BAD_INPUT_DATA )
#define SHA512_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond )

#if defined(MBEDTLS_SHA512_ALT)

void mbedtls_sha512_init( mbedtls_sha512_context *ctx )
{
SHA512_VALIDATE( ctx != NULL );
Expand Down
13 changes: 9 additions & 4 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8844,7 +8844,7 @@
"WATCHDOG"
],
"release_versions": ["5"],
"extra_labels": ["Cypress", "PSOC6"],
"extra_labels": ["Cypress", "PSOC6", "MXCRYPTO"],
"components_add": ["SOFTFP", "RTX"],
"public": false,
"overrides" : {
Expand All @@ -8869,6 +8869,7 @@
"device_has_remove": ["ANALOGOUT"],
"extra_labels_add": [
"PSOC6_02",
"MXCRYPTO_02",
"CM0P_SLEEP",
"WHD",
"4343W",
Expand All @@ -8887,6 +8888,7 @@
"device_has_remove": ["ANALOGOUT"],
"extra_labels_add": [
"PSOC6_02",
"MXCRYPTO_02",
"CM0P_SLEEP",
"WHD",
"43012",
Expand All @@ -8905,6 +8907,7 @@
"supported_form_factors": ["ARDUINO"],
"extra_labels_add": [
"PSOC6_01",
"MXCRYPTO_01",
"CM0P_SLEEP",
"WHD",
"4343W",
Expand Down Expand Up @@ -8946,6 +8949,7 @@
"supported_form_factors": ["ARDUINO"],
"extra_labels_add": [
"PSOC6_01",
"MXCRYPTO_01",
"CM0P_SLEEP"
],
"macros_add": ["CY8C6347BZI_BLD53"],
Expand All @@ -8961,7 +8965,7 @@
"components_remove": ["QSPIF"],
"device_has_remove": ["QSPI"],
"supported_form_factors": ["ARDUINO"],
"extra_labels_add": ["PSOC6_01"],
"extra_labels_add": ["PSOC6_01", "MXCRYPTO_01"],
"macros_add": ["CYB06447BZI_D54",
"PSOC6_DYNSRM_DISABLE=1",
"CY_CFG_SYSCLK_WCO_ENABLED=1",
Expand All @@ -8978,6 +8982,7 @@
"features": ["BLE"],
"extra_labels_add": [
"PSOC6_01",
"MXCRYPTO_01",
"CM0P_SLEEP",
"WHD",
"43012",
Expand All @@ -8997,7 +9002,7 @@
"inherits": ["MCU_PSOC6_M0"],
"supported_form_factors": ["ARDUINO"],
"extra_labels_add": ["PSOC6_FUTURE", "CY8C63XX", "FUTURE_SEQUANA"],
"extra_labels_remove": ["PSOC6"],
"extra_labels_remove": ["PSOC6", "MXCRYPTO"],
"device_has_remove": ["TRNG", "CRC", "I2CSLAVE", "USBDEVICE", "QSPI", "WATCHDOG"],
"macros_add": ["CY8C6347BZI_BLD53"],
"macros_remove": ["MBEDTLS_CONFIG_HW_SUPPORT"],
Expand Down Expand Up @@ -9031,7 +9036,7 @@
"supported_form_factors": ["ARDUINO"],
"components_remove": ["QSPIF"],
"extra_labels_add": ["PSOC6_FUTURE", "CY8C63XX", "CORDIO"],
"extra_labels_remove": ["PSOC6"],
"extra_labels_remove": ["PSOC6", "MXCRYPTO"],
"device_has_remove": ["TRNG", "CRC", "I2CSLAVE", "USBDEVICE", "QSPI", "WATCHDOG"],
"macros_add": ["CY8C6347BZI_BLD53"],
"macros_remove": ["MBEDTLS_CONFIG_HW_SUPPORT"],
Expand Down