X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tools%2Frkcommon.h;h=a21321fe83abddaea0afd65b34f91f2f960c7fb9;hb=896d2e82e6d408f6885ae000b707710e0f1a17fc;hp=c69540f5f38a35cab4bd9566af073716175e2139;hpb=f1993ca066100fcaba7d49fecae0ef604e5807e2;p=u-boot diff --git a/tools/rkcommon.h b/tools/rkcommon.h index c69540f5f3..a21321fe83 100644 --- a/tools/rkcommon.h +++ b/tools/rkcommon.h @@ -55,4 +55,42 @@ 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); + +/** + * rkcommon_vrec_header() - allocate memory for the header + * + * @params: Pointer to the tool params structure + * @tparams: Pointer tot the image type structure (for setting + * the header and header_size) + * @alignment: Alignment (a power of two) that the image should be + * padded to (e.g. 512 if we want to align with SD/MMC + * blocksizes or 2048 for the SPI format) + * + * @return bytes of padding required/added (does not include the header_size) + */ +int rkcommon_vrec_header(struct image_tool_params *params, + struct image_type_params *tparams, + unsigned int alignment); + #endif