dma: ti: k3-udma: Fix rflow reservation for PKTDMA
[platform/kernel/u-boot.git] / drivers / crypto / rsa_mod_exp / mod_exp_uclass.c
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 #define LOG_CATEGORY UCLASS_MOD_EXP
8
9 #include <common.h>
10 #include <dm.h>
11 #include <asm/global_data.h>
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 #if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
20 DECLARE_GLOBAL_DATA_PTR;
21 #endif
22
23 int rsa_mod_exp(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
24                 struct key_prop *node, uint8_t *out)
25 {
26         struct mod_exp_ops *ops = (struct mod_exp_ops *)device_get_ops(dev);
27
28 #if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
29         static bool done;
30
31         if (!done) {
32                 done = true;
33                 ops->mod_exp += gd->reloc_off;
34         }
35 #endif
36
37         if (!ops->mod_exp)
38                 return -ENOSYS;
39
40         return ops->mod_exp(dev, sig, sig_len, node, out);
41 }
42
43 UCLASS_DRIVER(mod_exp) = {
44         .id             = UCLASS_MOD_EXP,
45         .name           = "rsa_mod_exp",
46 };