mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
This patch does the following: 1. The function names for encapsulation and decapsulation were inconsitent in freescale's implementation and cmd_blob file. This patch corrects the issues. 2. The function protopye is also modified to change the length parameter from u8 to u32 to allow encapsulation and decapsulation of larger images. 3. Modified the description of km paramter in the command usage for better readability. Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com> Reviewed-by: Ruchika Gupta <ruchika.gupta@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
61 lines
1.2 KiB
C
61 lines
1.2 KiB
C
/*
|
|
* Copyright 2014 Freescale Semiconductor, Inc.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <malloc.h>
|
|
#include "jobdesc.h"
|
|
#include "desc.h"
|
|
#include "jr.h"
|
|
|
|
int blob_decap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
|
|
{
|
|
int ret, i = 0;
|
|
u32 *desc;
|
|
|
|
printf("\nDecapsulating data to form blob\n");
|
|
desc = malloc(sizeof(int) * MAX_CAAM_DESCSIZE);
|
|
if (!desc) {
|
|
debug("Not enough memory for descriptor allocation\n");
|
|
return -1;
|
|
}
|
|
|
|
inline_cnstr_jobdesc_blob_decap(desc, key_mod, src, dst, len);
|
|
|
|
for (i = 0; i < 14; i++)
|
|
printf("%x\n", *(desc + i));
|
|
ret = run_descriptor_jr(desc);
|
|
|
|
if (ret)
|
|
printf("Error in Decapsulation %d\n", ret);
|
|
|
|
free(desc);
|
|
return ret;
|
|
}
|
|
|
|
int blob_encap(u8 *key_mod, u8 *src, u8 *dst, u32 len)
|
|
{
|
|
int ret, i = 0;
|
|
u32 *desc;
|
|
|
|
printf("\nEncapsulating data to form blob\n");
|
|
desc = malloc(sizeof(int) * MAX_CAAM_DESCSIZE);
|
|
if (!desc) {
|
|
debug("Not enough memory for descriptor allocation\n");
|
|
return -1;
|
|
}
|
|
|
|
inline_cnstr_jobdesc_blob_encap(desc, key_mod, src, dst, len);
|
|
for (i = 0; i < 14; i++)
|
|
printf("%x\n", *(desc + i));
|
|
ret = run_descriptor_jr(desc);
|
|
|
|
if (ret)
|
|
printf("Error in Encapsulation %d\n", ret);
|
|
|
|
free(desc);
|
|
return ret;
|
|
}
|