This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/CC2640: Very large number math library like GMP

Part Number: CC2640

Tool/software: TI C/C++ Compiler

Hey folks,

Anyone know of a TI C/C++ compatible large number library like GNU's GMP. One that works well with the TI compiler? I am performing a "power of" and modulus operation with integer numbers 16bytes in size.

  • Using CCS  Version: 8.1.0.00011 on a win10 PC
  • XDS200 debugger
  • ble_sdk_2_02_02_25_CC2640F128 stack
  • Custom board

Thanks,

Fred

  • Hi Fred,

    You could checkout CMSIS-DSP which have support for the Cortex-M3 ARM device (which the CC2640 is based on), maybe it could provide what you are looking for.
  • I've tried different big int packages and each one blows out the code space. I've looked at GMP, libzahl, imath, BigDigits-2.6.1, bignum-1.6.2, libtommath and every one is too much code.

    All I need to do is perform a exponentiation modulus with 16 byte coefficients.

    Base - 5 bit value (in 1 byte)
    Exponent - 128 bit value, 16 byte character array, big endian, less that Modulus
    Modulus - 128 bit value , 16 byte character array, big endian

    result = (Base ^ Exponent) % Modulus

    I'm new to this and I read this is somewhat like a RSA key. Does anyone know if the CryptoCC26XX lib can perform this type of operation?
  • Hi Fred,

    I would advice you to maybe check in to the stackoverflow forum, they might have some cool tricks up their sleeve for "low-cost" big math operations. In the end, if you are after a very specific use case, you are probably best of writing it yourself (or stripping out what you want from a bigger math library).

    Regarding the Crypto engine, I doubt that you could get it to do what you want. In the TRM you can find what operations the crypto engine can do (all crypto related, go figure :) ).