mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Rework of DCP after reviewer's comments.
- using wolfSSL_CryptHwMutexLock/UnLock as DCP mutex. - fixed AES Free - using separate per-channel key store
This commit is contained in:
committed by
David Garske
parent
ce62f46442
commit
cec3d542d1
@@ -4195,15 +4195,6 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
|
|||||||
#ifdef WOLFSSL_IMX6_CAAM_BLOB
|
#ifdef WOLFSSL_IMX6_CAAM_BLOB
|
||||||
ForceZero(local, sizeof(local));
|
ForceZero(local, sizeof(local));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_IMXRT_DCP
|
|
||||||
ret = 0;
|
|
||||||
if (len == 16)
|
|
||||||
ret = DCPAesSetKey(aes, key, len, iv, AES_ENCRYPTION);
|
|
||||||
if (ret != 0)
|
|
||||||
return WC_HW_E;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7645,6 +7636,9 @@ void wc_AesFree(Aes* aes)
|
|||||||
(defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES))
|
(defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_AES))
|
||||||
ForceZero((byte*)aes->devKey, AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE);
|
ForceZero((byte*)aes->devKey, AES_MAX_KEY_SIZE/WOLFSSL_BIT_SIZE);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(WOLFSSL_IMXRT_DCP)
|
||||||
|
DCPAesFree(aes);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -49,23 +49,9 @@
|
|||||||
#include "fsl_debug_console.h"
|
#include "fsl_debug_console.h"
|
||||||
#include "fsl_dcp.h"
|
#include "fsl_dcp.h"
|
||||||
|
|
||||||
static int dcp_is_initialized = 0;
|
|
||||||
|
|
||||||
#ifndef SINGLE_THREADED
|
#ifndef SINGLE_THREADED
|
||||||
static wolfSSL_Mutex dcp_mutex;
|
#define dcp_lock() wolfSSL_CryptHwMutexLock()
|
||||||
static void dcp_lock(void)
|
#define dcp_unlock() wolfSSL_CryptHwMutexLock()
|
||||||
{
|
|
||||||
if (!dcp_is_initialized)
|
|
||||||
return;
|
|
||||||
wc_LockMutex(&dcp_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dcp_unlock(void)
|
|
||||||
{
|
|
||||||
if (!dcp_is_initialized)
|
|
||||||
return;
|
|
||||||
wc_UnLockMutex(&dcp_mutex);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define dcp_lock() do{}while(0)
|
#define dcp_lock() do{}while(0)
|
||||||
#define dcp_unlock() do{}while(0)
|
#define dcp_unlock() do{}while(0)
|
||||||
@@ -85,7 +71,6 @@ typedef enum _dcp_otp_key_select
|
|||||||
static status_t DCP_OTPKeySelect(dcp_otp_key_select keySelect)
|
static status_t DCP_OTPKeySelect(dcp_otp_key_select keySelect)
|
||||||
{
|
{
|
||||||
status_t retval = kStatus_Success;
|
status_t retval = kStatus_Success;
|
||||||
dcp_lock();
|
|
||||||
if (keySelect == kDCP_OTPMKKeyLow)
|
if (keySelect == kDCP_OTPMKKeyLow)
|
||||||
{
|
{
|
||||||
IOMUXC_GPR->GPR3 &= ~(1 << IOMUXC_GPR_GPR3_DCP_KEY_SEL_SHIFT);
|
IOMUXC_GPR->GPR3 &= ~(1 << IOMUXC_GPR_GPR3_DCP_KEY_SEL_SHIFT);
|
||||||
@@ -114,7 +99,6 @@ static status_t DCP_OTPKeySelect(dcp_otp_key_select keySelect)
|
|||||||
{
|
{
|
||||||
retval = kStatus_InvalidArgument;
|
retval = kStatus_InvalidArgument;
|
||||||
}
|
}
|
||||||
dcp_unlock();
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -125,7 +109,10 @@ static const int dcp_channels[4] = {
|
|||||||
kDCP_Channel2,
|
kDCP_Channel2,
|
||||||
kDCP_Channel3
|
kDCP_Channel3
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef SINGLE_THREADED
|
||||||
static int dcp_status[4] = {0, 0, 0, 0};
|
static int dcp_status[4] = {0, 0, 0, 0};
|
||||||
|
#endif
|
||||||
|
|
||||||
static int dcp_get_channel(void)
|
static int dcp_get_channel(void)
|
||||||
{
|
{
|
||||||
@@ -133,32 +120,50 @@ static int dcp_get_channel(void)
|
|||||||
return dcp_channels[0];
|
return dcp_channels[0];
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
|
int ret = 0;
|
||||||
|
dcp_lock();
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (dcp_status[i] == 0) {
|
if (dcp_status[i] == 0) {
|
||||||
dcp_status[i]++;
|
dcp_status[i]++;
|
||||||
return dcp_channels[i];
|
ret = dcp_channels[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
dcp_unlock();
|
||||||
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dcp_key_slot(int ch)
|
||||||
static int dcp_init(void)
|
|
||||||
{
|
{
|
||||||
int ch = dcp_get_channel();
|
int ret = -1;
|
||||||
if (!ch) {
|
|
||||||
return 0;
|
#if DCP_USE_OTP_KEY
|
||||||
}
|
return kDCP_OtpKey;
|
||||||
if (!dcp_is_initialized) {
|
|
||||||
dcp_config_t dcpConfig;
|
|
||||||
#ifndef SINGLE_THREADED
|
|
||||||
/* Initialize and lock mutex */
|
|
||||||
wc_InitMutex(&dcp_mutex);
|
|
||||||
dcp_lock();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SINGLE_THREADED
|
||||||
|
int i;
|
||||||
|
dcp_lock();
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
if (ch == dcp_channels[i]) {
|
||||||
|
ret = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dcp_unlock();
|
||||||
|
#else
|
||||||
|
ret = 0;
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int wc_dcp_init(void)
|
||||||
|
{
|
||||||
|
dcp_config_t dcpConfig;
|
||||||
|
dcp_lock();
|
||||||
DCP_GetDefaultConfig(&dcpConfig);
|
DCP_GetDefaultConfig(&dcpConfig);
|
||||||
/* Initialize DCP */
|
|
||||||
/* Reset and initialize DCP */
|
/* Reset and initialize DCP */
|
||||||
DCP_Init(DCP, &dcpConfig);
|
DCP_Init(DCP, &dcpConfig);
|
||||||
#if DCP_USE_OTP_KEY
|
#if DCP_USE_OTP_KEY
|
||||||
@@ -166,21 +171,23 @@ static int dcp_init(void)
|
|||||||
/* Software reset of DCP must be issued after changing the OTP key type. */
|
/* Software reset of DCP must be issued after changing the OTP key type. */
|
||||||
DCP_OTPKeySelect(kDCP_OTPMKKeyLow);
|
DCP_OTPKeySelect(kDCP_OTPMKKeyLow);
|
||||||
#endif
|
#endif
|
||||||
dcp_is_initialized++;
|
|
||||||
/* Release mutex */
|
/* Release mutex */
|
||||||
dcp_unlock();
|
dcp_unlock();
|
||||||
}
|
return 0;
|
||||||
return ch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dcp_fini(int ch)
|
static void dcp_free(int ch)
|
||||||
{
|
{
|
||||||
#ifdef SINGLE_THREADED
|
#ifndef SINGLE_THREADED
|
||||||
int i;
|
int i;
|
||||||
|
dcp_lock();
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
if (ch == dcp_channels[i])
|
if (ch == dcp_channels[i]) {
|
||||||
dcp_status[i] = 0;
|
dcp_status[i] = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
dcp_unlock();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,17 +198,21 @@ int DCPAesInit(Aes *aes)
|
|||||||
int ch;
|
int ch;
|
||||||
if (!aes)
|
if (!aes)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
ch = dcp_init();
|
ch = dcp_get_channel();
|
||||||
if (ch == 0)
|
if (ch == 0)
|
||||||
return WC_PENDING_E;
|
return WC_PENDING_E;
|
||||||
dcp_lock();
|
|
||||||
XMEMSET(&aes->handle, 0, sizeof(aes->handle));
|
XMEMSET(&aes->handle, 0, sizeof(aes->handle));
|
||||||
aes->handle.channel = ch;
|
aes->handle.channel = ch;
|
||||||
|
aes->handle.keySlot = dcp_key_slot(aes->handle.channel);
|
||||||
aes->handle.swapConfig = kDCP_NoSwap;
|
aes->handle.swapConfig = kDCP_NoSwap;
|
||||||
dcp_unlock();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DCPAesFree(Aes *aes)
|
||||||
|
{
|
||||||
|
dcp_free(aes->handle.channel);
|
||||||
|
}
|
||||||
|
|
||||||
int DCPAesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv,
|
int DCPAesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv,
|
||||||
int dir)
|
int dir)
|
||||||
{
|
{
|
||||||
@@ -215,16 +226,10 @@ int DCPAesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv,
|
|||||||
|
|
||||||
if (len != 16)
|
if (len != 16)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
if (aes->handle.channel == 0) {
|
||||||
if (aes->handle.channel == 0)
|
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
}
|
||||||
dcp_lock();
|
dcp_lock();
|
||||||
#if DCP_USE_OTP_KEY
|
|
||||||
aes->handle.keySlot = kDCP_OtpKey;
|
|
||||||
#else
|
|
||||||
aes->handle.keySlot = kDCP_KeySlot0;
|
|
||||||
#endif
|
|
||||||
status = DCP_AES_SetKey(DCP, &aes->handle, key, 16);
|
status = DCP_AES_SetKey(DCP, &aes->handle, key, 16);
|
||||||
if (status != kStatus_Success)
|
if (status != kStatus_Success)
|
||||||
status = WC_HW_E;
|
status = WC_HW_E;
|
||||||
@@ -270,12 +275,28 @@ int DCPAesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
|||||||
|
|
||||||
int DCPAesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
int DCPAesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||||
{
|
{
|
||||||
return DCP_AES_EncryptEcb(DCP, &aes->handle, in, out, sz);
|
int ret;
|
||||||
|
if (sz % 16)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
dcp_lock();
|
||||||
|
ret = DCP_AES_EncryptEcb(DCP, &aes->handle, in, out, sz);
|
||||||
|
if (ret)
|
||||||
|
ret = WC_HW_E;
|
||||||
|
dcp_unlock();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DCPAesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
int DCPAesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||||
{
|
{
|
||||||
return DCP_AES_DecryptEcb(DCP, &aes->handle, in, out, sz);
|
int ret;
|
||||||
|
if (sz % 16)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
dcp_lock();
|
||||||
|
ret = DCP_AES_DecryptEcb(DCP, &aes->handle, in, out, sz);
|
||||||
|
if (ret)
|
||||||
|
ret = WC_HW_E;
|
||||||
|
dcp_unlock();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -285,21 +306,25 @@ int wc_InitSha256_ex(wc_Sha256* sha256, void* heap, int devId)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int ch;
|
int ch;
|
||||||
|
int keyslot;
|
||||||
if (sha256 == NULL)
|
if (sha256 == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
ch = dcp_init();
|
ch = dcp_get_channel();
|
||||||
if (ch == 0)
|
if (ch == 0)
|
||||||
return WC_PENDING_E;
|
return WC_PENDING_E;
|
||||||
|
keyslot = dcp_key_slot(ch);
|
||||||
|
|
||||||
dcp_lock();
|
dcp_lock();
|
||||||
(void)devId;
|
(void)devId;
|
||||||
XMEMSET(sha256, 0, sizeof(wc_Sha256));
|
XMEMSET(sha256, 0, sizeof(wc_Sha256));
|
||||||
sha256->handle.channel = ch;
|
sha256->handle.channel = ch;
|
||||||
sha256->handle.keySlot = kDCP_KeySlot0;
|
sha256->handle.keySlot = keyslot;
|
||||||
sha256->handle.swapConfig = kDCP_NoSwap;
|
sha256->handle.swapConfig = kDCP_NoSwap;
|
||||||
ret = DCP_HASH_Init(DCP, &sha256->handle, &sha256->ctx, kDCP_Sha256);
|
ret = DCP_HASH_Init(DCP, &sha256->handle, &sha256->ctx, kDCP_Sha256);
|
||||||
if (ret != kStatus_Success)
|
if (ret != kStatus_Success)
|
||||||
ret = WC_HW_E;
|
ret = WC_HW_E;
|
||||||
dcp_unlock();
|
dcp_unlock();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +336,7 @@ int wc_InitSha256(wc_Sha256* sha256)
|
|||||||
void DCPSha256Free(wc_Sha256* sha256)
|
void DCPSha256Free(wc_Sha256* sha256)
|
||||||
{
|
{
|
||||||
if (sha256)
|
if (sha256)
|
||||||
dcp_fini(sha256->handle.channel);
|
dcp_free(sha256->handle.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wc_Sha256Update(wc_Sha256* sha256, const byte* data, word32 len)
|
int wc_Sha256Update(wc_Sha256* sha256, const byte* data, word32 len)
|
||||||
@@ -328,7 +353,6 @@ int wc_Sha256Update(wc_Sha256* sha256, const byte* data, word32 len)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int wc_Sha256GetHash(wc_Sha256* sha256, byte* hash)
|
int wc_Sha256GetHash(wc_Sha256* sha256, byte* hash)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -357,9 +381,6 @@ int wc_Sha256Final(wc_Sha256* sha256, byte* hash)
|
|||||||
if ((ret != kStatus_Success) || (outlen != SHA256_DIGEST_SIZE))
|
if ((ret != kStatus_Success) || (outlen != SHA256_DIGEST_SIZE))
|
||||||
ret = WC_HW_E;
|
ret = WC_HW_E;
|
||||||
else {
|
else {
|
||||||
sha256->handle.channel = kDCP_Channel1;
|
|
||||||
sha256->handle.keySlot = kDCP_KeySlot0;
|
|
||||||
sha256->handle.swapConfig = kDCP_NoSwap;
|
|
||||||
ret = DCP_HASH_Init(DCP, &sha256->handle, &sha256->ctx, kDCP_Sha256);
|
ret = DCP_HASH_Init(DCP, &sha256->handle, &sha256->ctx, kDCP_Sha256);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ret = WC_HW_E;
|
ret = WC_HW_E;
|
||||||
@@ -403,14 +424,18 @@ int wc_InitSha_ex(wc_Sha* sha, void* heap, int devId)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int ch;
|
int ch;
|
||||||
|
int keyslot;
|
||||||
if (sha == NULL)
|
if (sha == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
ch = dcp_init();
|
ch = dcp_get_channel();
|
||||||
|
if (ch == 0)
|
||||||
|
return WC_PENDING_E;
|
||||||
|
keyslot = dcp_key_slot(ch);
|
||||||
dcp_lock();
|
dcp_lock();
|
||||||
(void)devId;
|
(void)devId;
|
||||||
XMEMSET(sha, 0, sizeof(wc_Sha));
|
XMEMSET(sha, 0, sizeof(wc_Sha));
|
||||||
sha->handle.channel = ch;
|
sha->handle.channel = ch;
|
||||||
sha->handle.keySlot = kDCP_KeySlot0;
|
sha->handle.keySlot = keyslot;
|
||||||
sha->handle.swapConfig = kDCP_NoSwap;
|
sha->handle.swapConfig = kDCP_NoSwap;
|
||||||
ret = DCP_HASH_Init(DCP, &sha->handle, &sha->ctx, kDCP_Sha1);
|
ret = DCP_HASH_Init(DCP, &sha->handle, &sha->ctx, kDCP_Sha1);
|
||||||
if (ret != kStatus_Success)
|
if (ret != kStatus_Success)
|
||||||
@@ -427,7 +452,7 @@ int wc_InitSha(wc_Sha* sha)
|
|||||||
void DCPShaFree(wc_Sha* sha)
|
void DCPShaFree(wc_Sha* sha)
|
||||||
{
|
{
|
||||||
if (sha)
|
if (sha)
|
||||||
dcp_fini(sha->handle.channel);
|
dcp_free(sha->handle.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
|
int wc_ShaUpdate(wc_Sha* sha, const byte* data, word32 len)
|
||||||
@@ -470,12 +495,9 @@ int wc_ShaFinal(wc_Sha* sha, byte* hash)
|
|||||||
size_t outlen = WC_SHA_DIGEST_SIZE;
|
size_t outlen = WC_SHA_DIGEST_SIZE;
|
||||||
dcp_lock();
|
dcp_lock();
|
||||||
ret = DCP_HASH_Finish(DCP, &sha->ctx, hash, &outlen);
|
ret = DCP_HASH_Finish(DCP, &sha->ctx, hash, &outlen);
|
||||||
if ((ret != kStatus_Success) || (outlen != SHA_DIGEST_SIZE))
|
if ((ret != kStatus_Success) || (outlen != SHA_DIGEST_SIZE)) {
|
||||||
ret = WC_HW_E;
|
ret = WC_HW_E;
|
||||||
else {
|
} else {
|
||||||
sha->handle.channel = kDCP_Channel1;
|
|
||||||
sha->handle.keySlot = kDCP_KeySlot0;
|
|
||||||
sha->handle.swapConfig = kDCP_NoSwap;
|
|
||||||
ret = DCP_HASH_Init(DCP, &sha->handle, &sha->ctx, kDCP_Sha1);
|
ret = DCP_HASH_Init(DCP, &sha->handle, &sha->ctx, kDCP_Sha1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ret = WC_HW_E;
|
ret = WC_HW_E;
|
||||||
|
@@ -75,6 +75,10 @@
|
|||||||
#include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
|
#include <wolfssl/wolfcrypt/port/caam/wolfcaam.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_IMXRT_DCP
|
||||||
|
#include <wolfssl/wolfcrypt/port/nxp/dcp_port.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WOLF_CRYPTO_CB
|
#ifdef WOLF_CRYPTO_CB
|
||||||
#include <wolfssl/wolfcrypt/cryptocb.h>
|
#include <wolfssl/wolfcrypt/cryptocb.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -109,7 +113,6 @@ static volatile int initRefCount = 0;
|
|||||||
int wolfCrypt_Init(void)
|
int wolfCrypt_Init(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (initRefCount == 0) {
|
if (initRefCount == 0) {
|
||||||
WOLFSSL_ENTER("wolfCrypt_Init");
|
WOLFSSL_ENTER("wolfCrypt_Init");
|
||||||
|
|
||||||
@@ -264,6 +267,12 @@ int wolfCrypt_Init(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_IMXRT_DCP
|
||||||
|
if ((ret = wc_dcp_init()) != 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WOLFSSL_DSP) && !defined(WOLFSSL_DSP_BUILD)
|
#if defined(WOLFSSL_DSP) && !defined(WOLFSSL_DSP_BUILD)
|
||||||
if ((ret = wolfSSL_InitHandle()) != 0) {
|
if ((ret = wolfSSL_InitHandle()) != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -36,7 +36,11 @@
|
|||||||
#include "fsl_debug_console.h"
|
#include "fsl_debug_console.h"
|
||||||
#include "fsl_dcp.h"
|
#include "fsl_dcp.h"
|
||||||
|
|
||||||
|
int wc_dcp_init(void);
|
||||||
|
|
||||||
int DCPAesInit(Aes* aes);
|
int DCPAesInit(Aes* aes);
|
||||||
|
void DCPAesFree(Aes *aes);
|
||||||
|
|
||||||
int DCPAesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv,
|
int DCPAesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv,
|
||||||
int dir);
|
int dir);
|
||||||
int DCPAesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
|
int DCPAesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
|
||||||
|
@@ -1621,6 +1621,12 @@ extern void uITRON4_free(void *p) ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */
|
||||||
|
#if defined(WOLFSSL_IMXRT_DCP) && !defined(SINGLE_THREADED)
|
||||||
|
#undef WOLFSSL_CRYPT_HW_MUTEX
|
||||||
|
#define WOLFSSL_CRYPT_HW_MUTEX 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||||
!defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \
|
!defined(WOLFSSL_LEANPSK) && !defined(NO_WOLFSSL_MEMORY) && \
|
||||||
!defined(XMALLOC_OVERRIDE)
|
!defined(XMALLOC_OVERRIDE)
|
||||||
|
Reference in New Issue
Block a user