Smartage application

Dependencies:   BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2

Fork of STM32L0_LoRa by Helmut Tschemernjak

Files at this revision

API Documentation at this revision

Comitter:
marcozecchini
Date:
Wed May 30 18:09:34 2018 +0000
Parent:
26:d93f1206909c
Child:
28:9d7be893610d
Commit message:
Encrypting version

Changed in this revision

AES.lib Show diff for this revision Revisions of this file
Crypto.lib Show annotated file Show diff for this revision Revisions of this file
smartage/smartage.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/AES.lib	Wed May 30 14:07:12 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://os.mbed.com/users/neilt6/code/AES/#09347d4bc827
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Crypto.lib	Wed May 30 18:09:34 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/Geremia/code/Crypto/#4399e2e6260b
--- a/smartage/smartage.cpp	Wed May 30 14:07:12 2018 +0000
+++ b/smartage/smartage.cpp	Wed May 30 18:09:34 2018 +0000
@@ -10,6 +10,7 @@
 #include "smartage.h"
 #include "sx1276-mbed-hal.h"
 #include "main.h"
+#include "Crypto.h"
 
 #ifdef FEATURE_LORA
 
@@ -88,6 +89,8 @@
 
 uint16_t BufferSize = BUFFER_SIZE;
 uint8_t *Buffer;
+unsigned char myKEY[16] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,};
+unsigned char myIV[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, } ;
 
 DigitalOut *led3;
 void print_stuff(){
@@ -215,6 +218,7 @@
 #endif
         
     int trasmission_routine = 0;
+    AES myAES(AES_128, myKEY, myIV);
     while (trasmission_routine<=WHILE_QUANTITY){
         switch( State )
         {
@@ -270,6 +274,8 @@
                 Buffer[i] = i - sizeof(str)+4;
             }
             dump("Check: ", Buffer, BufferSize);
+            myAES.encrypt(Buffer, Buffer, BufferSize);
+            dump("Crypto: ", Buffer, BufferSize);
             wait_ms( 10 ); 
             Radio->Send( Buffer, BufferSize );
             trasmission_routine += 1;