aboutsummaryrefslogtreecommitdiff
path: root/cc3200/util
diff options
context:
space:
mode:
authorDaniel Campora2015-05-20 00:23:13 +0200
committerDaniel Campora2015-05-20 11:44:24 +0200
commite800db562f1ebdd3d7d1da642f89e66578b363e0 (patch)
tree1123e5ef218ccb9430e9f96ca723eca43e2615ed /cc3200/util
parent5e38b48dd621ef1c1cefce87d4126b31a85cbcfc (diff)
cc3200: Add uhashlib. Supports SHA1 and SHA256.
Diffstat (limited to 'cc3200/util')
-rw-r--r--cc3200/util/cryptohash.c (renamed from cc3200/util/hash.c)12
-rw-r--r--cc3200/util/cryptohash.h (renamed from cc3200/util/hash.h)14
2 files changed, 13 insertions, 13 deletions
diff --git a/cc3200/util/hash.c b/cc3200/util/cryptohash.c
index 1ae0c3ce6..7625413bb 100644
--- a/cc3200/util/hash.c
+++ b/cc3200/util/cryptohash.c
@@ -35,20 +35,20 @@
#include "rom_map.h"
#include "prcm.h"
#include "shamd5.h"
-#include "hash.h"
-#include "simplelink.h"
+#include "cryptohash.h"
/******************************************************************************
DEFINE PUBLIC FUNCTIONS
******************************************************************************/
-void HASH_Init (void) {
+__attribute__ ((section (".boot")))
+void CRYPTOHASH_Init (void) {
// Enable the Data Hashing and Transform Engine
MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
MAP_PRCMPeripheralReset(PRCM_DTHE);
}
-void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
+void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
// wait until the context is ready
while ((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) == 0);
@@ -64,12 +64,12 @@ void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
HWREG(SHAMD5_BASE + SHAMD5_O_LENGTH) = blocklen;
}
-void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen) {
+void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen) {
// write the data
SHAMD5DataWriteMultiple(data, datalen);
}
-void HASH_SHAMD5Read (uint8_t *hash) {
+void CRYPTOHASH_SHAMD5Read (uint8_t *hash) {
// wait for the output to be ready
while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0);
// read the result
diff --git a/cc3200/util/hash.h b/cc3200/util/cryptohash.h
index ea7b9f78d..d9f624d19 100644
--- a/cc3200/util/hash.h
+++ b/cc3200/util/cryptohash.h
@@ -24,15 +24,15 @@
* THE SOFTWARE.
*/
-#ifndef HASH_H_
-#define HASH_H_
+#ifndef CRYPTOHASH_H_
+#define CRYPTOHASH_H_
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
******************************************************************************/
-extern void HASH_Init (void);
-extern void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
-extern void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
-extern void HASH_SHAMD5Read (uint8_t *hash);
+extern void CRYPTOHASH_Init (void);
+extern void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
+extern void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
+extern void CRYPTOHASH_SHAMD5Read (uint8_t *hash);
-#endif /* HASH_H_ */
+#endif /* CRYPTOHASH_H_ */