Commit graph

20 commits

Author SHA1 Message Date
Naresh Kumar Mehta
488a613637 sysupgrade: Fix compiler warnings
Change-Id: I69e4d5cf06212feb9e67d7071779846581096bec
Signed-off-by: Naresh Kumar Mehta <naresh@codeaurora.org>
2019-04-05 17:41:16 +05:30
Naresh Kumar Mehta
ca8b173e47 sysupgrade: Remove duplicate declaration
Change-Id: I463a5d7252b54c850ac2e5c9d8b3c679455d66c5
Signed-off-by: Naresh Kumar Mehta <naresh@codeaurora.org>
2019-04-01 14:24:07 +05:30
Avinash Pandey
34ee85c62f sysupgrade: Skip ubi section authentication in NOR/eMMC boot.
Change-Id: I2b2ba59c95eb0e7f9ca17527515f34fc50aeacd6
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-08-14 12:42:07 +05:30
Avinash Pandey
37c8e79460 sysupgrade: Avoid dereferencing of buffer to fix KW issue.
This kw issue occurred with below message:
"Use of free memory (access) - possible".
In order to fix this issue, we have removed all 
dereferenced buffer after freeing the buffer..

Change-Id: I080c45b17397333c3f897b960bdf6fca01b7a53e
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-03-23 11:25:27 +05:30
Avinash Pandey
a14e102f05 Sysupgrade: Fixing kw issues for buffer overflow.
Kw issues occurred with below message:
 "Array 'buf'of size 256 may use index value(s) -2..0".
In order to fix this issue, error message will be
returned with array index out of index if buffer
size isless than 0 or if it increases buffer size.

Change-Id: I5a7885b0ee2fd6e9c0ac3083b28366f1ae5ceaee
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-03-20 13:07:36 +05:30
Linux Build Service Account
6efdb60f4b Merge "sysupgrade: Read the files whose names starts with section type" 2018-03-02 13:51:52 -08:00
Linux Build Service Account
932c29bf3c Merge "sysupgrade: Add SBL_NAND_PREAMBLE if preamble bytes exist in image" 2018-03-02 02:04:54 -08:00
Linux Build Service Account
8775f69613 Merge "sysupgrade: Add support to process SBL for ipq806x nand boot" 2018-03-02 02:04:54 -08:00
Avinash Pandey
745ead5b92 sysupgrade: Read the files whose names starts with section type
Currently we are reading the .bin files who are having the type
in their image names, but this has problem when the image type
is overlapping in two file names ex. wififw_ubi.bin and ubi.bin.
To avoid this problem, we will take files whose names starts
with our image type.

Change-Id: Ib3ab64fb2bbf5c9c59b1ec644c409dee31be77a1
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-03-02 12:57:59 +05:30
Linux Build Service Account
64b3c8f03a Merge "Sysupgrade: Add signature certificate size check as warning." 2018-02-26 00:14:45 -08:00
Avinash Pandey
5432bb2a0b Sysupgrade: Add signature certificate size check as warning.
For ipq807x, signature certificate size is dynamic and it is not fixed.
Hence we will treat signature certificate size check as warning. 

Change-Id: I6528212aaf9297217b19cb34311fc96500a7f38f
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-02-23 19:52:13 +05:30
Avinash Pandey
7eeddceddf Sysupgrade: Fixing kw issues in string functions.
This change replaces banned function namely, strncat and 
strncpy to strlcat and strlcpy respectively.

Change-Id: Ic02f59b29d1e58a937670f5e53dd1199cb55e53e
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-02-22 22:39:07 -08:00
Ram Chandra Jangir
62928dc964 sysupgrade: Add SBL_NAND_PREAMBLE if preamble bytes exist in image
Now we are adding preamble value to read SBL header if ubi section
is present in the image. But in case of NOR+NAND images, though we are
having SBL in NOR and ubi section is also present and NAND_PREAMBLE
is getting added. which is breaking NOR+NAND sysupgrade.

Added functionality to compare first 12 bytes of section with pre
defined PREAMBLE value. If values matches, add the NAND_PREAMBLE to
read SBL header.

Change-Id: I704ee86cc50aa3ce3b2ab6ec34beab866ffde4b9
Signed-off-by: Anto Norbert <norbrt@codeaurora.org>
2018-02-20 15:23:40 +05:30
Ram Chandra Jangir
f40cda9a42 sysupgrade: Add support to process SBL for ipq806x nand boot
This change adds the correct Sbl_Hdr instead of Mbn_Hdr, since
sbl header is different than normal Mbn_Hdr, and adds the sbl
header size as 80.
SBL in nand starts with preamble before the sbl header, so here
it adds the preamble for header start address as well as
src, sig and cert offset values.

Change-Id: I9a56d7b4a51890b74a5ee5fe3047a38801d23803
Signed-off-by: Ram Chandra Jangir <rjangir@codeaurora.org>
2018-02-20 15:20:10 +05:30
Avinash Pandey
bcfcba7eb2 sysupgrade: Add support to authenticate image using TZ
This change will look for existence of file /sys/sec_upgrade/sec_auth
if the file exists, it performs image authentication with the new
approach i.e TZ enabled mechanism.

It reads all the sections of the single image and writes each
section's type and image file path in /sys/sec_upgrade/sec_auth.
If a written section image is a proper signed image, then it will
return success else will cause the failure.

Change-Id: I649581e0ab74a66d677e5bfbf1c34fd83cb2465d
Signed-off-by: Avinash Pandey <avinasv@codeaurora.org>
2018-02-08 16:14:32 +05:30
Pavithra Palanisamy
a392418a4f Sysupgrade: Add support for devcfg version check
This change adds support to check devcfg version and
allows sysupgrade only if the version is higher.

Change-Id: I7192f428c50c1b1b9eeddd1aac0d57d341d32436
Signed-off-by: Pavithra Palanisamy <pavip@codeaurora.org>
2017-11-03 04:18:26 -07:00
Pavithra Palanisamy
0e3043fd78 sysupgrade: Use memcmp() instead of strcmp()
Currently our sysupgrade is comparing the calculated hash,
and referenced hash using strcmp(), A valid binary hash can
contain zeros or null, this can make strcmp() to stop when it
encounters a zero or null. To check the entire hash, not just
the bytes of the hash up to the first zero, we will use memcmp().

The existing code uses mbn_header->code_size for calculating
source offset from the image, this change adds mbn_header_size
for the calculation.

Change-Id: Iaae39d04e8e4aafc686a5acbc499b11b2b8d6602
Signed-off-by: Pavithra Palanisamy <pavip@codeaurora.org>
2017-10-16 10:59:25 +05:30
pavip
fb8e307bbc sysupgrade: Add support to process 64 bit image
The existing sysupgrade treats all images as 32-bit image.
This change adds a check to signify the image class and
adds functions to process the headers respectively.

Change-Id: I04040fdc6e1a9c6c2df2407cd4b26dddaf4a008c
Signed-off-by: Pavithra Palanisamy <pavip@codeaurora.org>
2017-10-13 20:05:52 +05:30
Gokul Sriram Palanisamy
767b457534 ipq807x: Fix KW issues in sysupgrade.c and cmd_bootqca.c
Change-Id: I665f3d596cf235be7347faf68f0bf1ea8b10de7a
Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
2017-09-07 04:17:41 -07:00
Sachin Sundar
1ed5f5b1a2 sysupgrade: Add sysupgrade support for signed images.
Change-Id: I2b4a5aeaa311e08ec59f70c3a9e3a88e11dc10f1
Signed-off-by: Sachin Sundar <ssundar@codeaurora.org>
2017-06-08 11:18:32 +05:30