[U-Boot] [PATCH 7/9] [v3] lib/rsa: Add Kconfig option for HW accelerated RSA

Simon Glass
2014-12-29T20:28:54Z

Hi Ruchika,

On 29 December 2014 at 00:05, Ruchika Gupta <ruchika.gupta@freescale.com> wrote:
> Hi Simon,
>
>> -----Original Message-----
>> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
>> Sent: Wednesday, December 24, 2014 6:20 AM
>> To: Gupta Ruchika-R66431
>> Cc: U-Boot Mailing List; Sun York-R58495
>> Subject: Re: [PATCH 7/9] [v3] lib/rsa: Add Kconfig option for HW accelerated
>> RSA
>>
>> Hi Ruchika,
>>
>> On 23 December 2014 at 04:32, Ruchika Gupta <ruchika.gupta@freescale.com>
>> wrote:
>> > Kconfig option added for devices which support RSA Verification
>> > (Modular Exponentiation) operation in hardware
>> >
>> > Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
>> > CC: Simon Glass <sjg@chromium.org>
>> > ---
>> > Changes in v3:
>> > New patch
>> >
>> > lib/rsa/Kconfig | 23 ++++++++++++++++++++++-
>> > 1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> I think this needs tweaking such that RSA_SW is a driver (use RSA_SOFTWARE
>> might be better).
>>
>> For your freescale one, it should be RSA_FREESCALE_EXP or similar. We might
>> want to support multiple such devices. Don't use RSA_HW - that's not a
>> descriptive name.
> If we are using driver Model, can multiple devices be selected at the same time for the RSA_UCLASS ? I am little confused.

Yes, they can be accessed using uclass_get_device_by_seq() if they are
numbered in the aliases:

aliases {
mod_exp0 = "/path/to/hardware-node";
mod_exp1 = "/path/to/software-node";
}

or uclass_get_device() if there is no sequence numbering.

>
>>
>> >
>> > diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig index 8f9aa44..fc8a1e7
>> > 100644
>> > --- a/lib/rsa/Kconfig
>> > +++ b/lib/rsa/Kconfig
>> > @@ -11,7 +11,7 @@ if RSA && DM_RSA
>> >
>> > config RSA_SW
>> > bool "User driver Model for RSA Modular Exponentiation in software"
>> > - depends on DM && DM_RSA && RSA
>> > + depends on DM && DM_RSA && RSA && !RSA_HW
>>
>> You should drop the last term since it should be possible to have both
>> software and hardware.
> This option selects the driver model for RSA software implementation suing RSA uclass. If I define both I get this error :
>
> drivers/crypto/fsl/built-in.o:(.u_boot_list_2_driver_2_fsl_rsa+0x0): multiple definition of `_u_boot_list_2_driver_2_fsl_rsa'
> drivers/crypto/rsa/built-in.o:(.u_boot_list_2_driver_2_fsl_rsa+0x0): first defined here

Make sure you use a different name - it seems like you are using
fsl_rsa for both.

>
>>
>> > select RSA_MOD_EXP_SW
>> > default y
>> > help
>> > @@ -20,6 +20,27 @@ config RSA_SW
>> > input.
>> > See doc/uImage.FIT/signature.txt for more details.
>> >
>> > +menuconfig RSA_HW
>> > + bool "Use crypto devices to implement RSA Modular Exponentiation"
>> > + default y
>> > + help
>> > + Say Y here to get to see options for hardware crypto devices and
>> > + processors. This option alone does not enable the crypto device.
>> > +
>> > + If you say N,all options in this submenu will be skipped and
>> disabled.
>>
>> Space after N
>>
>> > +
>> > +if RSA_HW
>> > +
>> > +config FSL_RSA
>> > + bool "Implement RSA Modular Exponentiation with FSL crypto
>> accelerator"
>> > + depends on DM && DM_RSA && RSA && FSL_CAAM
>> > + default y
>> > + help
>> > + Enables driver for RSA modular exponentiation using Freescale's
>> > + cryptographic accelerator - CAAM.
>> > +
>> > +endif
>> > +
>> > endif
>> >
>> > config RSA_MOD_EXP_SW
>> > --
>> > 1.8.1.4
>> >

Regards,
Simon