I have to operate on Very large numbers may be 2048 bytes for implementation of RSA. 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.
So is there any library/method available that do not rely on libc and also manages such big numbers..? ???
I don't think you will find any decent big integer C library, that not use malloc
, calloc
and possibly realloc
or whatever dynamic allocation, because the whole point of arbitrary precision numbers is to go beyond limited, platform-dependent stack size and for second it's much more flexible method than compile-time static memory allocation.
My guess is to adapt mini-gmp
package to overcome your specific limitations. (you will find it under main directory along with some tests). It contains one header file and C-source file, so it should be a lot simpler to "cut-off" libc
dependency rather than fully-featured release, however it will be not that fast as GMP relies heavily on highly-optimized assembly code for various CPU architectues.
As suggested by kkrambo you may also try BigDigits
library with NO_ALLOCS
option, that is available since version 2.2:
Added the NO_ALLOCS option to compile the "mp" library without using any memory allocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With