Go Down

Topic: Implementing Pairing Based Crypto on arduino uno (Read 798 times) previous topic - next topic

simsam

I have implemented Digital Signature using PBC  and GMP libraries.( I have taken the code from the PBC library as liked above.)My code works correctly when i compile it on Visual Studios 2010.

Now i have to convert it and make it work on my arduino uno. For this i have used Visual Micro plugin. (i am able to run the arduino builtin examples from this) but the pbc code is causing alot of errors. The error log is attached below. I dont know what changes to make in the code to make it run in the arduino.

Code: [Select]
Error   1   10:23: fatal error: WinSDKVer.h: No such file or directory  C:\Users\name\Documents\Arduino\ArduinoClient\targetver.h   10 
3   IntelliSense: expected an identifier    c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winuser.h   5341    3   
35  IntelliSense: identifier "EBADMSG" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 31  16 
42  IntelliSense: identifier "ECANCELED" is undefined   c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 78  23 
36  IntelliSense: identifier "EIDRM" is undefined   c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 47  23 
38  IntelliSense: identifier "ENODATA" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 63  25 
37  IntelliSense: identifier "ENOLINK" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 61  12 
39  IntelliSense: identifier "ENOSR" is undefined   c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 67  24 
40  IntelliSense: identifier "ENOSTR" is undefined  c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 74  17 
45  IntelliSense: identifier "ENOTRECOVERABLE" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 91  26 
41  IntelliSense: identifier "ENOTSUP" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 77  18 
48  IntelliSense: identifier "EOVERFLOW" is undefined   c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 99  20 
43  IntelliSense: identifier "EOWNERDEAD" is undefined  c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 83  15 
44  IntelliSense: identifier "EPROTO" is undefined  c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 85  19 
46  IntelliSense: identifier "ETIME" is undefined   c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 92  19 
47  IntelliSense: identifier "ETXTBSY" is undefined c:\program files (x86)\microsoft visual studio 10.0\vc\include\system_error 93  19 
49  IntelliSense: identifier "pairing_t" is undefined   c:\libs\pbc\include\pbc_test.h  10  42 
4   IntelliSense: invalid combination of type specifiers    c:\program files (x86)\microsoft visual studio 10.0\vc\include\yvals.h  536 14 
2   IntelliSense: invalid redeclaration of member function "HardwareSerial::write(uint8_t)" (declared at line 129)  c:\program files (x86)\arduino\hardware\arduino\avr\cores\arduino\hardwareserial.h  132 19  ArduinoClient
5   IntelliSense: the global scope has no "acosl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    28  13 
6   IntelliSense: the global scope has no "asinl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    28  32 
8   IntelliSense: the global scope has no "atan2l"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    29  32 
7   IntelliSense: the global scope has no "atanl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    29  13 
9   IntelliSense: the global scope has no "ceill"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    29  52 
11  IntelliSense: the global scope has no "coshl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    30  31 
10  IntelliSense: the global scope has no "cosl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    30  13 
12  IntelliSense: the global scope has no "expl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    30  50 
13  IntelliSense: the global scope has no "fabsl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    31  13 
14  IntelliSense: the global scope has no "floorl"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    31  32 
15  IntelliSense: the global scope has no "fmodl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    31  52 
16  IntelliSense: the global scope has no "frexpl"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    32  13 
17  IntelliSense: the global scope has no "ldexpl"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    32  33 
33  IntelliSense: the global scope has no "llabs"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  34  13 
34  IntelliSense: the global scope has no "lldiv"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  34  32 
32  IntelliSense: the global scope has no "lldiv_t" c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  32  13 
19  IntelliSense: the global scope has no "log10l"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    33  13 
18  IntelliSense: the global scope has no "logl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    32  53 
27  IntelliSense: the global scope has no "mblen"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  26  13 
28  IntelliSense: the global scope has no "mbstowcs"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  26  32 
29  IntelliSense: the global scope has no "mbtowc"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  26  54 
20  IntelliSense: the global scope has no "modfl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    33  33 
21  IntelliSense: the global scope has no "powl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    33  52 
23  IntelliSense: the global scope has no "sinhl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    34  31 
22  IntelliSense: the global scope has no "sinl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    34  13 
24  IntelliSense: the global scope has no "sqrtl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    34  50 
26  IntelliSense: the global scope has no "tanhl"   c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    35  31 
25  IntelliSense: the global scope has no "tanl"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath    35  13 
30  IntelliSense: the global scope has no "wcstombs"    c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  30  13 
31  IntelliSense: the global scope has no "wctomb"  c:\program files (x86)\microsoft visual studio 10.0\vc\include\cstdlib  30  35

