Thanks for the reply.
The problem persists, and I think is because it is still makes the call to wc_generateSeed. The problem I don't know where the call occurs because I do not do directly. Besides, I can not quite fully understand the complex structure of wolfssl.
I know it sounds silly, but could you tell me where in my code makes the call to wc_generateSeed and try to change that part of the library?

Finally! It works perfectly.
Thanks very much really.

I am somewhat newbie and do not know how to carry out the second solution. Regarding the first solution I think placed correctly references, this since I am able to make the call to "wc_InitRng". I have included "random.h", but the result is the same.

Can you be more specific about how to define my own "CUSTOM_RAND_GENERATE_SEED" with an example?

Hi, I'm trying to test RSA encryption arduino.
Libs have imported correctly, but when I try to run the example I get the error:

"C: \ Users \ Eugenio \ AppData \ Local \ Temp \ ccDlIFnm.ltrans0.ltrans.o: In function` loop ':

: ( ccDlIFnm.ltrans0.o text + 0xc6c.): undefined reference to `wc_GenerateSeed '

collect2.exe: error: ld returned 1 exit status"

This is my code:

#include <wolfssl.h>
#include <wolfssl/wolfcrypt/rsa.h>

void setup(void){

  while(!Serial);
  Serial.begin(9600);
}
 
void loop(void){

RsaKey rsaPublicKey;
byte publicKeyBuffer[]  = {"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL+pEyWGAfj8NRW03Ox55IXMCLwCm1EjQ0mwonOjazvAkkwLSthUPmaCq2/A01843K3zqN40dslDUwYlfAg9hC8CAwEAAQ=="}; // holds the raw data from the key, maybe from a file like RsaPublicKey.der 
word32 idx = 0;             //  where to start reading into the buffer
byte in[] = {"hola mundohola mundohola mundoho"};
byte out[128];
RNG rng;
wc_InitRng(&rng);


wc_RsaPublicKeyDecode(publicKeyBuffer, &idx, &rsaPublicKey, sizeof(publicKeyBuffer));
word32 outLen = wc_RsaPublicEncrypt(in, sizeof(in), out, sizeof(out), &rsaPublicKey, &rng);

delay(3000);
}

Can you give me a hand?

Hi Kaleb, do we have some news?

6

(3 replies, posted in wolfCrypt)

Hi, I followed the examples from wolfssl documentation to use AES. -> https://www.wolfssl.com/wolfSSL/Docs-wo … ence.html.

After executing this code:

#include <wolfssl.h>
#include <wolfssl/wolfcrypt/aes.h>

int x = 0;
 
void setup(void){

  while(!Serial);
  Serial.begin(9600);
}
 
void loop(void){

//AES block
Aes enc;
Aes dec;

byte key[] = {"1234567890abcdef"};

byte iv[]  = {"1234567890abcdef"};

byte plain[32]  = {"Hola mundoHola mundoHola mundo"};   // an increment of 16, fill with data
byte plain2[32];
byte cipher[32];

Serial.print("plain value  ");

for(x=0; x<32; x++){
  Serial.print(plain[x], HEX);
  Serial.print(" ");
  }
Serial.println(" ");


Serial.print("printing key value ");

for(x=0; x<32; x++){
  Serial.print(key[x], HEX);
  Serial.print(" ");
  }
Serial.println(" ");


Serial.print("printing iv value ");
for(x=0; x<32; x++){
  Serial.print(iv[x], HEX);
  Serial.print(" ");
  }

Serial.println(" ");

//encrypt
wc_AesSetKey(&enc, key, sizeof(key), iv, AES_ENCRYPTION);
wc_AesCbcEncrypt(&enc, cipher, plain, sizeof(plain));



Serial.print("cipher value ");

for(x=0; x<32; x++){
  Serial.print(cipher[x], HEX);
  Serial.print(" ");
  }
Serial.println(" ");



Serial.print("printing key value before cipher");

for(x=0; x<32; x++){
  Serial.print(key[x], HEX);
  Serial.print(" ");
  }
Serial.println(" ");


Serial.print("printing iv value before cipher");
for(x=0; x<32; x++){
  Serial.print(iv[x], HEX);
  Serial.print(" ");
  }
Serial.println(" ");

//decrypt
wc_AesSetKey(&dec, key, sizeof(key), iv, AES_DECRYPTION);
wc_AesCbcDecrypt(&dec, plain2, cipher, sizeof(cipher));


Serial.print("plain2 value  ");

for(x=0; x<32; x++){
  Serial.print(plain2[x], HEX);
  Serial.print(" ");
  }

Serial.println(" ");
Serial.println(" ");
Serial.println(" ");

 delay(10000);
}

We get this:

https://fotos.subefotos.com/aecc999c283568d93e3b9318406c7a28o.jpg

We can see that is not changing any input parameter at the function, but in each Arduino iteration we see differents values from encryption and decryption.
Besides decryption value never matches with value that we had before encrypting.
I've even used two variables "plain" and "plain2" to avoid any possible conflict.

NOTE: "for" loops just serve to print on screen, do not affect functionality, so you can ignore it.


Any idea why it happens?

UP?

Hi, I'm using encapsulation wolfcrypt in python in my Raspberry Pi.
I'm trying to encrypt something using aes, but I am getting this error that I can not solve.

My code:

from wolfcrypt import ciphers

vector = "1234567890abcdef";
clave = "1234567890abcdef1234567890abcdef";
texto = "hola mundo";

Aes = ciphers.Aes(clave, ciphers.MODE_CBC, vector);
Aes._set_key(ciphers._ENCRYPTION);

Error:

Traceback (most recent call last):
  File "/home/pi/Desktop/probandoAes.py", line 9, in <module>
    Aes._set_key(ciphers._ENCRYPTION);
  File "/usr/local/lib/python2.7/dist-packages/wolfcrypt/ciphers.py", line 167, in _set_key
    self._enc, self._key, len(self._key), self._IV, _ENCRYPTION)
TypeError: initializer for ctype 'Aes *' must be a cdata pointer, not NoneType
>>> 

Can you offer me some help?

Many thanks!! It works!
I'm going crazy trying everything, but finally it works, I have just to make the execution in a different location.

Really thank you for everything Kaleb.

Hi, I'm working in a Python project on Raspberry Pi .
I followed this tutorial: "https://wolfssl.github.io/wolfcrypt-py/" that I give on another thread to can build WolfSSL. But after it  I'm getting some troubles.

When I import a module like 'ciphers.py' or 'hashes.py' in my python project, I get the error: "ffi import from wolfcrypt._ffi as _ffi ImportError: No module named _ffi".

Where is this module? How can I import it into my python project correctly? Thank you so much in any case for all the help received so far, you're saving me.

11

(3 replies, posted in wolfSSL)

Thank you so much, finally works.

Can I ask for your help once again?

When I import a module like 'ciphers.py' or 'hashes.py' in my python project, I get the error: "ffi import from wolfcrypt._ffi as _ffi ImportError: No module named _ffi".

Where is this module? How can I import it into my python project correctly? Thank you so much in any case for all the help received so far, you're saving me.

12

(3 replies, posted in wolfSSL)

Hello, I'm trying to install the WolfSSL library (wolfcrypt specifically) on Raspberry Pi. This is a python project, so I am following this tutorial: "https://wolfssl.github.io/wolfcrypt-py/".

But I find troubles at the installation, when I reach the section "Installing wolfcrypt",  when I use the "sudo pip install wolfcrypt -H" command I'm getting the following error:

http://fotos.subefotos.com/b234be665edaa89b2c82adc3756fd27bo.jpg


Then to call: ' "wolfcrypt.hashes import from Sha, Sha print () hexdigest ()" python -c' I get this:

http://fotos.subefotos.com/17250a6473265cc72742cd454fa82afdo.jpg

I followed all the steps three times and get the same.

Can you offer me some help here? Thank you very much in advance.

13

(1 replies, posted in wolfSSL)

Hi, I'm doing an example exercise for encryption and decryption in Arduino.

#include <wolfssl.h>
#include <wolfssl/wolfcrypt/aes.h>

 
void setup(void){

}
 
void loop(void){


Aes enc;

int ret = 0;

byte key[] = {"0123456789abcdef"};

byte iv[]  = {"1234567890abcdef"};

String plain = "hola mundo";


if (ret = wc_AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION) != 0) {

// failed to set aes key

}

}

The trouble is the call to the function 'wc_AesSetKey' produces a 'not enought memory' arduino error.

If I comment function, it gets the message: "Global variables use 35 bytes (1%) of dynamic memory, leaving 2,013 bytes for Local variables Maximum is 2,048 bytes.."

But if the code is complete, I get: "Global variables use 2,137 bytes (104%) of dynamic memory, leaving -89 Maximum bytes for the local variables is 2,048 bytes..
processing.app.debug.RunnerException: Not enough memory; http://www.arduino.cc/en/Guide/Troubleshooting#size see for tips on Reducing your footprint.
at cc.arduino.Compiler.size (Compiler.java:338)
at cc.arduino.Compiler.build (Compiler.java:158)
at processing.app.Sketch.build (Sketch.java:1111)
at processing.app.Sketch.exportApplet (Sketch.java:1146)
at processing.app.Sketch.exportApplet (Sketch.java:1132)
processing.app.Editor at $ DefaultExportHandler.run (Editor.java:2409)
at java.lang.Thread.run (Thread.java:745)
Not enough memory; http://www.arduino.cc/en/Guide/Troubleshooting#size see for tips on Reducing your footprint. "

Any suggestion for fix it? Thanks for your replies in advance.

14

(8 replies, posted in wolfCrypt)

Thanks very much for take your time and for your reply, Kaleb.

It works!

15

(8 replies, posted in wolfCrypt)

Hi, thanks for your reply Kaleb.
I just need to use AES algorithm, forgetting the use of TLS / SSL. I copied the four files that told me except "wc_aes.c" because there was not, instead I copied "aes.c".

All these files were in <wolfssl-root> / wolfcrypt / src.
Now that they have been copied to <wolfssl-root>, I copied this folder in <path-to-arduino> / libraries.

I open a new Arduino project and go to "Sketch> Include Library> Contributed libraries" but I can not choose wolfssl libraries because they do not appear.

I do not know what I did wrong this time, but I can not get this to work.
I was wrong about something?

Thank you very much for any help or advice you can give me!

Hi, maybe this query sounds rather silly, but I'm desperate.
I'm trying to deploy an Arduino project to encrypt and decrypt using AES, but I get nothing since only get many import errors from libraries.

I followed the instructions to build the library "/IDE/ARDUINO/README.md" and then I copied in the libraries directory at Arduino.

As I get some fault, I modified some ".h" files to convert relative paths, but I keep getting errors.

Is there any tutorial for getting started showing how to use wolfcrypt library from scratch in an Arduino project?
Thank you very much for taking time and giving me tips!

17

(3 replies, posted in wolfCrypt)

Thanks for your reply.

I'm trying with some examples, but I'm getting errors.
Can I post an Arduino error here to get some help? I'm desperate.

18

(3 replies, posted in wolfCrypt)

Hello, I'm trying to send an encrypted message from the Arduino to Raspberry Pi. I've been seeing WolfSSL examples for Arduino, but what I need is just encrypt the message content. After it, I know how to send my message, cause my connection is radio (RF24l01).

Maybe I only need to use wolfcrypt, but I do not know how to use it.

The point of this I just want to encrypt a string before sending, for example using AES.

Can someone show me some example of how to use a cryptographic algorithm in Arduino?

Thank you very much and excuse me, I'm very newbie at this.

19

(2 replies, posted in wolfSSL)

Thank you very much for your reply, I hope it works.

It's a learning project, I'm trying to encrypt communication between Arduino and Raspberry Pi and see how they behave both ends.

20

(2 replies, posted in wolfSSL)

Hi, I'm a newbie in Arduino programming and I'm trying to install WolfSSL to send encrypted messages.

The point is I don't know how to install the libraries in a Windows environment, so I need some help from you.

Does anyone know some tutorial or something what explain me this?

Thank you.