]> git.ipfire.org Git - people/ms/u-boot.git/blame - tools/rkimage.c
imx: hab: Check if CSF is valid before authenticating image
[people/ms/u-boot.git] / tools / rkimage.c
CommitLineData
a131c1f4
SG
1/*
2 * (C) Copyright 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 *
7 * See README.rockchip for details of the rkimage format
8 */
9
10#include "imagetool.h"
11#include <image.h>
7bf274b9 12#include "rkcommon.h"
a131c1f4
SG
13
14static uint32_t header;
15
a131c1f4
SG
16static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
17 struct image_tool_params *params)
18{
7bf274b9
JC
19 memcpy(buf + RK_SPL_HDR_START, rkcommon_get_spl_hdr(params),
20 RK_SPL_HDR_SIZE);
cfbcdade
HS
21
22 if (rkcommon_need_rc4_spl(params))
23 rkcommon_rc4_encode_spl(buf, 4, params->file_size);
a131c1f4
SG
24}
25
a131c1f4
SG
26static int rkimage_check_image_type(uint8_t type)
27{
28 if (type == IH_TYPE_RKIMAGE)
29 return EXIT_SUCCESS;
30 else
31 return EXIT_FAILURE;
32}
33
34/*
35 * rk_image parameters
36 */
37U_BOOT_IMAGE_TYPE(
38 rkimage,
39 "Rockchip Boot Image support",
40 4,
41 &header,
9217d93b 42 rkcommon_check_params,
253c60a5
PT
43 NULL,
44 NULL,
a131c1f4 45 rkimage_set_header,
253c60a5 46 NULL,
a131c1f4
SG
47 rkimage_check_image_type,
48 NULL,
49 NULL
50);