Fixes for building with Microchip XC32 and ATECC.

This commit is contained in:
David Garske
2021-07-23 12:47:48 -07:00
parent f3cb8e4ada
commit a92f03a11e
5 changed files with 24 additions and 27 deletions

View File

@ -39023,7 +39023,7 @@ static void test_wolfSSL_EVP_get_digestbynid(void)
} }
static void test_wolfSSL_EVP_PKEY_get0_EC_KEY(void) static void test_wolfSSL_EVP_PKEY_get0_EC_KEY(void)
{ {
#if defined(OPENSSL_ALL) #if defined(HAVE_ECC) && defined(OPENSSL_ALL)
WOLFSSL_EVP_PKEY* pkey; WOLFSSL_EVP_PKEY* pkey;
@ -40607,7 +40607,7 @@ static void test_wolfSSL_RSA_padding_add_PKCS1_PSS(void)
static void test_wolfSSL_RSA_sign_sha3(void) static void test_wolfSSL_RSA_sign_sha3(void)
{ {
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_256) #if !defined(NO_RSA) && defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_256)
#if defined(OPENSSL_ALL) && defined(WC_RSA_PSS) && !defined(WC_NO_RNG) #if defined(OPENSSL_ALL) && defined(WC_RSA_PSS) && !defined(WC_NO_RNG)
RSA *rsa; RSA *rsa;
const unsigned char *derBuf = client_key_der_2048; const unsigned char *derBuf = client_key_der_2048;
@ -40630,7 +40630,7 @@ static void test_wolfSSL_RSA_sign_sha3(void)
printf(resultFmt, passed); printf(resultFmt, passed);
#endif /* OPENSSL_ALL && WC_RSA_PSS && !WC_NO_RNG*/ #endif /* OPENSSL_ALL && WC_RSA_PSS && !WC_NO_RNG*/
#endif /* WOLFSSL_NOSHA3_256*/ #endif /* !NO_RSA && WOLFSSL_SHA3 && !WOLFSSL_NOSHA3_256*/
} }
static void test_wolfSSL_EC_get_builtin_curves(void) static void test_wolfSSL_EC_get_builtin_curves(void)
@ -44254,7 +44254,7 @@ static void test_wolfSSL_RSA_print(void)
AssertIntEQ(RSA_print(bio, rsa, 0), SSL_SUCCESS); AssertIntEQ(RSA_print(bio, rsa, 0), SSL_SUCCESS);
BIO_free(bio); BIO_free(bio);
wolfSSL_RSA_free(rsa); RSA_free(rsa);
printf(resultFmt, passed); printf(resultFmt, passed);
#endif #endif
} }

View File

@ -8959,9 +8959,8 @@ static int wc_ecc_import_raw_private(ecc_key* key, const char* qx,
byte key_raw[ECC_MAX_CRYPTO_HW_SIZE*2 + 1]; byte key_raw[ECC_MAX_CRYPTO_HW_SIZE*2 + 1];
#endif #endif
#if (defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_ATECC508A) && \ #if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \
!defined(WOLFSSL_ATECC608A)) || \ defined(WOLFSSL_SILABS_SE_ACCEL) || defined(WOLFSSL_CRYPTOCELL)
defined(WOLFSSL_SILABS_SE_ACCEL)
word32 keySz = 0; word32 keySz = 0;
#endif #endif

View File

