Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way of doing multiprecision arithmetic(with integers that are greater than 64-bit) in msp430?

Tags:

c

gcc

gmp

msp430

relic

  • I'd like to know if there is any way, if possible any simple way, to do arithmetic with integers that are larger than 64-bit in size on MSP430?

I'm asking this specifically because I'm trying to implement encryption algorithms (RSA, AES, hash functions, digital signatures, etc.) on an msp430g2553 platform.

I searched through the internet, and through a misguided despair I installed linux distributions in order to use GMP but failed miserably. I installed Kali and then later Lubuntu on a USB(2.0) stick only to suffer through the unbearable freezes, with no clue on if it would work or not. Later on tried the magic of VMBox and things got way easier after that, though inconclusive. I eventually came to a point with mps430-gcc, and mspdebug that I could debug some example codes, and see them work, but still unable to do GMP operations due to mostly library errors (undefined reference to mpz_t init... etc.).

To my understanding GMP is a multiprecision arithmetic library to work on specific processor architectures, and MSP430 is not one of them, though, at this point, I'd not be surprised if it is one of them. Best answer I got was that some TI employee is unfamiliar with it. So;

  • Is it possible to use GMP on MSP430, or more specifically on msp430g2553?

I've hardly seen anything on google that has cross-reference of msp430 with gmp, and I'm at point that I'm trying to implement a miserable 64-bit key sized RSA that's barely working, if at all. So I hope this post, and its answers help someone, and hopefully to me as well, later on.

Also I forgot to mention, I've read about relic toolkit, (but didn't spend my time trying to implement it as GMP looked more like the standard in that area), and I'd like to know:

  • Is there a Relic guide for dummies that you can link, and again if it's possible to work with it on MSP430?

Thanks everyone.

like image 310
Nae Avatar asked Dec 28 '16 03:12

Nae


1 Answers

It is unlikely that any of these libraries can be compiled for an embedded 16-bit architecture.

The MSP430 CPU has add-with-carry and similar instructions, and that is how the compiler implements 32- and 64-bit integers. So it would be possible, in theory, to write these algorithms yourself, with lots of (inline) assembly. But I doubt that the G2553 has enough memory for this.

(There is a reason that some larger MSP430s have an AES hardware accelerator, and that none have one for RSA.)

like image 163
CL. Avatar answered Oct 03 '22 13:10

CL.