Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Ruchika Gupta | 31d2b4f | 2015-01-23 16:01:52 +0530 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2014 Freescale Semiconductor, Inc |
| 4 | * Author: Ruchika Gupta <ruchika.gupta@freescale.com> |
Ruchika Gupta | 31d2b4f | 2015-01-23 16:01:52 +0530 | [diff] [blame] | 5 | */ |
| 6 | |
Patrick Delaunay | b953ec2 | 2021-04-27 11:02:19 +0200 | [diff] [blame] | 7 | #define LOG_CATEGORY UCLASS_MOD_EXP |
| 8 | |
Ruchika Gupta | 31d2b4f | 2015-01-23 16:01:52 +0530 | [diff] [blame] | 9 | #include <common.h> |
| 10 | #include <dm.h> |
Simon Glass | 401d1c4 | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 11 | #include <asm/global_data.h> |
Ruchika Gupta | 31d2b4f | 2015-01-23 16:01:52 +0530 | [diff] [blame] | 12 | #include <u-boot/rsa-mod-exp.h> |
| 13 | #include <errno.h> |
| 14 | #include <fdtdec.h> |
| 15 | #include <malloc.h> |
| 16 | #include <asm/io.h> |
| 17 | #include <linux/list.h> |
| 18 | |
| 19 | int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len, |
| 20 | struct key_prop *node, uint8_t *out) |
| 21 | { |
T Karthik Reddy | ef92ed2 | 2019-03-16 15:23:02 +0530 | [diff] [blame] | 22 | struct mod_exp_ops *ops = (struct mod_exp_ops *)device_get_ops(dev); |
| 23 | |
Ruchika Gupta | 31d2b4f | 2015-01-23 16:01:52 +0530 | [diff] [blame] | 24 | if (!ops->mod_exp) |
| 25 | return -ENOSYS; |
| 26 | |
| 27 | return ops->mod_exp(dev, sig, sig_len, node, out); |
| 28 | } |
| 29 | |
| 30 | UCLASS_DRIVER(mod_exp) = { |
| 31 | .id = UCLASS_MOD_EXP, |
| 32 | .name = "rsa_mod_exp", |
| 33 | }; |