Searching for Embedded C library to operate on Big numbers which do not use standard libc?

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Fri May 30 16:58:03 UTC 2014


Ciao,

Il Ven, 30 Maggio 2014 8:24 am, Dharmik Brahmbhatt ha scritto:
> I have to operate on Very large numbers may be 2048 bytes for
> implementation of RSA.

You mean 2048 bits, don't you?

I remember a message of yours where you asked for a way to use the GMP abi
without installing GMP... A possible solution can be mini-GMP.
You find it in the sources of the GMP library, under the mini-gmp directory.
It consists of a README file, a .h and a .c source files (plus a
test-suite that may not be easily portable to your embedded environment).

Beware! It's not intended as an embeddable implementation of cryptographic
primitives, but as a small-footprint generic library for arithmetic with
big-numbers (not side-channel silent, nor optimised for crypto needs). But
you can play with it to quickly implement a working algorithm.

> As per the rules of Automotive domain i cant use
> bignum library which uses standard libc. I have searched for GMP and
> Polarssl but they all uses malloc() and other things.

Also mini-gmp uses malloc/realloc/free, but you will find them in just
three functions, you can replace them with the memory management you
prefer.

libc is not used for computations, its use is limited to some output
functions (e.g. mpz_out_str), or error "handling" (gmp_die?), but it
should not be too difficoult to to remove those calls... It's less than 5k
lines of code, and you do not need to keep all of them...

Regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-discuss mailing list