Home | History | Annotate | Download | only in rsa_mod_exp
      1 // SPDX-License-Identifier: GPL-2.0+
      2 /*
      3  * (C) Copyright 2014 Freescale Semiconductor, Inc.
      4  * Author: Ruchika Gupta <ruchika.gupta (at) freescale.com>
      5  */
      6 
      7 #include <config.h>
      8 #include <common.h>
      9 #include <dm.h>
     10 #include <u-boot/rsa-mod-exp.h>
     11 
     12 int mod_exp_sw(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
     13 		struct key_prop *prop, uint8_t *out)
     14 {
     15 	int ret = 0;
     16 
     17 	ret = rsa_mod_exp_sw(sig, sig_len, prop, out);
     18 	if (ret) {
     19 		debug("%s: RSA failed to verify: %d\n", __func__, ret);
     20 		return ret;
     21 	}
     22 
     23 	return 0;
     24 }
     25 
     26 static const struct mod_exp_ops mod_exp_ops_sw = {
     27 	.mod_exp	= mod_exp_sw,
     28 };
     29 
     30 U_BOOT_DRIVER(mod_exp_sw) = {
     31 	.name	= "mod_exp_sw",
     32 	.id	= UCLASS_MOD_EXP,
     33 	.ops	= &mod_exp_ops_sw,
     34 	.flags	= DM_FLAG_PRE_RELOC,
     35 };
     36 
     37 U_BOOT_DEVICE(mod_exp_sw) = {
     38 	.name = "mod_exp_sw",
     39 };
     40