aboutsummaryrefslogtreecommitdiff
path: root/cc3200/bootmgr
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/bootmgr
parent5e38b48dd621ef1c1cefce87d4126b31a85cbcfc (diff)
cc3200: Add uhashlib. Supports SHA1 and SHA256.
Diffstat (limited to 'cc3200/bootmgr')
-rw-r--r--cc3200/bootmgr/bootloader.mk2
-rw-r--r--cc3200/bootmgr/bootmgr.lds1
-rw-r--r--cc3200/bootmgr/main.c11
3 files changed, 8 insertions, 6 deletions
diff --git a/cc3200/bootmgr/bootloader.mk b/cc3200/bootmgr/bootloader.mk
index ae2422892..1de0e72f0 100644
--- a/cc3200/bootmgr/bootloader.mk
+++ b/cc3200/bootmgr/bootloader.mk
@@ -50,7 +50,7 @@ BOOT_SL_SRC_C = $(addprefix simplelink/,\
)
BOOT_UTIL_SRC_C = $(addprefix util/,\
- hash.c \
+ cryptohash.c \
)
BOOT_MAIN_SRC_C = \
diff --git a/cc3200/bootmgr/bootmgr.lds b/cc3200/bootmgr/bootmgr.lds
index 36d5da233..e67fe23ae 100644
--- a/cc3200/bootmgr/bootmgr.lds
+++ b/cc3200/bootmgr/bootmgr.lds
@@ -39,6 +39,7 @@ SECTIONS
{
_text = .;
KEEP(*(.intvecs))
+ *(.boot*)
*(.text*)
*(.rodata*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
diff --git a/cc3200/bootmgr/main.c b/cc3200/bootmgr/main.c
index 5da4d550c..ece1bf276 100644
--- a/cc3200/bootmgr/main.c
+++ b/cc3200/bootmgr/main.c
@@ -26,6 +26,7 @@
#include <stdint.h>
#include <stdbool.h>
+
#include "std.h"
#include "py/mpconfig.h"
@@ -47,7 +48,7 @@
#include "flc.h"
#include "bootmgr.h"
#include "shamd5.h"
-#include "hash.h"
+#include "cryptohash.h"
#include "utils.h"
#include "cc3200_hal.h"
#include "debug.h"
@@ -151,7 +152,7 @@ static void bootmgr_board_init(void) {
mperror_bootloader_check_reset_cause();
// Enable the Data Hashing Engine
- HASH_Init();
+ CRYPTOHASH_Init();
// Init the system led and the system switch
mperror_init0();
@@ -175,7 +176,7 @@ static bool bootmgr_verify (void) {
if (FsFileInfo.FileLen > BOOTMGR_HASH_SIZE) {
FsFileInfo.FileLen -= BOOTMGR_HASH_SIZE;
- HASH_SHAMD5Start(BOOTMGR_HASH_ALGO, FsFileInfo.FileLen);
+ CRYPTOHASH_SHAMD5Start(BOOTMGR_HASH_ALGO, FsFileInfo.FileLen);
do {
if ((FsFileInfo.FileLen - offset) > BOOTMGR_BUFF_SIZE) {
reqlen = BOOTMGR_BUFF_SIZE;
@@ -185,10 +186,10 @@ static bool bootmgr_verify (void) {
}
offset += sl_FsRead(fHandle, offset, bootmgr_file_buf, reqlen);
- HASH_SHAMD5Update(bootmgr_file_buf, reqlen);
+ CRYPTOHASH_SHAMD5Update(bootmgr_file_buf, reqlen);
} while (offset < FsFileInfo.FileLen);
- HASH_SHAMD5Read (bootmgr_file_buf);
+ CRYPTOHASH_SHAMD5Read (bootmgr_file_buf);
// convert the resulting hash to hex
for (_u32 i = 0; i < (BOOTMGR_HASH_SIZE / 2); i++) {