Go to the documentation of this file.
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
35 #include "apm32f4xx.h"
36 #include "apm32f4xx_rcm.h"
44 #if (APM32F4XX_CRYPTO_HASH_SUPPORT == ENABLED)
55 RCM_EnableAHB2PeriphClock(RCM_AHB2_PERIPH_HASH);
72 uint32_t *
h,
size_t hLen)
85 for(i = 0; i < hLen; i++)
87 HASH->CTSWAP[6 + i] =
h[i];
88 HASH->CTSWAP[14 + i] =
h[i];
95 HASH->INDATA = __UNALIGNED_UINT32_READ(
data);
103 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 4);
104 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 8);
105 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 12);
106 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 16);
107 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 20);
108 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 24);
109 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 28);
110 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 32);
111 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 36);
112 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 40);
113 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 44);
114 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 48);
115 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 52);
116 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 56);
117 HASH->INDATA = __UNALIGNED_UINT32_READ(
data + 60);
134 for(i = 0; i < hLen; i++)
136 h[i] = HASH->CTSWAP[14 + i];
144 #if (MD5_SUPPORT == ENABLED)
194 if(context->
size == 64)
221 #if (SHA1_SUPPORT == ENABLED)
271 if(context->
size == 64)
APM32F4 hash hardware accelerator.
void sha1Update(Sha1Context *context, const void *data, size_t length)
Update the SHA-1 context with a portion of the message being hashed.
#define HASH_CTRL_ALGSEL_SHA1
#define osMemcpy(dest, src, length)
void md5ProcessBlock(Md5Context *context)
Process message in 16-word blocks.
General definitions for cryptographic algorithms.
Collection of hash algorithms.
#define HASH_CTRL_ALGSEL_MD5
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
#define HASH_CTRL_DTYPE_8B
#define HASH_CTRL_INITCAL
void sha1ProcessBlock(Sha1Context *context)
Process message in 16-word blocks.
error_t hashInit(void)
HASH module initialization.
OsMutex apm32f4xxCryptoMutex
void hashProcessData(uint32_t algo, const uint8_t *data, size_t length, uint32_t *h, size_t hLen)
Update hash value.
APM32F4 hardware cryptographic accelerator.
void md5Update(Md5Context *context, const void *data, size_t length)
Update the MD5 context with a portion of the message being hashed.