Browse Source

more reliable

Hans Martin 3 years ago
parent
commit
eece35d0aa

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


File diff suppressed because it is too large
+ 53 - 13
Speck-Analysis.ipynb


+ 63 - 0
cw_firmware/keyschedule.debug

@@ -0,0 +1,63 @@
+A = 0x2211 ; B = 0x4433 ; C = 0x6655 ; D = 0x8877
+A = 0x2211 ; B = 0x4433 ; C = 0x6655 ; D = 0x8877
+rk[0] =  0xdd
+A = 0xdd ; B = 0x8899 ; C = 0x6655 ; D = 0x8877
+rk[1] =  0xa8dc
+A = 0xa8dc ; B = 0x8899 ; C = 0xaba8 ; D = 0x8877
+rk[2] =  0x349c
+  <- D = 0x97ee----------------------
+A = 0x349c ; B = 0x8899 ; C = 0xaba8 ; D = 0x97ee
+rk[3] =  0xb5de
+A = 0xb5de ; B = 0x67ae ; C = 0xaba8 ; D = 0x97ee
+rk[4] =  0xd04b
+A = 0xd04b ; B = 0x67ae ; C = 0x731 ; D = 0x97ee
+rk[5] =  0xec50
+  <- D = 0xad7f----------------------
+A = 0xec50 ; B = 0x67ae ; C = 0x731 ; D = 0xad7f
+rk[6] =  0xf85a
+A = 0xf85a ; B = 0x4919 ; C = 0x731 ; D = 0xad7f
+rk[7] =  0xbb04
+A = 0xbb04 ; B = 0x4919 ; C = 0x5a6f ; D = 0xad7f
+rk[8] =  0x5644
+  <- D = 0xba56----------------------
+A = 0x5644 ; B = 0x4919 ; C = 0x5a6f ; D = 0xba56
+rk[9] =  0xd1ce
+A = 0xd1ce ; B = 0x88df ; C = 0x5a6f ; D = 0xba56
+rk[10] =  0xf7b3
+A = 0xf7b3 ; B = 0x88df ; C = 0xb088 ; D = 0xba56
+rk[11] =  0x7be3
+  <- D = 0xa52c----------------------
+A = 0x7be3 ; B = 0x88df ; C = 0xb088 ; D = 0xa52c
+rk[12] =  0xd575
+A = 0xd575 ; B = 0x3af8 ; C = 0xb088 ; D = 0xa52c
+rk[13] =  0xb30c
+A = 0xb30c ; B = 0x3af8 ; C = 0xe6db ; D = 0xa52c
+rk[14] =  0xc06a
+  <- D = 0xc58----------------------
+A = 0xc06a ; B = 0x3af8 ; C = 0xe6db ; D = 0xc58
+rk[15] =  0xb17b
+A = 0xb17b ; B = 0xb0d0 ; C = 0xe6db ; D = 0xc58
+rk[16] =  0xacb6
+A = 0xacb6 ; B = 0xb0d0 ; C = 0x6958 ; D = 0xc58
+rk[17] =  0xee05
+  <- D = 0x5cdf----------------------
+A = 0xee05 ; B = 0xb0d0 ; C = 0x6958 ; D = 0x5cdf
+rk[18] =  0x3763
+A = 0x3763 ; B = 0x8f74 ; C = 0x6958 ; D = 0x5cdf
+rk[19] =  0x35aa
+A = 0x35aa ; B = 0x8f74 ; C = 0xe826 ; D = 0x5cdf
+rk[20] =  0x22df
+  <- D = 0xf477----------------------
+A = 0x22df ; B = 0x8f74 ; C = 0xe826 ; D = 0xf477
+rk[21] =  0x8094
+A = 0x8094 ; B = 0xbe8 ; C = 0xe826 ; D = 0xf477
+rk[22] =  0xcc20
+A = 0xcc20 ; B = 0xbe8 ; C = 0xce72 ; D = 0xf477
+rk[23] =  0x8c9c
+  <- D = 0xbc1f----------------------
+[[ Speck 32/64  ]]
+The output: 
+- 0000005d
+- 0000007c
+- 00000046
+- 0000006d

+ 12 - 2
cw_firmware/speck3264.c

@@ -24,9 +24,16 @@ void BytesToWords16(u8 bytes[],u16 words[],int numbytes)
 void Speck3264KeySchedule(u16 K[],u16 rk[])
 {
     u16 i,D=K[3],C=K[2],B=K[1],A=K[0];
+    for(i=0;i<22;){
+        rk[i]=A;
+        ER16(B,A,i++);
+        rk[i]=A;
+        ER16(C,A,i++);
+        rk[i]=A;
+        ER16(D,A,i++);
+    }
 
-    printf("A = 0x%x ; B = 0x%x ; C = 0x%x ; D = 0x%x\n", A, B, C, D);
-
+    /* DEBUG
     for(i=0;i<22;){
 
         printf("A = 0x%x ; B = 0x%x ; C = 0x%x ; D = 0x%x\n", A, B, C, D);
@@ -46,6 +53,7 @@ void Speck3264KeySchedule(u16 K[],u16 rk[])
         printf("rk[%d] =  0x%x\n  <- D = 0x%x", i-1, A, D);
         printf("----------------------\n");
     }
+    */
 }
 
 
@@ -99,6 +107,7 @@ void Speck3264_EncryptBlock(u8 pt[], u8 k[], u8 ct[]) {
 }
 
 
+/*
 int main() {
 
 
@@ -120,3 +129,4 @@ int main() {
     }
     return 0;
 }
+*/

BIN
sample_traces/1200_encryption_traces.npy


BIN
sample_traces/1200_plaintext_traces.npy


BIN
sample_traces/1800_encryption_traces.npy


BIN
sample_traces/2200_encryption_traces.npy


BIN
sample_traces/2200_plaintext_traces.npy


BIN
sample_traces/2250_encryption_traces.npy


BIN
sample_traces/650_encryption_traces.npy


BIN
sample_traces/650_plaintext_traces.npy


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