From 82520572b0aab2fdd6b881b64fd533829b2f4220 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Mon, 1 Jun 2020 13:23:50 +0200 Subject: [PATCH 1/4] Initial support for psoc6_crypto (sha256 only) --- wolfcrypt/src/port/cypress/psoc6_crypto.c | 107 ++++++++++++++++++ wolfcrypt/src/sha256.c | 13 ++- wolfcrypt/src/wc_port.c | 12 ++ wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h | 59 ++++++++++ wolfssl/wolfcrypt/sha.h | 2 + wolfssl/wolfcrypt/sha256.h | 2 + 6 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 wolfcrypt/src/port/cypress/psoc6_crypto.c create mode 100644 wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h diff --git a/wolfcrypt/src/port/cypress/psoc6_crypto.c b/wolfcrypt/src/port/cypress/psoc6_crypto.c new file mode 100644 index 000000000..d67d800ea --- /dev/null +++ b/wolfcrypt/src/port/cypress/psoc6_crypto.c @@ -0,0 +1,107 @@ +/* psoc6_crypto.c + * + * Copyright (C) 2006-2020 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include +#ifdef NO_INLINE + #include +#else + #define WOLFSSL_MISC_INCLUDED + #include +#endif + +#if defined(WOLFSSL_PSOC6_CRYPTO) + +#include +#include +#include +#include +#include + +static CRYPTO_Type *crypto_base = PSOC6_CRYPTO_BASE; + +/* Hook for device specific initialization */ +int psoc6_crypto_port_init(void) +{ + Cy_Crypto_Core_Enable(crypto_base); + return 0; +} + +#ifndef NO_SHA256 + +int wc_InitSha256(wc_Sha256* sha) +{ + cy_en_crypto_status_t res; + if (!sha) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemSet(crypto_base, sha, 0, sizeof(sha)); + res = Cy_Crypto_Core_Sha_Init(crypto_base, &sha->hash_state, CY_CRYPTO_MODE_SHA256, &sha->sha_buffers); + if (res != CY_CRYPTO_SUCCESS) + return (int)res; + return (int) Cy_Crypto_Core_Sha_Start(crypto_base, &sha->hash_state); +} + +int wc_Sha256Update(wc_Sha256* sha, const byte* in, word32 sz) +{ + if ((!sha) || (!in)) + return BAD_FUNC_ARG; + if (sz == 0) + return 0; + + return (int)Cy_Crypto_Core_Sha_Update(crypto_base, &sha->hash_state, in, sz); +} + +int wc_Sha256Final(wc_Sha256* sha, byte* hash) +{ + if ((!sha) || (!hash)) + return BAD_FUNC_ARG; + return (int)Cy_Crypto_Core_Sha_Finish(crypto_base, &sha->hash_state, hash); +} + +int wc_Sha256GetHash(wc_Sha256* sha, byte* hash) +{ + if ((!sha) || (!hash)) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemCpy(crypto_base, hash, sha->hash_state.hash, WC_SHA256_DIGEST_SIZE); + return 0; +} + +int wc_Sha256Copy(wc_Sha256* src, wc_Sha256* dst) +{ + cy_en_crypto_status_t res; + if ((!dst) || (!src)) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemCpy(crypto_base, dst, src, sizeof(wc_Sha256)); + return (int)Cy_Crypto_Core_Sha_Init(crypto_base, &dst->hash_state, CY_CRYPTO_MODE_SHA256, &dst->sha_buffers); +} + +void wc_Sha256Free(wc_Sha256* sha) +{ + if (sha) + Cy_Crypto_Core_Sha_Free(crypto_base, &sha->hash_state); +} +#endif /* NO_SHA256 */ + +#endif /* defined(WOLFSSL_PSOC6_CRYPTO) */ + diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index eb0911b01..4d0a00ce0 100644 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -119,6 +119,10 @@ /* #include included by wc_port.c */ #elif defined(WOLFSSL_CRYPTOCELL) /* wc_port.c includes wolfcrypt/src/port/arm/cryptoCellHash.c */ + +#elif defined(WOLFSSL_PSOC6_CRYPTO) + + #else #include @@ -164,7 +168,8 @@ (!defined(WOLFSSL_IMX6_CAAM) || defined(NO_IMX6_CAAM_HASH)) && \ !defined(WOLFSSL_AFALG_HASH) && !defined(WOLFSSL_DEVCRYPTO_HASH) && \ (!defined(WOLFSSL_ESP32WROOM32_CRYPT) || defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH)) && \ - (!defined(WOLFSSL_RENESAS_TSIP_CRYPT) || defined(NO_WOLFSSL_RENESAS_TSIP_HASH)) + (!defined(WOLFSSL_RENESAS_TSIP_CRYPT) || defined(NO_WOLFSSL_RENESAS_TSIP_HASH)) && \ + !defined(WOLFSSL_PSOC6_CRYPTO) static int InitSha256(wc_Sha256* sha256) { @@ -663,6 +668,10 @@ static int InitSha256(wc_Sha256* sha256) /* implemented in wolfcrypt/src/port/Renesas/renesas_tsip_sha.c */ +#elif defined(WOLFSSL_PSOC6_CRYPTO) + + /* implemented in wolfcrypt/src/port/cypress/psoc6_crypto.c */ + #else #define NEED_SOFT_SHA256 @@ -1559,6 +1568,8 @@ void wc_Sha256Free(wc_Sha256* sha256) !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) /* implemented in wolfcrypt/src/port/Renesas/renesas_tsip_sha.c */ +#elif defined(WOLFSSL_PSOC6_CRYPTO) + /* implemented in wolfcrypt/src/port/cypress/psoc6_crypto.c */ #else int wc_Sha256GetHash(wc_Sha256* sha256, byte* hash) diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index cc2572953..6295cc09b 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -46,6 +46,10 @@ #include #endif +#ifdef WOLFSSL_PSOC6_CRYPTO + #include +#endif + #if defined(WOLFSSL_ATMEL) || defined(WOLFSSL_ATECC508A) || \ defined(WOLFSSL_ATECC608A) #include @@ -201,6 +205,14 @@ int wolfCrypt_Init(void) stsafe_interface_init(); #endif + #if defined(WOLFSSL_PSOC6_CRYPTO) + ret = psoc6_crypto_port_init(); + if (ret != 0) { + WOLFSSL_MSG("PSoC6 crypto engine init failed"); + return ret; + } + #endif + #ifdef WOLFSSL_ARMASM WOLFSSL_MSG("Using ARM hardware acceleration"); #endif diff --git a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h new file mode 100644 index 000000000..2732efc9e --- /dev/null +++ b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h @@ -0,0 +1,59 @@ +/* psoc6_crypto.h + * + * Copyright (C) 2006-2020 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef _PSOC6_CRYPTO_PORT_H_ +#define _PSOC6_CRYPTO_PORT_H_ + +#include +#ifdef USE_FAST_MATH + #include +#elif defined WOLFSSL_SP_MATH + #include +#else + #include +#endif +#include "cy_crypto_core_sha.h" +#include "cy_device_headers.h" +#include "psoc6_02_config.h" +#include "cy_crypto_common.h" +#include "cy_crypto_core.h" + +#ifndef NO_SHA256 + +#include "cy_crypto_core_sha.h" +typedef struct wc_Sha256 { + cy_stc_crypto_sha_state_t hash_state; + cy_en_crypto_sha_mode_t sha_mode; + cy_stc_crypto_v2_sha256_buffers_t sha_buffers; +} wc_Sha256; + + +#endif /* !def NO_SHA256 */ + +#include +#include + +#define PSOC6_CRYPTO_BASE ((CRYPTO_Type*) CRYPTO_BASE) + +/* Crypto HW engine initialization */ +int psoc6_crypto_port_init(void); + +#endif /* _PSOC6_CRYPTO_PORT_H_ */ diff --git a/wolfssl/wolfcrypt/sha.h b/wolfssl/wolfcrypt/sha.h index 0b7f65404..960d9a03c 100644 --- a/wolfssl/wolfcrypt/sha.h +++ b/wolfssl/wolfcrypt/sha.h @@ -101,6 +101,8 @@ enum { #elif defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \ !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) #include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h" +#elif defined(WOLFSSL_PSOC6_CRYPTO) + #include "wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h" #else /* Sha digest */ diff --git a/wolfssl/wolfcrypt/sha256.h b/wolfssl/wolfcrypt/sha256.h index 798f309d1..77f5fb759 100644 --- a/wolfssl/wolfcrypt/sha256.h +++ b/wolfssl/wolfcrypt/sha256.h @@ -126,6 +126,8 @@ enum { #elif defined(WOLFSSL_RENESAS_TSIP_CRYPT) && \ !defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) #include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h" +#elif defined(WOLFSSL_PSOC6_CRYPTO) + #include "wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h" #else /* wc_Sha256 digest */ From b1947478bb75a08342d488ad38a6d41c462eded5 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Tue, 2 Jun 2020 10:57:39 +0200 Subject: [PATCH 2/4] Added support for SHA512 via psoc6 crypto --- wolfcrypt/src/port/cypress/psoc6_crypto.c | 56 +++++++++++++++++++ wolfcrypt/src/sha512.c | 2 +- wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h | 12 +++- wolfssl/wolfcrypt/sha512.h | 4 ++ 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/port/cypress/psoc6_crypto.c b/wolfcrypt/src/port/cypress/psoc6_crypto.c index d67d800ea..90f2d674a 100644 --- a/wolfcrypt/src/port/cypress/psoc6_crypto.c +++ b/wolfcrypt/src/port/cypress/psoc6_crypto.c @@ -48,8 +48,64 @@ int psoc6_crypto_port_init(void) return 0; } +#ifdef WOLFSSL_SHA512 +int wc_InitSha512(wc_Sha512* sha) +{ + cy_en_crypto_status_t res; + if (!sha) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemSet(crypto_base, sha, 0, sizeof(sha)); + res = Cy_Crypto_Core_Sha_Init(crypto_base, &sha->hash_state, CY_CRYPTO_MODE_SHA512, &sha->sha_buffers); + if (res != CY_CRYPTO_SUCCESS) + return (int)res; + return (int) Cy_Crypto_Core_Sha_Start(crypto_base, &sha->hash_state); +} + +int wc_Sha512Update(wc_Sha512* sha, const byte* in, word32 sz) +{ + if ((!sha) || (!in)) + return BAD_FUNC_ARG; + if (sz == 0) + return 0; + + return (int)Cy_Crypto_Core_Sha_Update(crypto_base, &sha->hash_state, in, sz); +} + +int wc_Sha512Final(wc_Sha512* sha, byte* hash) +{ + if ((!sha) || (!hash)) + return BAD_FUNC_ARG; + return (int)Cy_Crypto_Core_Sha_Finish(crypto_base, &sha->hash_state, hash); +} + +int wc_Sha512GetHash(wc_Sha512* sha, byte* hash) +{ + if ((!sha) || (!hash)) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemCpy(crypto_base, hash, sha->hash_state.hash, WC_SHA512_DIGEST_SIZE); + return 0; +} + +int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst) +{ + cy_en_crypto_status_t res; + if ((!dst) || (!src)) + return BAD_FUNC_ARG; + Cy_Crypto_Core_MemCpy(crypto_base, dst, src, sizeof(wc_Sha512)); + return (int)Cy_Crypto_Core_Sha_Init(crypto_base, &dst->hash_state, CY_CRYPTO_MODE_SHA512, &dst->sha_buffers); +} + +void wc_Sha512Free(wc_Sha512* sha) +{ + if (sha) + Cy_Crypto_Core_Sha_Free(crypto_base, &sha->hash_state); +} + +#endif + #ifndef NO_SHA256 + int wc_InitSha256(wc_Sha256* sha) { cy_en_crypto_status_t res; diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index 0a648bf4a..22c471884 100644 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -26,7 +26,7 @@ #include -#if (defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)) && !defined(WOLFSSL_ARMASM) +#if (defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)) && !defined(WOLFSSL_ARMASM) && !defined(WOLFSSL_PSOC6_CRYPTO) #if defined(HAVE_FIPS) && \ defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) diff --git a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h index 2732efc9e..34d8ccd06 100644 --- a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h +++ b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h @@ -36,9 +36,19 @@ #include "cy_crypto_common.h" #include "cy_crypto_core.h" +#ifdef WOLFSSL_SHA512 +typedef struct wc_Sha512 { + cy_stc_crypto_sha_state_t hash_state; + cy_en_crypto_sha_mode_t sha_mode; + cy_stc_crypto_v2_sha512_buffers_t sha_buffers; +} wc_Sha512; + +#define WC_SHA512_TYPE_DEFINED +#include +#endif + #ifndef NO_SHA256 -#include "cy_crypto_core_sha.h" typedef struct wc_Sha256 { cy_stc_crypto_sha_state_t hash_state; cy_en_crypto_sha_mode_t sha_mode; diff --git a/wolfssl/wolfcrypt/sha512.h b/wolfssl/wolfcrypt/sha512.h index 3aac94852..5aaf8e3f0 100644 --- a/wolfssl/wolfcrypt/sha512.h +++ b/wolfssl/wolfcrypt/sha512.h @@ -31,6 +31,7 @@ #if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) + #if defined(HAVE_FIPS) && \ defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) #include @@ -111,6 +112,8 @@ enum { #ifdef WOLFSSL_IMX6_CAAM #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h" +#elif defined (WOLFSSL_PSOC6_CRYPTO) + #include "wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h" #else /* wc_Sha512 digest */ struct wc_Sha512 { @@ -153,6 +156,7 @@ WOLFSSL_LOCAL void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, #ifdef WOLFSSL_SHA512 + WOLFSSL_API int wc_InitSha512(wc_Sha512*); WOLFSSL_API int wc_InitSha512_ex(wc_Sha512*, void*, int); WOLFSSL_API int wc_Sha512Update(wc_Sha512*, const byte*, word32); From 76ab8bfb6b65f0c78a8c1e0c452a1e56621b43d4 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Fri, 5 Jun 2020 11:00:28 +0200 Subject: [PATCH 3/4] Added psoc6 ECDSA verification support --- wolfcrypt/src/ecc.c | 8 ++ wolfcrypt/src/port/cypress/psoc6_crypto.c | 92 ++++++++++++++++++- wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h | 11 ++- 3 files changed, 106 insertions(+), 5 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 00d9c7423..fa3469a2a 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -141,6 +141,10 @@ ECC Curve Sizes: #include #endif +#if defined(WOLFSSL_PSOC6_CRYPTO) + #include +#endif + #ifdef WOLFSSL_SP_MATH #define GEN_MEM_ERR MP_MEM #elif defined(USE_FAST_MATH) @@ -5846,6 +5850,10 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash, { return stm32_ecc_verify_hash_ex(r, s, hash, hashlen, res, key); } +#elif defined(WOLFSSL_PSOC6_CRYPTO) +{ + return psoc6_ecc_verify_hash_ex(r, s, hash, hashlen, res, key); +} #else { int err; diff --git a/wolfcrypt/src/port/cypress/psoc6_crypto.c b/wolfcrypt/src/port/cypress/psoc6_crypto.c index 90f2d674a..b00be7714 100644 --- a/wolfcrypt/src/port/cypress/psoc6_crypto.c +++ b/wolfcrypt/src/port/cypress/psoc6_crypto.c @@ -32,6 +32,16 @@ #endif #if defined(WOLFSSL_PSOC6_CRYPTO) +#ifdef WOLFSSL_SP_MATH + struct sp_int; + #define MATH_INT_T struct sp_int +#elif defined(USE_FAST_MATH) + struct fp_int; + #define MATH_INT_T struct fp_int +#else + struct mp_int; + #define MATH_INT_T struct mp_int +#endif #include #include @@ -48,6 +58,8 @@ int psoc6_crypto_port_init(void) return 0; } +/* Sha-512 */ + #ifdef WOLFSSL_SHA512 int wc_InitSha512(wc_Sha512* sha) { @@ -103,9 +115,9 @@ void wc_Sha512Free(wc_Sha512* sha) #endif +/* Sha-256 */ + #ifndef NO_SHA256 - - int wc_InitSha256(wc_Sha256* sha) { cy_en_crypto_status_t res; @@ -159,5 +171,81 @@ void wc_Sha256Free(wc_Sha256* sha) } #endif /* NO_SHA256 */ +/* ECDSA */ +#ifdef HAVE_ECC + +#define MAX_ECC_KEYSIZE 66 /* Supports up to secp521r1 */ +static cy_en_crypto_ecc_curve_id_t psoc6_get_curve_id(int size) +{ + switch(size) { + case 24: + return CY_CRYPTO_ECC_ECP_SECP192R1; + case 28: + return CY_CRYPTO_ECC_ECP_SECP224R1; + case 32: + return CY_CRYPTO_ECC_ECP_SECP256R1; + case 48: + return CY_CRYPTO_ECC_ECP_SECP384R1; + case 66: + return CY_CRYPTO_ECC_ECP_SECP521R1; + default: + return CY_CRYPTO_ECC_ECP_NONE; + } +} + +#include +int psoc6_ecc_verify_hash_ex(MATH_INT_T *r, MATH_INT_T *s, const byte* hash, + word32 hashlen, int* verif_res, ecc_key* key) +{ + uint8_t signature_buf[MAX_ECC_KEYSIZE * 2]; + cy_stc_crypto_ecc_key ecc_key; + uint8_t stat = 0; + int res = -1; + int szModulus; + int szkbin; + uint8_t x[MAX_ECC_KEYSIZE], y[MAX_ECC_KEYSIZE]; + + if (!key || !verif_res || !r || !s || !hash) + return -BAD_FUNC_ARG; + + /* retrieve and check sizes */ + szModulus = mp_unsigned_bin_size(key->pubkey.x); + szkbin = mp_unsigned_bin_size(r); + if (szModulus > MAX_ECC_KEYSIZE) + return -BAD_FUNC_ARG; + + /* Prepare ECC key */ + ecc_key.type = PK_PUBLIC; + ecc_key.curveID = psoc6_get_curve_id(szModulus); + ecc_key.k = NULL; + ecc_key.pubkey.x = x; + ecc_key.pubkey.y = y; + + res = mp_to_unsigned_bin(key->pubkey.x, x); + if (res == MP_OKAY) + res = mp_to_unsigned_bin(key->pubkey.y, y); + Cy_Crypto_Core_InvertEndianness(x, szModulus); + Cy_Crypto_Core_InvertEndianness(y, szModulus); + + /* Prepare signature buffer */ + if (res == MP_OKAY) + res = mp_to_unsigned_bin(r, signature_buf); + if (res == MP_OKAY) + res = mp_to_unsigned_bin(s, signature_buf + szkbin); + Cy_Crypto_Core_InvertEndianness(signature_buf, szkbin); + Cy_Crypto_Core_InvertEndianness(signature_buf + szkbin, szkbin); + + /* perform HW ECDSA */ + if (res == MP_OKAY) + res = Cy_Crypto_Core_ECC_VerifyHash(crypto_base, signature_buf, hash, hashlen, &stat, &ecc_key); + if (res == 0) { + *verif_res = stat; + } + return res; +} +#endif /* HAVE_ECC */ + + + #endif /* defined(WOLFSSL_PSOC6_CRYPTO) */ diff --git a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h index 34d8ccd06..964f22162 100644 --- a/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h +++ b/wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h @@ -55,11 +55,16 @@ typedef struct wc_Sha256 { cy_stc_crypto_v2_sha256_buffers_t sha_buffers; } wc_Sha256; - -#endif /* !def NO_SHA256 */ - #include #include +#endif /* !def NO_SHA256 */ + + +#ifdef HAVE_ECC +#include +int psoc6_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash, + word32 hashlen, int* verif_res, ecc_key* key); +#endif /* HAVE_ECC */ #define PSOC6_CRYPTO_BASE ((CRYPTO_Type*) CRYPTO_BASE) From 254dd9f823247d4bffd08443289b76f1519f4b52 Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Fri, 5 Jun 2020 15:28:49 +0200 Subject: [PATCH 4/4] Added new files to include.am --- wolfcrypt/src/include.am | 3 ++- wolfssl/wolfcrypt/include.am | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/include.am b/wolfcrypt/src/include.am index bba761bc1..3c62757c7 100644 --- a/wolfcrypt/src/include.am +++ b/wolfcrypt/src/include.am @@ -85,7 +85,8 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \ wolfcrypt/src/port/Renesas/renesas_tsip_aes.c \ wolfcrypt/src/port/Renesas/renesas_tsip_sha.c \ wolfcrypt/src/port/Renesas/renesas_tsip_util.c \ - wolfcrypt/src/port/Renesas/README.md + wolfcrypt/src/port/Renesas/README.md \ + wolfcrypt/src/port/cypress/psoc6_crypto.c if BUILD_CRYPTOCB diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am index 0df704636..ecaba14f2 100644 --- a/wolfssl/wolfcrypt/include.am +++ b/wolfssl/wolfcrypt/include.am @@ -82,7 +82,8 @@ noinst_HEADERS+= \ wolfssl/wolfcrypt/port/st/stsafe.h \ wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h \ wolfssl/wolfcrypt/port/arm/cryptoCell.h \ - wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h + wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h \ + wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h if BUILD_CRYPTOAUTHLIB nobase_include_HEADERS+= wolfssl/wolfcrypt/port/atmel/atmel.h