summaryrefslogtreecommitdiff
path: root/tools/rkcommon.h
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2017-02-18 19:46:27 +0100
committerSimon Glass <sjg@chromium.org>2017-03-16 16:03:44 -0600
commitcfbcdade763c87c7dde52020b8b98d399540ede2 (patch)
tree43917a090f0f48f4d076f2483f11392cee5f3384 /tools/rkcommon.h
parentaade077e431b584980a0418c0e464f6ef31c5c20 (diff)
rockchip: mkimage: Allow encoding of loader code in spl images
Rockchip SoCs allow the spl code to be rc4-encoded, not only the image header, but only newer SoCs allow this encoding to be disabled. The rk3188 is not part of those and requires its boot code to be rc4-encoded with the regular key. So add the ability to do this encoding via a setting on a per-soc basis when building spl images. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Tested-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'tools/rkcommon.h')
-rw-r--r--tools/rkcommon.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/rkcommon.h b/tools/rkcommon.h
index c69540f5f3..b4f6f327dc 100644
--- a/tools/rkcommon.h
+++ b/tools/rkcommon.h
@@ -55,4 +55,26 @@ int rkcommon_get_spl_size(struct image_tool_params *params);
int rkcommon_set_header(void *buf, uint file_size,
struct image_tool_params *params);
+/**
+ * rkcommon_need_rc4_spl() - check if rc4 encoded spl is required
+ *
+ * Some socs cannot disable the rc4-encryption of the spl binary.
+ * rc4 encryption is disabled normally except on socs that cannot
+ * handle unencrypted binaries.
+ * @return true or false depending on rc4 being required.
+ */
+bool rkcommon_need_rc4_spl(struct image_tool_params *params);
+
+/**
+ * rkcommon_rc4_encode_spl() - encode the spl binary
+ *
+ * Encrypts the SPL binary using the generic rc4 key as required
+ * by some socs.
+ *
+ * @buf: Pointer to the SPL data (header and SPL binary)
+ * @offset: offset inside buf to start at
+ * @size: number of bytes to encode
+ */
+void rkcommon_rc4_encode_spl(void *buf, unsigned int offset, unsigned int size);
+
#endif