diff options
author | areviu <areviu.info@gmail.com> | 2017-12-03 11:17:37 +0000 |
---|---|---|
committer | areviu <areviu.info@gmail.com> | 2017-12-03 11:17:37 +0000 |
commit | 388c0bb327ef06a5cda4bb0d33791451a6d6b2bf (patch) | |
tree | b83701a0bcad2b7a8aeb07d4a335210f22f802ad /os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c | |
parent | 343b101689d18e555bba9146a69a4843db864ebe (diff) | |
download | ChibiOS-388c0bb327ef06a5cda4bb0d33791451a6d6b2bf.tar.gz ChibiOS-388c0bb327ef06a5cda4bb0d33791451a6d6b2bf.tar.bz2 ChibiOS-388c0bb327ef06a5cda4bb0d33791451a6d6b2bf.zip |
added SHA in dma mode
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11115 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c')
-rw-r--r-- | os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c b/os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c index da66978fc..bbe51ab20 100644 --- a/os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c +++ b/os/hal/ports/SAMA/LLD/CRYPTOv1/sama_aes_lld.c @@ -112,6 +112,7 @@ cryerror_t sama_aes_lld_process_polling(CRYDriver *cryp, aesparams *params, uint32_t i;
cryerror_t ret;
+ osalMutexLock(&cryp->mutex);
//AES soft reset
AES->AES_CR = AES_CR_SWRST;
@@ -125,11 +126,11 @@ cryerror_t sama_aes_lld_process_polling(CRYDriver *cryp, aesparams *params, AES->AES_MR |= (AES_MR_CFBS(cryp->config->cfbs) | AES_MR_CKEY_PASSWD);
- osalMutexLock(&cryp->mutex);
+
sama_aes_lld_write_key(cryp->key0_buffer,( const uint32_t *) params->iv, cryp->key0_size);
- osalMutexUnlock(&cryp->mutex);
+
if (params->encrypt)
AES->AES_MR |= AES_MR_CIPHER;
@@ -156,6 +157,8 @@ cryerror_t sama_aes_lld_process_polling(CRYDriver *cryp, aesparams *params, }
+ osalMutexUnlock(&cryp->mutex);
+
return CRY_NOERROR;
}
@@ -167,6 +170,8 @@ cryerror_t sama_aes_lld_process_dma(CRYDriver *cryp, aesparams *params, osalDbgAssert(cryp->thread == NULL, "already waiting");
+ osalMutexLock(&cryp->mutex);
+
//set chunk size
cryp->dmachunksize = DMA_CHUNK_SIZE_4;
@@ -230,12 +235,8 @@ cryerror_t sama_aes_lld_process_dma(CRYDriver *cryp, aesparams *params, AES->AES_MR |= (AES_MR_CFBS(cryp->config->cfbs) | AES_MR_CKEY_PASSWD);
- osalMutexLock(&cryp->mutex);
-
sama_aes_lld_write_key(cryp->key0_buffer,( const uint32_t *) params->iv, cryp->key0_size);
- osalMutexUnlock(&cryp->mutex);
-
if (params->encrypt)
AES->AES_MR |= AES_MR_CIPHER;
else
@@ -258,6 +259,8 @@ cryerror_t sama_aes_lld_process_dma(CRYDriver *cryp, aesparams *params, osalSysUnlock();
+ osalMutexUnlock(&cryp->mutex);
+
return CRY_NOERROR;
}
|