mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
DCP refactor: do not override wc_Sha types
This commit is contained in:
@ -35,6 +35,8 @@
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_debug_console.h"
|
||||
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
#if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) && defined(DCP_USE_DCACHE) && (DCP_USE_DCACHE == 1U)
|
||||
@ -49,6 +51,15 @@
|
||||
#include "fsl_debug_console.h"
|
||||
#include "fsl_dcp.h"
|
||||
|
||||
#ifdef USE_FAST_MATH
|
||||
#include <wolfssl/wolfcrypt/tfm.h>
|
||||
#elif defined WOLFSSL_SP_MATH
|
||||
#include <wolfssl/wolfcrypt/sp_int.h>
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/integer.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#define dcp_lock_init() wolfSSL_CryptHwMutexInit()
|
||||
#define dcp_lock() wolfSSL_CryptHwMutexLock()
|
||||
@ -448,11 +459,6 @@ int wc_InitSha_ex(wc_Sha* sha, void* heap, int devId)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wc_InitSha(wc_Sha* sha)
|
||||
{
|
||||
return wc_InitSha_ex(sha, NULL, INVALID_DEVID);
|
||||
}
|
||||
|
||||
void DCPShaFree(wc_Sha* sha)
|
||||
{
|
||||
if (sha)
|
||||
|
@ -330,6 +330,7 @@
|
||||
/* implemented in wolfcrypt/src/port/Renesas/renesas_tsip_sha.c */
|
||||
|
||||
#elif defined(WOLFSSL_IMXRT_DCP)
|
||||
#include <wolfssl/wolfcrypt/port/nxp/dcp_port.h>
|
||||
/* implemented in wolfcrypt/src/port/nxp/dcp_port.c */
|
||||
|
||||
#elif defined(WOLFSSL_SILABS_SE_ACCEL)
|
||||
@ -793,13 +794,10 @@ int wc_ShaTransform(wc_Sha* sha, const unsigned char* data)
|
||||
#endif /* USE_SHA_SOFTWARE_IMPL */
|
||||
|
||||
|
||||
|
||||
#if !defined(WOLFSSL_IMXRT_DCP)
|
||||
int wc_InitSha(wc_Sha* sha)
|
||||
{
|
||||
return wc_InitSha_ex(sha, NULL, INVALID_DEVID);
|
||||
}
|
||||
#endif /* !defined(WOLFSSL_IMXRT_DCP) */
|
||||
|
||||
void wc_ShaFree(wc_Sha* sha)
|
||||
{
|
||||
|
@ -22,23 +22,22 @@
|
||||
#define _DCP_PORT_H_
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#ifdef USE_FAST_MATH
|
||||
#include <wolfssl/wolfcrypt/tfm.h>
|
||||
#elif defined WOLFSSL_SP_MATH
|
||||
#include <wolfssl/wolfcrypt/sp_int.h>
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/integer.h>
|
||||
#include "fsl_dcp.h"
|
||||
|
||||
#ifndef NO_SHA256
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
void DCPSha256Free(wc_Sha256 *sha256);
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/aes.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include "fsl_device_registers.h"
|
||||
#include "fsl_debug_console.h"
|
||||
#include "fsl_dcp.h"
|
||||
#ifndef NO_SHA
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
void DCPShaFree(wc_Sha *sha);
|
||||
#endif
|
||||
|
||||
int wc_dcp_init(void);
|
||||
|
||||
#ifndef NO_AES
|
||||
#include <wolfssl/wolfcrypt/aes.h>
|
||||
int DCPAesInit(Aes* aes);
|
||||
void DCPAesFree(Aes *aes);
|
||||
|
||||
@ -53,25 +52,5 @@ int DCPAesEcbEncrypt(Aes* aes, byte* out, const byte* in, word32 sz);
|
||||
int DCPAesEcbDecrypt(Aes* aes, byte* out, const byte* in, word32 sz);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
typedef struct wc_Sha256_DCP {
|
||||
dcp_handle_t handle;
|
||||
dcp_hash_ctx_t ctx;
|
||||
} wc_Sha256;
|
||||
#define WC_SHA256_TYPE_DEFINED
|
||||
|
||||
void DCPSha256Free(wc_Sha256 *sha256);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
typedef struct wc_Sha_DCP {
|
||||
dcp_handle_t handle;
|
||||
dcp_hash_ctx_t ctx;
|
||||
} wc_Sha;
|
||||
#define WC_SHA_TYPE_DEFINED
|
||||
|
||||
void DCPShaFree(wc_Sha *sha);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -103,9 +103,7 @@
|
||||
#ifdef NO_SHA256
|
||||
#error "Hash DRBG requires SHA-256."
|
||||
#endif /* NO_SHA256 */
|
||||
#ifdef WOLFSSL_SMALL_STACK_CACHE
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#endif
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#elif defined(HAVE_WNR)
|
||||
/* allow whitewood as direct RNG source using wc_GenerateSeed directly */
|
||||
#elif defined(HAVE_INTEL_RDRAND)
|
||||
|
@ -52,6 +52,10 @@
|
||||
#include "fsl_ltc.h"
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
#include "fsl_dcp.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -72,9 +76,6 @@
|
||||
#ifdef WOLFSSL_ESP32WROOM32_CRYPT
|
||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||
#endif
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
#include <wolfssl/wolfcrypt/port/nxp/dcp_port.h>
|
||||
#endif
|
||||
#if defined(WOLFSSL_SILABS_SE_ACCEL)
|
||||
#include <wolfssl/wolfcrypt/port/silabs/silabs_hash.h>
|
||||
#endif
|
||||
@ -119,6 +120,9 @@ struct wc_Sha {
|
||||
STM32_HASH_Context stmCtx;
|
||||
#elif defined(WOLFSSL_SILABS_SE_ACCEL)
|
||||
wc_silabs_sha_t silabsCtx;
|
||||
#elif defined(WOLFSSL_IMXRT_DCP)
|
||||
dcp_handle_t handle;
|
||||
dcp_hash_ctx_t ctx;
|
||||
#else
|
||||
word32 buffLen; /* in bytes */
|
||||
word32 loLen; /* length in bytes */
|
||||
|
@ -61,6 +61,9 @@
|
||||
#include "fsl_ltc.h"
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_IMXRT_DCP
|
||||
#include "fsl_dcp.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -131,8 +134,6 @@ enum {
|
||||
#include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h"
|
||||
#elif defined(WOLFSSL_PSOC6_CRYPTO)
|
||||
#include "wolfssl/wolfcrypt/port/cypress/psoc6_crypto.h"
|
||||
#elif defined(WOLFSSL_IMXRT_DCP)
|
||||
#include <wolfssl/wolfcrypt/port/nxp/dcp_port.h>
|
||||
#else
|
||||
|
||||
/* wc_Sha256 digest */
|
||||
@ -143,6 +144,9 @@ struct wc_Sha256 {
|
||||
STM32_HASH_Context stmCtx;
|
||||
#elif defined(WOLFSSL_SILABS_SE_ACCEL)
|
||||
wc_silabs_sha_t silabsCtx;
|
||||
#elif defined(WOLFSSL_IMXRT_DCP)
|
||||
dcp_handle_t handle;
|
||||
dcp_hash_ctx_t ctx;
|
||||
#else
|
||||
/* alignment on digest and buffer speeds up ARMv8 crypto operations */
|
||||
ALIGN16 word32 digest[WC_SHA256_DIGEST_SIZE / sizeof(word32)];
|
||||
|
Reference in New Issue
Block a user