# ECC under FreeRTOS

**URL:** <https://forums.freertos.org/t/ecc-under-freertos/5173>\
**Category:** Kernel\
**Created:** [October 30, 2008, 8:58am UTC](https://forums.freertos.org/t/ecc-under-freertos/5173 "2008-10-30T08:58:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 30, 2008, 8:58am UTC](https://forums.freertos.org/t/ecc-under-freertos/5173/1 "2008-10-30T08:58:38Z")

</div>

**[winequarter](https://sourceforge.net/u/winequarter/)** wrote on [Thursday, October 30, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e45f6c46/#9d66):

Hi!

Does anyone have experience with Elliptic Curve Crpytography running under FreeRTOS? I’m currently working with an AT91SAM7X256 (ARM7TDMI). I tried to do some encryption with the MIRACL library from [http://www.shamus.ie](http://www.shamus.ie). There are no problems with “simple” operations with big numbers, e.g. the calculation of 50!. But when I try to execute an elliptic curve operation, everything stands still ☹  
The encryption works without FreeRTOS.

So has anyone experienced with this topic. Of course, it is also possible to use some other library - I’m not tied up to MIRACL.

Thanks

daniel

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 30, 2008, 9:15am UTC](https://forums.freertos.org/t/ecc-under-freertos/5173/2 "2008-10-30T09:15:43Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Thursday, October 30, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e45f6c46/#9d66/d21d):

I dont know about ECC, but a few pointers to look at first.

Does the algorithm use a lot of stack?&nbsp; Stack overflow is the most common problem.&nbsp; FreeRTOS includes some utilities to detect stack overflow.

Does the algorithm do anything using global variables, or is it in any other way not re entrant?&nbsp; If so then you will have to use guards if accessing the library from more than one task.

Does the algorithm attempt to perform any dynamic memory allocation using malloc? If so then you will need to ensure your linker script allocates a heap, or replace calls to malloc with pvPortMalloc().

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 30, 2008, 3:47pm UTC](https://forums.freertos.org/t/ecc-under-freertos/5173/3 "2008-10-30T15:47:55Z")

</div>

**[winequarter](https://sourceforge.net/u/winequarter/)** wrote on [Thursday, October 30, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e45f6c46/#9d66/174a):

Hi Dave!

Thanks a lot for your hints! I think, the library uses a lot of stack. I tried to dramatically reduce the memory-consumption of FreeRTOS and my program. I decreased the Heap-Size and disabled every unused part.  
I tried to announce a StackOverflow with vApplicationStackOverflowHook but without success (there is no announcement). (configCHECK\_FOR\_STACK\_OVERFLOW is set to 2).

The Lib has some switches which prevents it to allocate any vars. So everything is static and on the stack. It’s used in only one thread. So I think there should not be a problem with reentrance or global variables.

I’m on my wits’ end. What else can i do to analyze the problem?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 30, 2008, 4:07pm UTC](https://forums.freertos.org/t/ecc-under-freertos/5173/4 "2008-10-30T16:07:38Z")

</div>

**[edwards3](https://sourceforge.net/u/edwards3/)** wrote on [Thursday, October 30, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e45f6c46/#9d66/174a/8cee):

Did you increase the stack allocated to the task in the call to xTaskCreate?

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [October 31, 2008, 12:14pm UTC](https://forums.freertos.org/t/ecc-under-freertos/5173/5 "2008-10-31T12:14:10Z")

</div>

**[winequarter](https://sourceforge.net/u/winequarter/)** wrote on [Friday, October 31, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/e45f6c46/#9d66/174a/8cee/1b24):

Of course, I did not ;(  
But again, my program is not running. I think I have to try a bare-metal implementation for this problem. But I’ll keep at it and will try other things with FreeRTOS. I’m still impressed… 🙂
