more macro guards with CAAM builds

pull/5392/head
JacobBarthelmeh 2022-07-22 16:19:55 -07:00
parent dc8b796d1d
commit 35d40f263e
5 changed files with 15 additions and 9 deletions

View File

@ -25,7 +25,7 @@
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#if (WOLFSSL_CAAM) && !defined(NO_AES) #if defined(WOLFSSL_CAAM) && !defined(NO_AES)
#include <wolfssl/wolfcrypt/logging.h> #include <wolfssl/wolfcrypt/logging.h>
#include <wolfssl/wolfcrypt/error-crypt.h> #include <wolfssl/wolfcrypt/error-crypt.h>

View File

@ -193,20 +193,22 @@ static int wc_CAAM_router(int devId, wc_CryptoInfo* info, void* ctx)
info->hash.digest); info->hash.digest);
break; break;
#ifdef WOLFSSL_SHA384
case WC_HASH_TYPE_SHA384: case WC_HASH_TYPE_SHA384:
ret = wc_CAAM_Sha384Hash(info->hash.sha384, ret = wc_CAAM_Sha384Hash(info->hash.sha384,
info->hash.in, info->hash.in,
info->hash.inSz, info->hash.inSz,
info->hash.digest); info->hash.digest);
break; break;
#endif
#ifdef WOLFSSL_SHA512
case WC_HASH_TYPE_SHA512: case WC_HASH_TYPE_SHA512:
ret = wc_CAAM_Sha512Hash(info->hash.sha512, ret = wc_CAAM_Sha512Hash(info->hash.sha512,
info->hash.in, info->hash.in,
info->hash.inSz, info->hash.inSz,
info->hash.digest); info->hash.digest);
break; break;
#endif
default: default:
WOLFSSL_MSG("Unknown or unsupported hash type"); WOLFSSL_MSG("Unknown or unsupported hash type");
ret = CRYPTOCB_UNAVAILABLE; ret = CRYPTOCB_UNAVAILABLE;

View File

@ -122,7 +122,7 @@ int wc_DevCryptoCreate(WC_CRYPTODEV* ctx, int type, byte* key, word32 keySz)
case CRYPTO_SHA2_512_HMAC: case CRYPTO_SHA2_512_HMAC:
ctx->sess.cipher = 0; ctx->sess.cipher = 0;
ctx->sess.mac = type; ctx->sess.mac = type;
ctx->sess.mackey = (uint8_t*)key; ctx->sess.mackey = (u_int8_t*)key;
ctx->sess.mackeylen = keySz; ctx->sess.mackeylen = keySz;
break; break;

View File

@ -191,10 +191,6 @@ struct Aes {
int ctxInitDone; int ctxInitDone;
int keyId; int keyId;
#endif #endif
#ifdef WOLFSSL_CAAM
int blackKey; /* black key / hsm key id */
#endif
#ifdef GCM_TABLE #ifdef GCM_TABLE
/* key-based fast multiplication table. */ /* key-based fast multiplication table. */
ALIGN16 byte M0[256][AES_BLOCK_SIZE]; ALIGN16 byte M0[256][AES_BLOCK_SIZE];
@ -209,6 +205,9 @@ struct Aes {
word32 y0; word32 y0;
#endif #endif
#endif /* HAVE_AESGCM */ #endif /* HAVE_AESGCM */
#ifdef WOLFSSL_CAAM
int blackKey; /* black key / hsm key id */
#endif
#ifdef WOLFSSL_AESNI #ifdef WOLFSSL_AESNI
byte use_aesni; byte use_aesni;
#endif /* WOLFSSL_AESNI */ #endif /* WOLFSSL_AESNI */

View File

@ -26,19 +26,24 @@
#include <wolfssl/wolfcrypt/sha256.h> #include <wolfssl/wolfcrypt/sha256.h>
#ifndef NO_SHA
WOLFSSL_LOCAL int wc_CAAM_ShaHash(wc_Sha* sha, const byte* in, word32 inSz, WOLFSSL_LOCAL int wc_CAAM_ShaHash(wc_Sha* sha, const byte* in, word32 inSz,
byte* digest); byte* digest);
#endif
#ifdef WOLFSSL_SHA224 #ifdef WOLFSSL_SHA224
WOLFSSL_LOCAL int wc_CAAM_Sha224Hash(wc_Sha224* sha224, const byte* in, WOLFSSL_LOCAL int wc_CAAM_Sha224Hash(wc_Sha224* sha224, const byte* in,
word32 inSz, byte* digest); word32 inSz, byte* digest);
#endif #endif
WOLFSSL_LOCAL int wc_CAAM_Sha256Hash(wc_Sha256* sha256, const byte* in, WOLFSSL_LOCAL int wc_CAAM_Sha256Hash(wc_Sha256* sha256, const byte* in,
word32 inSz, byte* digest); word32 inSz, byte* digest);
#if defined(WOLFSSL_SHA384)
WOLFSSL_LOCAL int wc_CAAM_Sha384Hash(wc_Sha384* sha384, const byte* in, WOLFSSL_LOCAL int wc_CAAM_Sha384Hash(wc_Sha384* sha384, const byte* in,
word32 inSz, byte* digest); word32 inSz, byte* digest);
#endif
#if defined(WOLFSSL_SHA512)
WOLFSSL_LOCAL int wc_CAAM_Sha512Hash(wc_Sha512* sha512, const byte* in, WOLFSSL_LOCAL int wc_CAAM_Sha512Hash(wc_Sha512* sha512, const byte* in,
word32 inSz, byte* digest); word32 inSz, byte* digest);
#endif
#if !defined(NO_HMAC) #if !defined(NO_HMAC)
#ifndef WC_HMAC_TYPE_DEFINED #ifndef WC_HMAC_TYPE_DEFINED