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)
{
#if defined(OPENSSL_ALL)
#if defined(HAVE_ECC) && defined(OPENSSL_ALL)
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)
{
#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)
RSA *rsa;
const unsigned char *derBuf = client_key_der_2048;
@ -40630,7 +40630,7 @@ static void test_wolfSSL_RSA_sign_sha3(void)
printf(resultFmt, passed);
#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)
@ -44254,7 +44254,7 @@ static void test_wolfSSL_RSA_print(void)
AssertIntEQ(RSA_print(bio, rsa, 0), SSL_SUCCESS);
BIO_free(bio);
wolfSSL_RSA_free(rsa);
RSA_free(rsa);
printf(resultFmt, passed);
#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];
#endif
#if (defined(WOLFSSL_CRYPTOCELL) && !defined(WOLFSSL_ATECC508A) && \
!defined(WOLFSSL_ATECC608A)) || \
defined(WOLFSSL_SILABS_SE_ACCEL)
#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \
defined(WOLFSSL_SILABS_SE_ACCEL) || defined(WOLFSSL_CRYPTOCELL)
word32 keySz = 0;
#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.devtype = cfg->devtype;
#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
cfg_ateccx08a_i2c_pi.atcai2c.address = cfg->atcai2c.address;
#endif
@ -525,11 +525,11 @@ int atmel_init(void)
XMEMSET(&cfg_ateccx08a_i2c_pi, 0, sizeof(cfg_ateccx08a_i2c_pi));
cfg_ateccx08a_i2c_pi.iface_type = ATCA_I2C_IFACE;
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;
#else
#else
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.baud = 400000;
cfg_ateccx08a_i2c_pi.wake_delay = 1500;

View File

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

View File

@ -289,22 +289,24 @@ decouple library dependencies with standard string, memory and so on.
#define THREAD_LS_T
#endif
/* GCC 7 has new switch() fall-through detection */
/* default to FALL_THROUGH stub */
#ifndef FALL_THROUGH
#define FALL_THROUGH
#if defined(__GNUC__)
#if ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1)))
#undef FALL_THROUGH
#if defined(WOLFSSL_LINUXKM) && defined(fallthrough)
#define FALL_THROUGH fallthrough
#else
#define FALL_THROUGH ; __attribute__ ((fallthrough))
/* GCC 7 has new switch() fall-through detection */
#if defined(__GNUC__)
#if ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1)))
#undef FALL_THROUGH
#if defined(WOLFSSL_LINUXKM) && defined(fallthrough)
#define FALL_THROUGH fallthrough
#else
#define FALL_THROUGH ; __attribute__ ((fallthrough))
#endif
#endif
#endif
#endif
#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 */
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \