formating / add c files to distro / remove unneeded macros

This commit is contained in:
Jacob Barthelmeh
2017-12-14 12:08:28 -07:00
parent 5fa9455bf9
commit 3a6d5b8f90
3 changed files with 49 additions and 53 deletions

View File

@ -55,7 +55,11 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \
wolfcrypt/src/port/atmel/atmel.c \
wolfcrypt/src/port/atmel/README.md \
wolfcrypt/src/port/xilinx/xil-sha3.c \
wolfcrypt/src/port/xilinx/xil-aesgcm.c
wolfcrypt/src/port/xilinx/xil-aesgcm.c \
wolfcrypt/src/port/caam/caam_aes.c \
wolfcrypt/src/port/caam/caam_driver.c \
wolfcrypt/src/port/caam/caam_init.c \
wolfcrypt/src/port/caam/caam_sha.c
if BUILD_CAVIUM
src_libwolfssl_la_SOURCES += wolfcrypt/src/port/cavium/cavium_nitrox.c

View File

@ -48,17 +48,17 @@
static void wc_caamBanner(void)
{
printf("********* wolfSSL Version %s : Printing Out CAAM Information ********\n",
LIBWOLFSSL_VERSION_STRING);
LIBWOLFSSL_VERSION_STRING);
printf("CAAM Status [0x%8.8x] = 0x%8.8x\n",
CAAM_STATUS, WC_CAAM_READ(CAAM_STATUS));
CAAM_STATUS, WC_CAAM_READ(CAAM_STATUS));
printf("CAAM Version MS Register [0x%8.8x] = 0x%8.8x\n",
CAAM_VERSION_MS, WC_CAAM_READ(CAAM_VERSION_MS));
CAAM_VERSION_MS, WC_CAAM_READ(CAAM_VERSION_MS));
printf("CAAM Version LS Register [0x%8.8x] = 0x%8.8x\n",
CAAM_VERSION_LS, WC_CAAM_READ(CAAM_VERSION_LS));
CAAM_VERSION_LS, WC_CAAM_READ(CAAM_VERSION_LS));
printf("CAAM Support MS Register [0x%8.8x] = 0x%8.8x\n",
CAMM_SUPPORT_MS, WC_CAAM_READ(CAMM_SUPPORT_MS));
CAMM_SUPPORT_MS, WC_CAAM_READ(CAMM_SUPPORT_MS));
printf("CAAM Support LS [0x%8.8x] = 0x%8.8x\n",
CAMM_SUPPORT_LS, WC_CAAM_READ(CAMM_SUPPORT_LS));
CAMM_SUPPORT_LS, WC_CAAM_READ(CAMM_SUPPORT_LS));
printf("********************************************************************\n\n");
}
#endif
@ -70,7 +70,7 @@ static void wc_caamBanner(void)
* returns 0 on success
*
* NOTE this is how IODevice is defined in INTEGRITY "typedef struct
* IODeviceStruct *IODevice;"
* IODeviceStruct *IODevice;"
*/
int wc_caamSetResource(IODevice ioDev)
{
@ -90,9 +90,9 @@ int wc_caamInit()
/* get the driver up */
if (caam == NULLIODevice) {
WOLFSSL_MSG("Starting CAAM driver");
WOLFSSL_MSG("Starting CAAM driver");
if (RequestResource((Object *)&caam, "wolfSSL_CAAM_Driver",
WC_CAAM_PASSWORD) != Success) {
WC_CAAM_PASSWORD) != Success) {
WOLFSSL_MSG("Unable to get the CAAM IODevice, check password?");
}
}
@ -109,9 +109,9 @@ int wc_caamInit()
#ifndef WC_NO_RNG
if (((reg & 0x000F0000) >> 16) > 0) {
WOLFSSL_MSG("Found CAAM RNG hardware module");
if ((WC_CAAM_READ(CAAM_RTMCTL) & 0x40000001) != 0x40000001) {
if ((WC_CAAM_READ(CAAM_RTMCTL) & 0x40000001) != 0x40000001) {
WOLFSSL_MSG("Error CAAM RNG has not been set up");
}
}
}
#endif
@ -121,18 +121,17 @@ int wc_caamInit()
}
else {
WOLFSSL_MSG("Hashing not supported by CAAM");
return WC_CAAM_E;
return WC_CAAM_E;
}
#endif
#ifndef NO_AES
if ((reg & 0x0000000F) > 0) {
WOLFSSL_MSG("Found CAAM AES module");
}
else {
WOLFSSL_MSG("AES not supported by CAAM");
return WC_CAAM_E;
return WC_CAAM_E;
}
#endif
@ -178,21 +177,21 @@ void wc_caamWriteRegister(word32 reg, word32 value)
int wc_caamAddAndWait(Buffer* buf, word32 arg[4], word32 type)
{
int ret;
if (caam == NULLIODevice) {
WOLFSSL_MSG("Error CAAM IODevice not found! Bad password?");
return WC_CAAM_E;
}
if (caam == NULLIODevice) {
WOLFSSL_MSG("Error CAAM IODevice not found! Bad password?");
return WC_CAAM_E;
}
if ((ret = SynchronousSendIORequest(caam, type, (const Value*)arg, buf))
!= Success) {
#if defined(WOLFSSL_CAAM_PRINT) || defined(WOLFSSL_CAAM_DEBUG)
printf("ret of SynchronousSendIORequest = %d type = %d\n", ret, type);
#endif
return WC_CAAM_E;
}
if ((ret = SynchronousSendIORequest(caam, type, (const Value*)arg, buf))
!= Success) {
#if defined(WOLFSSL_CAAM_PRINT) || defined(WOLFSSL_CAAM_DEBUG)
printf("ret of SynchronousSendIORequest = %d type = %d\n", ret, type);
#endif
return WC_CAAM_E;
}
(void)ret;
return 0;
(void)ret;
return 0;
}
@ -223,7 +222,7 @@ int wc_caamCreateBlob(byte* data, word32 dataSz, byte* out, word32* outSz)
if ((ret = wc_caamAddAndWait(in, arg, CAAM_BLOB_ENCAP)) != 0) {
WOLFSSL_MSG("Error with CAAM blob create");
return ret;
return ret;
}
*outSz = dataSz + WC_CAAM_BLOB_SZ;
@ -258,7 +257,7 @@ int wc_caamOpenBlob(byte* data, word32 dataSz, byte* out, word32* outSz)
if ((ret = wc_caamAddAndWait(in, arg, CAAM_BLOB_DECAP)) != 0) {
WOLFSSL_MSG("Error with CAAM blob create");
return ret;
return ret;
}
*outSz = dataSz - WC_CAAM_BLOB_SZ;

View File

@ -48,13 +48,6 @@ WOLFSSL_API int wc_caamOpenBlob(byte* data, word32 dataSz, byte* out,
WOLFSSL_API int wc_caamCreateBlob(byte* data, word32 dataSz, byte* out,
word32* outSz);
/* Status Registers */
#define WC_CAAM_STATUS WC_CAAM_BASE + 0x0FD4
#define WC_CAAM_VERSION_MS WC_CAAM_BASE + 0x0FE8
#define WC_CAAM_VERSION_LS WC_CAAM_BASE + 0x0FEC
#define WC_CAMM_SUPPORT_MS WC_CAAM_BASE + 0x0FF0
#define WC_CAMM_SUPPORT_LS WC_CAAM_BASE + 0x0FF4
/* additional size that is added by CAAM when creating a blob */
#define WC_CAAM_BLOB_SZ 48