Hello!
I wanna use AVRCrytoLib from http://www.emsign.nl/ with my arduino project. I use Arduino Duemilanove with 328p controller.
There is library with examples and documentation inside:
http://www.emsign.nl/Download/AVRCryptolib.zip
Everything is ok, but there is one compiler error:
USB_Token.cpp.o: In function `DesDes()':
USB_Token.cpp:43: undefined reference to `Des_Encrypt(unsigned char*, unsigned char*, unsigned char*)'
There is code of my project:
#include <AVRCrytolib.h>
unsigned char PROGMEM DesCryptographicKey[] ={
0x12,0x34,0x56,0x67,0x89,0xab,0xcd,0xef };
unsigned char PROGMEM DesPLAINTEXT[] ={
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08 };
unsigned char PROGMEM DesCIPHERTEXT[] ={
0xf2,0xac,0x1b,0xc6,0xbf,0x00,0x61,0xd3 };
unsigned char DesKey[8];
unsigned char DesPlain[8];
unsigned char DesCipher[8];
boolean a = false;
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
if (a == false) {
DesDes();
}
}
void DesDes() {
unsigned char ret=0;
digitalWrite(13, HIGH);
memcpy_P(DesKey,DesCryptographicKey, sizeof(DesKey));
memcpy_P(DesPlain,DesPLAINTEXT, sizeof(DesPlain));
memset(DesCipher,0,sizeof(DesCipher));
Des_Encrypt(DesPlain,DesCipher,DesKey);
if(memcmp_P(DesCipher,DesCIPHERTEXT,sizeof(DesCipher)))
{
ret|=0x01; // return the error
}
digitalWrite(13, LOW);
a = true;
}
Maybe someone could help me solve my problem?
Thank you.
Alex