Browse Source

further adjustments to fw

Marius Schwarz 3 years ago
parent
commit
9059031f7e
3 changed files with 1025 additions and 53 deletions
  1. 985 0
      .ipynb_checkpoints/Speck-Analysis-checkpoint.ipynb
  2. 34 37
      Speck-Analysis.ipynb
  3. 6 16
      cw_firmware/simple-speck.c

File diff suppressed because it is too large
+ 985 - 0
.ipynb_checkpoints/Speck-Analysis-checkpoint.ipynb


File diff suppressed because it is too large
+ 34 - 37
Speck-Analysis.ipynb


+ 6 - 16
cw_firmware/simple-speck.c

@@ -9,16 +9,12 @@ u8 gkey[32] = {0x00};
 
 
 uint8_t get_key(uint8_t* k, uint8_t len) {
-	// Load key here
 	simpleserial_put('o', 32, gkey);
 	return 0x00;
 }
 
 uint8_t set_key(uint8_t* key, uint8_t len) {
-
-    // copy keybytes
     memcpy(gkey, key, 32);
-    simpleserial_put('o', 32, gkey);
     return 0x00;
 }
 
@@ -27,19 +23,14 @@ uint8_t get_pt(uint8_t* pt, uint8_t len) {
 	* Start user-specific code here. */
 	trigger_high();
 
-	//16 hex bytes held in 'pt' were sent
-	//from the computer. Store your response
-	//back into 'pt', which will send 16 bytes
-	//back to computer. Can ignore of course if
-	//not needed
-
-        volatile uint8_t ppp[] = {0x42, 0x41, 0x41, 0x41,0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 };
+        // Only for testing purposes
+        volatile uint8_t testing_output[] = {0x42, 0x41, 0x41, 0x41,0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41 };
 
 
 	trigger_low();
 	/* End user-specific code here. *
 	********************************/
-	simpleserial_put('r', 16, ppp);
+	simpleserial_put('r', 16, testing_output);
 
 	return 0x00;
 }
@@ -49,12 +40,10 @@ uint8_t encrypt_block(uint8_t* pt, uint8_t len) {
 
     trigger_high(); // TRIGGER START
 
-
-    //u8 pt[16] = {0x70, 0x6f, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x20, 0x49, 0x6e, 0x20, 0x74, 0x68, 0x6f, 0x73, 0x65};
     u8 key[32] = {0x00};
     memcpy(key, gkey, 32); // copy the globally set encryption key
     u8 ct[16] = {0x00};
-    EncryptBlock(pt, key, ct);
+    EncryptBlock(pt, key, ct); // the encryption happens here
 
     trigger_low(); // TRIGGER STOP
 
@@ -76,16 +65,17 @@ int main(void) {
 	trigger_setup();
 
  	/* Uncomment this to get a HELLO message for debug */
+        /*
 	putch('h');
 	putch('e');
 	putch('l');
 	putch('l');
 	putch('o');
 	putch('\n');
+        */
 
 	simpleserial_init();
 	simpleserial_addcmd('p', 16, get_pt);
-	simpleserial_addcmd('l', 0, get_pt);
 	simpleserial_addcmd('e', 16, encrypt_block);
 	simpleserial_addcmd('k', 16, get_key);
 	simpleserial_addcmd('s', 32, set_key);

Some files were not shown because too many files changed in this diff