hmac_sha256 and microcoap example

Hi everyone

I use hmac_sha256 function in microcoap example ( to be more specific I call it in an endopoint I create in coap.c file )

I am using STM32F401RE nucleo board

I want to use a key 64 bytes and I want to call hmac fuction.

But when I run it on the board and send a url from coap_client a get an error for stack overflow.

2016-04-08 15:27:29,948 - INFO # Waiting for incoming UDP packet... 2016-04-08 15:27:33,735 - INFO # Received packet: 40 01 35 4E B4 68 6D 61 63 07 6D 65 73 73 61 67 65 2016-04-08 15:27:33,735 - INFO # content: 2016-04-08 15:27:33,736 - INFO # Header: 2016-04-08 15:27:33,736 - INFO # ver 0x01 2016-04-08 15:27:33,736 - INFO # t 0x01 2016-04-08 15:27:33,736 - INFO # tkl 0x00 2016-04-08 15:27:33,736 - INFO # code 0x01 2016-04-08 15:27:33,741 - INFO # id 0x354E 2016-04-08 15:27:33,741 - INFO # Options: 2016-04-08 15:27:33,747 - INFO # 0x0B [ 68 6D 61 63 ] 2016-04-08 15:27:33,747 - INFO # 0x0B [ 6D 65 73 73 61 67 65 ] 2016-04-08 15:27:33,747 - INFO # Payload: 2016-04-08 15:27:33,747 - INFO # Se 2016-04-08 15:27:33,748 - INFO # Context before hardfault: 2016-04-08 15:27:33,748 - INFO # 2 r0: 0x200002f8 2016-04-08 15:27:33,753 - INFO # r1: 0x10fec917 2016-04-08 15:27:33,753 - INFO # r2: 0x200002f8 2016-04-08 15:27:33,753 - INFO # r3: 0x20000184 2016-04-08 15:27:33,754 - INFO # r12: 0x10080286 2016-04-08 15:27:33,759 - INFO # lr: 0x08000279 2016-04-08 15:27:33,759 - INFO # pc: 0x080004b8 2016-04-08 15:27:33,760 - INFO # psr: 0x0100000e 2016-04-08 15:27:33,760 - INFO # 2016-04-08 15:27:33,760 - INFO # FSR/FAR: 2016-04-08 15:27:33,765 - INFO # CFSR: 0x01000000 2016-04-08 15:27:33,771 - INFO # HFSR: 0x40000000 2016-04-08 15:27:33,771 - INFO # DFSR: 0x00000008 2016-04-08 15:27:33,772 - INFO # AFSR: 0x00000000 2016-04-08 15:27:33,772 - INFO # Misc 2016-04-08 15:27:33,772 - INFO # EXC_RET: 0xfffffff1 2016-04-08 15:27:33,773 - INFO # Attempting to reconstruct state for debugging... 2016-04-08 15:27:33,777 - INFO # In GDB: 2016-04-08 15:27:33,777 - INFO # set $pc=0x80004b8 2016-04-08 15:27:33,777 - INFO # frame 0 2016-04-08 15:27:33,778 - INFO # bt 2016-04-08 15:27:33,778 - INFO # 2016-04-08 15:27:33,783 - INFO # ISR stack overflowed by at least 40 bytes.

When I use a key for 4-8-16-32 bytes it run perfectly on board ( I send a request from coap-client and I get an response )

I tried to see if it is a problem of hmac_sha256 so I create an example ( main.c ) for my board to use it without microcoap and it runs without any problem in 64 bytes.

Is there a limitation on bytes can use in endpoint microcoap?

coap.c (4.63 KB)

main.c (1.74 KB)