MarkT

It won't fit on a tiny microcontroller with 2k of SRAM.  (without miraculous coding skills!)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

simsam

#2
May 17, 2018, 02:01 pm Last Edit: May 17, 2018, 02:06 pm by simsam
It won't fit on a tiny microcontroller with 2k of SRAM.  (without miraculous coding skills!)
Thanks for replying.
Is there any way to increase the SRAM?

I only want to run the signature generation part of the PBC code on arduino. The verification part will be run on my server.

MarkT

Use a bigger microcontroller - first you need to find out what memory / code space is needed for that
library - perhaps compile for something else and look at verbose compiler/linker output.

I suspect you're definitely in 32 bit processor, 100MHz+ territory.

What are you trying to secure?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

gfvalvo

No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

simsam

I am reading data of a sensor. And i want to attach a digital signature to it before sending it off to my server. For this i used PBC.

I got alot of errors when i compiled the code as pasted above.

simsam


MarkT

I am reading data of a sensor. And i want to attach a digital signature to it before sending it off to my server. For this i used PBC.

I got alot of errors when i compiled the code as pasted above.
A digital signature is not the right primitive I think - a simple MAC is how to authenticate messages to a server.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

simsam

#8
May 17, 2018, 05:03 pm Last Edit: May 17, 2018, 05:05 pm by simsam
A digital signature is not the right primitive I think - a simple MAC is how to authenticate messages to a server.
Yes you are right a MAC will be enough for authentication, but it is a requirement of my project to use digital signatures.
This is mainly to ensure data integrity, and to prevent any tampering of data.
Whatever data is collected by the sensors it must be signed and then transmitted.

MarkT

Quote
This is mainly to ensure data integrity, and to prevent any tampering of data.
In what way does a MAC not perform this task?  A signature binds a person to a document, that's
rather different.  (Well it need not be a person, its usually a certification authority).

A requirement is not the same thing as a technique.  The requirement is to prevent tampering,
not the technique chosen to satisfy the requirement.  Sounds like you've been ordered to
do something a particular way, not given a set of functional requirements!

Asymmetric crypto with public key management infrastructure is much more heavyweight than
shared-secret crypto, and is not normally doable on a tiny microcontroller.  Yes, that means
a microcontroller is more limited in its options, and that you'd better have distinct shared
secrets for each client.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

simsam

#10
May 17, 2018, 08:17 pm Last Edit: May 17, 2018, 10:20 pm by simsam
A requirement is not the same thing as a technique.  The requirement is to prevent tampering,
not the technique chosen to satisfy the requirement.  Sounds like you've been ordered to
do something a particular way, not given a set of functional requirements!

Sorry i think i didnt use the correct word, i should have used technique instead of requirement.
Though what you're saying is absolutely correct, the thing is that my supervisor has told me to use PBC here, i cant use an alternative.


Asymmetric crypto with public key management infrastructure is much more heavyweight than
shared-secret crypto, and is not normally doable on a tiny microcontroller.  Yes, that means
a microcontroller is more limited in its options, and that you'd better have distinct shared
secrets for each client.
Yes i understand that asymmetric crypto is more heavy weight, is there no way to implement this at all? What if i were to change from UNO to MEGA? Even that wouldnt suffice?

simsam

Also, is the memory limitations a major issue here or the computational capabilities of the microcontroller?  I read in an article that a SD card may be used to increase the SRAM. Is that possible?

gfvalvo

Also, is the memory limitations a major issue here or the computational capabilities of the microcontroller?  I read in an article that a SD card may be used to increase the SRAM. Is that possible?
Why would you even consider such extremes just to stay with an 8-bit processor? It's already been suggested (twice) that you move to a 32-bit machine.
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

simsam

Why would you even consider such extremes just to stay with an 8-bit processor? It's already been suggested (twice) that you move to a 32-bit machine.
I looked it up and found arduino Due, it has a 32-bit processor.
Should i go ahead and buy it if this code will execute on it.

MorganS

So, check if the code fits by looking at it. Does it assign any large buffers? How big are they?

Program storage is unlikely to be the issue, so you don't need to know how may bytes the program itself takes, just its SRAM storage while it's running.
"The problem is in the code you didn't post."

Go Up