Skip to content

Commit bf1aa5c

Browse files
authored
Merge pull request #11465 from kotkcy/pr/mxcrypto_alts
Updated mbedTLS CRYPTO target to be more flexibly configured for supported boards
2 parents 66c39e0 + 9fc299a commit bf1aa5c

File tree

19 files changed

+31
-14
lines changed

19 files changed

+31
-14
lines changed

features/mbedtls/targets/TARGET_Cypress/TARGET_PSOC6/aes_alt.c renamed to features/mbedtls/targets/TARGET_Cypress/TARGET_MXCRYPTO/aes_alt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@
4444
#include "mbedtls/platform.h"
4545
#include "mbedtls/platform_util.h"
4646

47+
#if defined(MBEDTLS_AES_ALT)
48+
4749
/* Parameter validation macros based on platform_util.h */
4850
#define AES_VALIDATE_RET( cond ) \
4951
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_AES_BAD_INPUT_DATA )
5052
#define AES_VALIDATE( cond ) \
5153
MBEDTLS_INTERNAL_VALIDATE( cond )
5254

53-
#if defined(MBEDTLS_AES_ALT)
54-
5555
#include "crypto_common.h"
5656
#include "cy_crypto_core.h"
5757

@@ -107,7 +107,9 @@ static int aes_set_keys( mbedtls_aes_context *ctx, const unsigned char *key,
107107
cy_en_crypto_aes_key_length_t key_length;
108108
cy_en_crypto_status_t status;
109109

110-
AES_VALIDATE( ctx != NULL );
110+
AES_VALIDATE_RET( ctx != NULL );
111+
AES_VALIDATE_RET( key != NULL );
112+
111113

112114
switch( keybits )
113115
{

features/mbedtls/targets/TARGET_Cypress/TARGET_PSOC6/crypto_common.c renamed to features/mbedtls/targets/TARGET_Cypress/TARGET_MXCRYPTO/crypto_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,5 @@ void cy_hw_sha_clone( void *ctxDst, const void *ctxSrc, uint32_t ctxSize,
168168
CY_CRYPTO_CHECK_PARAM( shaBuffersDst != NULL );
169169

170170
Cy_Crypto_Core_MemCpy(((cy_hw_crypto_t *)ctxSrc)->base, ctxDst, ctxSrc, (uint16_t)ctxSize);
171-
Cy_Crypto_Core_Sha_Init(((cy_hw_crypto_t *)ctxSrc)->base, hashStateDst, hashStateDst->mode, shaBuffersDst);
171+
Cy_Crypto_Core_Sha_Init(((cy_hw_crypto_t *)ctxSrc)->base, hashStateDst, (cy_en_crypto_sha_mode_t)hashStateDst->mode, shaBuffersDst);
172172
}

0 commit comments

Comments
 (0)