Skip to contentSkip to conversation

RSA

DISCUSSION kartikey bhatt 2 participants 2 messages Jun 22, 2004

lore
Share & tools
lore
#0 lore raw

hey i am gonna look at the code right now.
will keep in touch.

"Tom has indicated a few ways to go about this which I will send you." waiting for details.

Joy Latten <[email protected]> wrote

Quoted 13 lines

Great!!

Our current goal is to just add RSA encryption and decryption to the kernel. We are interested in porting the bignum/mpi and rsa implementations from libtomcrypt, http://www.libtomcrypt.org.
When I say we, I am referring to myself and my coworker, Serge Hallyn. You have probably seen a few notes between Serge and Tom, libtomcrypt's author, on lkml about RSA.

Tom has indicated that the mpi will perhaps need some work in lower stack usage (mp_extpmod uses a bit), lower heap usage
where possible, and remove any non-supported opcodes (e.g. integer division).

Quoted 39 lines

Tom has indicated a few ways to go about this which I will send you.

Let me know when you get to take a look at the code. If you have any questions, please let me know. Thanks!!

Joy

Quoted 30 lines

I would like to work on coding of algorithms and
especially developing mpi_t for kernel.

Kartikey

Quoted 24 lines

From: Joy Latten <[email protected]>
To: [email protected]
CC: [email protected], [email protected]
Subject: Re: RSA
Date: Fri, 18 Jun 2004 21:56:10 -0500

Great!! Thanks! What are you interested in doing?

Joy
-------------------------------------------------------------

i would like to contribute.

On Tue, 15 Jun 2004, Joy Latten wrote:

Is anyone working on implementing RSA encryption/decryption into the kernel's cryptoapi? If not, I was considering starting such a project.

James wrote:

Not that I know of. Would you be looking at this in terms of a generic asymmetric crypto API?

_________________________________________________________________
Pay Cash on delivery on lakhs of products. http://go.msnserver.com/IN/50757.asp Only on Baazee.com

#1 lore raw
Quoted 6 lines · --- kartikey bhatt

hey i am gonna look at the code right now.
will keep in touch.

"Tom has indicated a few ways to go about this which I will send you."
waiting for details.

Um to clear up something here. Joy and Serge are going to be the developers on this module. I'm just helping out where I can with my knowledge of crypto/math/LibTom internals.

Specifically a good starting place is to rip "mpi.c" out of LibTomCrypt and start stripping it down. You don't need things like the Karatsuba/Toom-Cook multipliers, Jacobi symbol, various prime functions [next_prime, fermat testing, etc]. You won't need the diminished radix and Barrett reduction algorithms, etc, etc, etc.

In a recent project [see my C.V. for details] I managed to get a "optimized for size" mpi.c down from 29KB to 5KB on an x86 with GCC.

Naturally this won't be that small since you want to leave in things like the Comba mult/sqr algorithms and the full exptmod routine. But definitely around 7-10KB is possible on the x86.

Then of course you have the RSA routines on top of that. Depending on whether you need PKCS #1 v2 or v1.5 you can do one of two things. I have both v2 and v1.5 padding in LibTomCrypt [and specifically in the v0.97 release I reduced the stack usage to way south of 4KB]. So if you're using v1.5 you'll have to write your own rsa encrypt/sign code [I have a key-gen and CRT optimized exptmod you can rip off].

On the plus side all of my code is ISO C portable, thread safe and well tested [been used by quite a few people]. There are enough goodies in LibTomCrypt to make this happen and you're all entitled to rip/relicense as required ;-)

Tom

__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail