summaryrefslogtreecommitdiffstats
path: root/firmware/common/rb-loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common/rb-loader.c')
-rw-r--r--firmware/common/rb-loader.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/firmware/common/rb-loader.c b/firmware/common/rb-loader.c
index 1ded8c2335..300ba55401 100644
--- a/firmware/common/rb-loader.c
+++ b/firmware/common/rb-loader.c
@@ -24,6 +24,7 @@
#include "system.h"
#include "file.h"
#include "loader_strerror.h"
+#include "checksum.h"
#if defined(HAVE_BOOTDATA)
#include "bootdata.h"
@@ -129,8 +130,7 @@ static int load_firmware_filename(unsigned char* buf,
int buffer_size)
{
int len;
- unsigned long chksum, sum;
- int i;
+ unsigned long chksum;
int ret;
int fd = open(filename, O_RDONLY);
@@ -162,14 +162,7 @@ static int load_firmware_filename(unsigned char* buf,
goto end;
}
- sum = MODEL_NUMBER;
-
- for(i = 0;i < len;i++)
- {
- sum += buf[i];
- }
-
- if (sum != chksum)
+ if (!verify_checksum(chksum, buf, len))
{
ret = EBAD_CHKSUM;
goto end;