forked from wolfSSL/wolfssl
Fix so PIC32MZ works in caching mode after large hash. Reduced default block size for large hash to 256 (512 bytes total).
This commit is contained in:
@ -192,6 +192,9 @@ static int Pic32Crypto(const byte* in, int inLen, word32* out, int outLen,
|
|||||||
/* Software Reset the Crypto Engine */
|
/* Software Reset the Crypto Engine */
|
||||||
CECON = 1 << 6;
|
CECON = 1 << 6;
|
||||||
while (CECON);
|
while (CECON);
|
||||||
|
|
||||||
|
/* Clear the interrupt flags */
|
||||||
|
CEINTSRC = 0xF;
|
||||||
|
|
||||||
/* Run the engine */
|
/* Run the engine */
|
||||||
CEBDPADDR = (unsigned int)KVA_TO_PA(&bd);
|
CEBDPADDR = (unsigned int)KVA_TO_PA(&bd);
|
||||||
@ -256,8 +259,9 @@ static int Pic32Crypto(const byte* in, int inLen, word32* out, int outLen,
|
|||||||
|
|
||||||
#ifdef WOLFSSL_PIC32MZ_LARGE_HASH
|
#ifdef WOLFSSL_PIC32MZ_LARGE_HASH
|
||||||
|
|
||||||
|
/* tunable large hash block size */
|
||||||
#ifndef PIC32_BLOCK_SIZE
|
#ifndef PIC32_BLOCK_SIZE
|
||||||
#define PIC32_BLOCK_SIZE 2048
|
#define PIC32_BLOCK_SIZE 256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PIC32MZ_MIN_BLOCK 64
|
#define PIC32MZ_MIN_BLOCK 64
|
||||||
@ -291,6 +295,8 @@ static void reset_engine(pic32mz_desc *desc, int algo)
|
|||||||
int i;
|
int i;
|
||||||
pic32mz_desc* uc_desc = KVA0_TO_KVA1(desc);
|
pic32mz_desc* uc_desc = KVA0_TO_KVA1(desc);
|
||||||
|
|
||||||
|
wolfSSL_CryptHwMutexLock();
|
||||||
|
|
||||||
/* Software reset */
|
/* Software reset */
|
||||||
CECON = 1 << 6;
|
CECON = 1 << 6;
|
||||||
while (CECON);
|
while (CECON);
|
||||||
@ -434,6 +440,8 @@ void wait_engine(pic32mz_desc *desc, char *hash, int hash_sz)
|
|||||||
/* copy output - hardware already swapped */
|
/* copy output - hardware already swapped */
|
||||||
XMEMCPY(hash, KVA0_TO_KVA1(hash), hash_sz);
|
XMEMCPY(hash, KVA0_TO_KVA1(hash), hash_sz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wolfSSL_CryptHwMutexUnLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WOLFSSL_PIC32MZ_LARGE_HASH */
|
#endif /* WOLFSSL_PIC32MZ_LARGE_HASH */
|
||||||
|
Reference in New Issue
Block a user