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>
#if (WOLFSSL_CAAM) && !defined(NO_AES)
#if defined(WOLFSSL_CAAM) && !defined(NO_AES)
#include <wolfssl/wolfcrypt/logging.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);
break;
#ifdef WOLFSSL_SHA384
case WC_HASH_TYPE_SHA384:
ret = wc_CAAM_Sha384Hash(info->hash.sha384,
info->hash.in,
info->hash.inSz,
info->hash.digest);
break;
#endif
#ifdef WOLFSSL_SHA512
case WC_HASH_TYPE_SHA512:
ret = wc_CAAM_Sha512Hash(info->hash.sha512,
info->hash.in,
info->hash.inSz,
info->hash.digest);
break;
#endif
default:
WOLFSSL_MSG("Unknown or unsupported hash type");
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:
ctx->sess.cipher = 0;
ctx->sess.mac = type;
ctx->sess.mackey = (uint8_t*)key;
ctx->sess.mackey = (u_int8_t*)key;
ctx->sess.mackeylen = keySz;
break;

View File

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

View File

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