@ -191,7 +191,7 @@ int wolfCrypt_ATECC_SetConfig(ATCAIfaceCfg* cfg)
cfg_ateccx08a_i2c_pi.iface_type = cfg->iface_type; cfg_ateccx08a_i2c_pi.iface_type = cfg->iface_type;
cfg_ateccx08a_i2c_pi.devtype = cfg->devtype; cfg_ateccx08a_i2c_pi.devtype = cfg->devtype;
#ifdef ATCA_ENABLE_DEPRECATED #ifdef ATCA_ENABLE_DEPRECATED
cfg_ateccx08a_i2c_pi.atcai2c.slave_address = cfg->atcai2c.slave_address; cfg_ateccx08a_i2c_pi.atcai2c.slave_address = cfg->atcai2c.slave_address;
#else #else
cfg_ateccx08a_i2c_pi.atcai2c.address = cfg->atcai2c.address; cfg_ateccx08a_i2c_pi.atcai2c.address = cfg->atcai2c.address;
#endif #endif
@ -525,11 +525,11 @@ int atmel_init(void)
XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi)); XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi));
cfg_ateccx08a_i2c_pi.iface_type = ATCA_I2C_IFACE; cfg_ateccx08a_i2c_pi.iface_type = ATCA_I2C_IFACE;
cfg_ateccx08a_i2c_pi.devtype = ATECC_DEV_TYPE; cfg_ateccx08a_i2c_pi.devtype = ATECC_DEV_TYPE;
#ifdef ATCA_ENABLE_DEPRECATED #ifdef ATCA_ENABLE_DEPRECATED
cfg_ateccx08a_i2c_pi.atcai2c.slave_address = ATECC_I2C_ADDR; cfg_ateccx08a_i2c_pi.atcai2c.slave_address = ATECC_I2C_ADDR;
#else #else
cfg_ateccx08a_i2c_pi.atcai2c.address = ATECC_I2C_ADDR; cfg_ateccx08a_i2c_pi.atcai2c.address = ATECC_I2C_ADDR;
#endif #endif
cfg_ateccx08a_i2c_pi.atcai2c.bus = ATECC_I2C_BUS; cfg_ateccx08a_i2c_pi.atcai2c.bus = ATECC_I2C_BUS;
cfg_ateccx08a_i2c_pi.atcai2c.baud = 400000; cfg_ateccx08a_i2c_pi.atcai2c.baud = 400000;
cfg_ateccx08a_i2c_pi.wake_delay = 1500; cfg_ateccx08a_i2c_pi.wake_delay = 1500;

View File

@ -506,8 +506,6 @@ extern const size_t ecc_sets_count;
WOLFSSL_API WOLFSSL_API
const char* wc_ecc_get_name(int curve_id); const char* wc_ecc_get_name(int curve_id);
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A)
#ifdef WOLFSSL_PUBLIC_ECC_ADD_DBL #ifdef WOLFSSL_PUBLIC_ECC_ADD_DBL
#define ECC_API WOLFSSL_API #define ECC_API WOLFSSL_API
#else #else
@ -532,8 +530,6 @@ WOLFSSL_LOCAL
int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a, int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a,
mp_int* modulus, mp_digit mp); mp_int* modulus, mp_digit mp);
#endif
WOLFSSL_API WOLFSSL_API
int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key); int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
WOLFSSL_ABI WOLFSSL_API WOLFSSL_ABI WOLFSSL_API

View File

@ -289,22 +289,24 @@ decouple library dependencies with standard string, memory and so on.
#define THREAD_LS_T #define THREAD_LS_T
#endif #endif
/* GCC 7 has new switch() fall-through detection */
/* default to FALL_THROUGH stub */
#ifndef FALL_THROUGH #ifndef FALL_THROUGH
#define FALL_THROUGH /* GCC 7 has new switch() fall-through detection */
#if defined(__GNUC__)
#if defined(__GNUC__) #if ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1)))
#if ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1))) #undef FALL_THROUGH
#undef FALL_THROUGH #if defined(WOLFSSL_LINUXKM) && defined(fallthrough)
#if defined(WOLFSSL_LINUXKM) && defined(fallthrough) #define FALL_THROUGH fallthrough
#define FALL_THROUGH fallthrough #else
#else #define FALL_THROUGH ; __attribute__ ((fallthrough))
#define FALL_THROUGH ; __attribute__ ((fallthrough)) #endif
#endif #endif
#endif #endif
#endif
#endif /* FALL_THROUGH */ #endif /* FALL_THROUGH */
#if !defined(FALL_THROUGH) || defined(__XC32)
/* use stub for fall through by default or for Microchip compiler */
#undef FALL_THROUGH
#define FALL_THROUGH
#endif
/* Micrium will use Visual Studio for compilation but not the Win32 API */ /* Micrium will use Visual Studio for compilation but not the Win32 API */
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \ #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \