mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-25 12:33:41 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (C) Copyright 2014 Freescale Semiconductor, Inc.
|
|
* Author: Ruchika Gupta <ruchika.gupta@freescale.com>
|
|
*/
|
|
|
|
#include <config.h>
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <asm/types.h>
|
|
#include <malloc.h>
|
|
#include "jobdesc.h"
|
|
#include "desc.h"
|
|
#include "jr.h"
|
|
#include "rsa_caam.h"
|
|
#include <u-boot/rsa-mod-exp.h>
|
|
|
|
int fsl_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
|
|
struct key_prop *prop, uint8_t *out)
|
|
{
|
|
uint32_t keylen;
|
|
struct pk_in_params pkin;
|
|
uint32_t desc[MAX_CAAM_DESCSIZE];
|
|
int ret;
|
|
|
|
/* Length in bytes */
|
|
keylen = prop->num_bits / 8;
|
|
|
|
pkin.a = sig;
|
|
pkin.a_siz = sig_len;
|
|
pkin.n = prop->modulus;
|
|
pkin.n_siz = keylen;
|
|
pkin.e = prop->public_exponent;
|
|
pkin.e_siz = prop->exp_len;
|
|
|
|
inline_cnstr_jobdesc_pkha_rsaexp(desc, &pkin, out, sig_len);
|
|
|
|
ret = run_descriptor_jr(desc);
|
|
if (ret) {
|
|
debug("%s: RSA failed to verify: %d\n", __func__, ret);
|
|
return -EFAULT;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct mod_exp_ops fsl_mod_exp_ops = {
|
|
.mod_exp = fsl_mod_exp,
|
|
};
|
|
|
|
U_BOOT_DRIVER(fsl_rsa_mod_exp) = {
|
|
.name = "fsl_rsa_mod_exp",
|
|
.id = UCLASS_MOD_EXP,
|
|
.ops = &fsl_mod_exp_ops,
|
|
.flags = DM_FLAG_PRE_RELOC,
|
|
};
|
|
|
|
U_BOOT_DEVICE(fsl_rsa) = {
|
|
.name = "fsl_rsa_mod_exp",
|
|
};
|