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