1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * (C) Copyright 2014 Freescale Semiconductor, Inc. 4 * Author: Ruchika Gupta <ruchika.gupta@freescale.com> 5 */ 6 7#include <config.h> 8#include <common.h> 9#include <dm.h> 10#include <log.h> 11#include <u-boot/rsa-mod-exp.h> 12 13static 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 27static const struct mod_exp_ops mod_exp_ops_sw = { 28 .mod_exp = mod_exp_sw, 29}; 30 31U_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 38U_BOOT_DRVINFO(mod_exp_sw) = { 39 .name = "mod_exp_sw", 40}; 41