diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 5c3f3e410..c5be45d08 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -8789,7 +8789,7 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz, } #elif defined(WOLFSSL_QNX_CAAM) if ((wc_ecc_size(key) + WC_CAAM_MAC_SZ) == (int)privSz) { - int part = caamFindUnusuedPartition(); + int part = caamFindUnusedPartition(); if (part >= 0) { CAAM_ADDRESS vaddr = caamGetPartition(part, privSz*3); if (vaddr == 0) { diff --git a/wolfcrypt/src/port/caam/caam_aes.c b/wolfcrypt/src/port/caam/caam_aes.c index e90982641..95fad0b8e 100644 --- a/wolfcrypt/src/port/caam/caam_aes.c +++ b/wolfcrypt/src/port/caam/caam_aes.c @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif #include diff --git a/wolfcrypt/src/port/caam/caam_driver.c b/wolfcrypt/src/port/caam/caam_driver.c index 135958536..7ccd31880 100644 --- a/wolfcrypt/src/port/caam/caam_driver.c +++ b/wolfcrypt/src/port/caam/caam_driver.c @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ - #if (defined(__INTEGRITY) || defined(INTEGRITY)) || \ (defined(__QNX__) || defined(__QNXNTO__)) @@ -29,11 +28,11 @@ #include #include - #include "caam_qnx.h" + #include #endif -#include "caam_driver.h" -#include "caam_error.h" +#include +#include #include /* for memcpy / memset */ @@ -265,7 +264,7 @@ static Error caamFreeAllPart() /* search through the partitions to find an unused one * returns negative value on failure, on success returns 0 or greater */ -int caamFindUnusuedPartition() +int caamFindUnusedPartition() { unsigned int SMPO; unsigned int i; @@ -870,7 +869,7 @@ int caamECDSAMake(DESCSTRUCT* desc, CAAM_BUFFER* buf, unsigned int args[4]) desc->desc[desc->idx++] = pdECDSEL; if (isBlackKey == 1) { /* create secure partition for private key out */ - part = caamFindUnusuedPartition(); + part = caamFindUnusedPartition(); if (part < 0) { WOLFSSL_MSG("error finding an unused partition for new key"); return -1; @@ -1527,4 +1526,5 @@ int CleanupCAAM() caamFreeAllPart(); return 0; } -#endif + +#endif /* __INTEGRITY || INTEGRITY || __QNX__ || __QNXNTO__ */ diff --git a/wolfcrypt/src/port/caam/caam_error.c b/wolfcrypt/src/port/caam/caam_error.c index 0a21ae291..8219d1990 100644 --- a/wolfcrypt/src/port/caam/caam_error.c +++ b/wolfcrypt/src/port/caam/caam_error.c @@ -19,8 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ -#include "caam_driver.h" -#include "caam_error.h" +#if (defined(__INTEGRITY) || defined(INTEGRITY)) || \ + (defined(__QNX__) || defined(__QNXNTO__)) + +#include +#include /* return a negative value if CAAM reset needed */ int caamParseCCBError(unsigned int error) @@ -205,3 +208,4 @@ unsigned int caamParseJRError(unsigned int error) return err; } +#endif diff --git a/wolfcrypt/src/port/caam/caam_integrity.c b/wolfcrypt/src/port/caam/caam_integrity.c index 1cf93d5cd..0e80da7b7 100644 --- a/wolfcrypt/src/port/caam/caam_integrity.c +++ b/wolfcrypt/src/port/caam/caam_integrity.c @@ -19,11 +19,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + #if defined(__INTEGRITY) || defined(INTEGRITY) /* build into Integrity kernel */ #include -#include "wolfssl/wolfcrypt/port/caam/caam_driver.h" +#include #define CAAM_READ(reg) *(volatile unsigned int*)(reg) #define CAAM_WRITE(reg, in) *(volatile unsigned int*)(reg) = (in); diff --git a/wolfcrypt/src/port/caam/caam_qnx.c b/wolfcrypt/src/port/caam/caam_qnx.c index 8b436040c..bc00f763a 100644 --- a/wolfcrypt/src/port/caam/caam_qnx.c +++ b/wolfcrypt/src/port/caam/caam_qnx.c @@ -19,8 +19,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ -#include "caam_driver.h" -#include "wolfssl/version.h" +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#if defined(__QNX__) || defined(__QNXNTO__) + +#include +#include #include #include @@ -193,7 +201,7 @@ void CAAM_ADR_UNMAP(void* vaddr, unsigned int out, int outSz, } -/* syncoronize virtual buffer with physical +/* synchronize virtual buffer with physical * return 0 on success */ int CAAM_ADR_SYNC(void* vaddr, int sz) { @@ -1115,7 +1123,7 @@ int io_devctl (resmgr_context_t *ctp, io_devctl_t *msg, iofunc_ocb_t *ocb) break; case WC_CAAM_FIND_PART: - ret = caamFindUnusuedPartition(); + ret = caamFindUnusedPartition(); if (ret < 0) { /* none found, try again later */ return EAGAIN; @@ -1289,3 +1297,4 @@ int main(int argc, char *argv[]) return 0; } +#endif /* __QNX__ || __QNXNTO__ */ diff --git a/wolfcrypt/src/port/caam/caam_sha.c b/wolfcrypt/src/port/caam/caam_sha.c index b681617ef..f7e1ceb2a 100644 --- a/wolfcrypt/src/port/caam/caam_sha.c +++ b/wolfcrypt/src/port/caam/caam_sha.c @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +#ifdef HAVE_CONFIG_H + #include +#endif #include @@ -35,7 +38,9 @@ #endif +#if defined(__INTEGRITY) || defined(INTEGRITY) #include +#endif #include #include @@ -393,5 +398,4 @@ int wc_Sha512Final(wc_Sha512* sha, byte* out) } #endif /* WOLFSSL_SHA512 */ -#endif /* WOLFSSL_IMX6_CAAM */ - +#endif /* WOLFSSL_IMX6_CAAM && !NO_IMX6_CAAM_HASH */ diff --git a/wolfcrypt/src/port/caam/wolfcaam_cmac.c b/wolfcrypt/src/port/caam/wolfcaam_cmac.c index c59bfca13..3d44c8a35 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_cmac.c +++ b/wolfcrypt/src/port/caam/wolfcaam_cmac.c @@ -25,7 +25,7 @@ #include -#if defined(WOLFSSL_CMAC) && defined(WOLFSSL_QNX_CAAM) +#if defined(WOLFSSL_QNX_CAAM) && defined(WOLFSSL_CMAC) #include #include @@ -169,4 +169,4 @@ int wc_CAAM_Cmac(Cmac* cmac, const byte* key, word32 keySz, const byte* in, return 0; } -#endif +#endif /* WOLFSSL_QNX_CAAM && WOLFSSL_CMAC */ diff --git a/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c b/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c index d41df3527..fbc677baa 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c +++ b/wolfcrypt/src/port/caam/wolfcaam_ecdsa.c @@ -25,7 +25,7 @@ #include -#if defined(HAVE_ECC) && defined(WOLFSSL_QNX_CAAM) +#if defined(WOLFSSL_QNX_CAAM) && defined(HAVE_ECC) #include #include @@ -466,4 +466,4 @@ int wc_CAAM_EccCheckPrivKey(ecc_key* key, const byte* pubKey, word32 pubKeySz) { return CRYPTOCB_UNAVAILABLE; } -#endif /* HAVE_ECC && WOLFSSL_QNX_CAAM */ +#endif /* WOLFSSL_QNX_CAAM && HAVE_ECC */ diff --git a/wolfcrypt/src/port/caam/wolfcaam_init.c b/wolfcrypt/src/port/caam/wolfcaam_init.c index aa1d44e73..fe120762c 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_init.c +++ b/wolfcrypt/src/port/caam/wolfcaam_init.c @@ -500,7 +500,7 @@ int wc_caamCoverKey(byte* in, word32 inSz, byte* out, word32* outSz, int flag) /* return 0 or greater on success for the partition number available * returns a negative value on failure */ -int caamFindUnusuedPartition() +int caamFindUnusedPartition() { CAAM_BUFFER buf[1]; word32 arg[4]; @@ -604,5 +604,5 @@ int caamReadPartition(CAAM_ADDRESS addr, unsigned char* out, int outSz) return 0; } -#endif /* WOLFSSL_IMX6_CAAM */ - +#endif /* WOLFSSL_IMX6_CAAM || WOLFSSL_IMX6_CAAM_RNG || + WOLFSSL_IMX6UL_CAAM || WOLFSSL_IMX6_CAAM_BLOB */ diff --git a/wolfcrypt/src/port/caam/wolfcaam_qnx.c b/wolfcrypt/src/port/caam/wolfcaam_qnx.c index 1e9c50ef3..0e6466ecc 100644 --- a/wolfcrypt/src/port/caam/wolfcaam_qnx.c +++ b/wolfcrypt/src/port/caam/wolfcaam_qnx.c @@ -25,7 +25,7 @@ #include -#if defined(WOLFSSL_QNX_CAAM) +#if defined(WOLFSSL_QNX_CAAM) && (defined(__QNX__) || defined(__QNXNTO__)) #include #include @@ -349,4 +349,4 @@ int SynchronousSendRequest(int type, unsigned int args[4], CAAM_BUFFER *buf, return Success; } -#endif +#endif /* WOLFSSL_QNX_CAAM && (__QNX__ || __QNXNTO__) */ diff --git a/wolfssl/wolfcrypt/port/caam/caam_driver.h b/wolfssl/wolfcrypt/port/caam/caam_driver.h index 8ab6cc342..878cd0722 100644 --- a/wolfssl/wolfcrypt/port/caam/caam_driver.h +++ b/wolfssl/wolfcrypt/port/caam/caam_driver.h @@ -332,7 +332,7 @@ int caamBlob(DESCSTRUCT *desc); CAAM_ADDRESS caamGetPartition(unsigned int part, int partSz, unsigned int flag); int caamFreePart(unsigned int part); -int caamFindUnusuedPartition(void); +int caamFindUnusedPartition(void); diff --git a/wolfssl/wolfcrypt/port/caam/caam_error.h b/wolfssl/wolfcrypt/port/caam/caam_error.h index 28cd325ac..35a9b25b6 100644 --- a/wolfssl/wolfcrypt/port/caam/caam_error.h +++ b/wolfssl/wolfcrypt/port/caam/caam_error.h @@ -26,4 +26,5 @@ int caamParseError(unsigned int error); int caamParseDECOError(unsigned int error); int caamParseCCBError(unsigned int error); unsigned int caamParseJRError(unsigned int error); + #endif /* CAAM_ERROR_H */ diff --git a/wolfssl/wolfcrypt/port/caam/wolfcaam.h b/wolfssl/wolfcrypt/port/caam/wolfcaam.h index a2f40929b..9f15df20f 100644 --- a/wolfssl/wolfcrypt/port/caam/wolfcaam.h +++ b/wolfssl/wolfcrypt/port/caam/wolfcaam.h @@ -49,7 +49,7 @@ WOLFSSL_LOCAL void wc_caamWriteRegister(word32 reg, word32 value); WOLFSSL_LOCAL int wc_caamAddAndWait(CAAM_BUFFER* buf, int sz, word32 arg[4], word32 type); -WOLFSSL_LOCAL int caamFindUnusuedPartition(void); +WOLFSSL_LOCAL int caamFindUnusedPartition(void); WOLFSSL_LOCAL CAAM_ADDRESS caamGetPartition(int part, int sz); WOLFSSL_LOCAL int caamFreePart(int partNum); WOLFSSL_LOCAL int caamWriteToPartition(CAAM_ADDRESS addr, const unsigned char* in, int inSz);