]> git.cryptolib.org Git - arm-crypto-lib.git/commitdiff
including even/odd-trick for BMW
authorbg <bg@cypex>
Wed, 13 Oct 2010 16:32:55 +0000 (18:32 +0200)
committerbg <bg@cypex>
Wed, 13 Oct 2010 16:32:55 +0000 (18:32 +0200)
bmw/autogen_f1.rb
bmw/autogen_f1_large.rb
bmw/f1_autogen.i
bmw/f1_autogen_large.i
openocd.cfg

index fffc4080761e5100df2b36ef287aa14b9932840a..c1906bb1822de56dd7a192e8abd3b3ffd5b658c2 100644 (file)
@@ -22,6 +22,7 @@ header = <<EOF
 
 static inline
 void bmw_small_f1(uint32_t* q, const void* m, const void* h){ 
+  uint32_t even, odd;
 EOF
 
 footer = <<EOF
@@ -63,7 +64,7 @@ def expand_1(j)
 end
 
 
-def expand_2(j)
+def expand_2(j,start)
   s = sprintf("/* expand_2(%2d) */\n", j)
   s += sprintf("\tq[%2d] = \n", j+16)
   s += sprintf("\t\t((  ROTL32(((uint32_t*)m)[%2d], %d) \n", j%16,      (j%16)+1)
@@ -71,16 +72,29 @@ def expand_2(j)
   s += sprintf("\t\t  - ROTL32(((uint32_t*)m)[%2d], %d) \n", (j+10)%16, ((j+10)%16)+1)
   s += sprintf("\t\t  + 0x%08xUL \n", 0x0555_5555*(16+j))
   s += sprintf("\t\t )^ ((uint32_t*)h)[%2d] \n", (j+7)%16)
-  s += sprintf("\t\t)");
-  (0..13).each do |x|
-    s += (x%4==0)?"\n\t\t":" "
-    if x%2==0
-      s += sprintf("+       q[%2d] ",  x+j)
+  s += sprintf("\t\t)")
+  if(j-1<=start) 
+    if(j%2==0)
+      # even
+      s += sprintf("\n\t\t + ( even =  q[%2d] + q[%2d] + q[%2d]",j,j+2,j+4)
+      s += sprintf("\n\t\t           + q[%2d] + q[%2d] + q[%2d] + q[%2d] )",j+6,j+8,j+10,j+12)
+      s += sprintf("\n\t\t + R32_1(q[%2d]) + R32_2(q[%2d]) + R32_3(q[%2d])",j+1,j+3,j+5)
+      s += sprintf("\n\t\t + R32_4(q[%2d]) + R32_5(q[%2d]) + R32_6(q[%2d])",j+7,j+9,j+11)
+      s += sprintf("\n\t\t + R32_7(q[%2d]) + S32_4(q[%2d]) + S32_5(q[%2d])",j+13,j+14,j+15)
     else
-      s += sprintf("+ R32_%d(q[%2d])", (x+1)/2, x+j)
-    end
-  end
-  s += sprintf(" + S32_4(q[%2d]) + S32_5(q[%2d])", j+14, j+15)
+      # odd
+      s += sprintf("\n\t\t + ( odd  =  q[%2d] + q[%2d] + q[%2d]",j,j+2,j+4)
+      s += sprintf("\n\t\t           + q[%2d] + q[%2d] + q[%2d] + q[%2d] )",j+6,j+8,j+10,j+12)
+      s += sprintf("\n\t\t + R32_1(q[%2d]) + R32_2(q[%2d]) + R32_3(q[%2d])",j+1,j+3,j+5)
+      s += sprintf("\n\t\t + R32_4(q[%2d]) + R32_5(q[%2d]) + R32_6(q[%2d])",j+7,j+9,j+11)
+      s += sprintf("\n\t\t + R32_7(q[%2d]) + S32_4(q[%2d]) + S32_5(q[%2d])",j+13,j+14,j+15)
+    end 
+  else 
+    s += sprintf("\n\t\t + ( %s  +=  q[%2d] - q[%2d] )",(j%2==0)?"even":"odd ",j+12,j-2)    
+    s += sprintf("\n\t\t + R32_1(q[%2d]) + R32_2(q[%2d]) + R32_3(q[%2d])",j+1,j+3,j+5)
+    s += sprintf("\n\t\t + R32_4(q[%2d]) + R32_5(q[%2d]) + R32_6(q[%2d])",j+7,j+9,j+11)
+    s += sprintf("\n\t\t + R32_7(q[%2d]) + S32_4(q[%2d]) + S32_5(q[%2d])",j+13,j+14,j+15)  
+  end 
   s += ';'
   return s
 end
@@ -88,5 +102,5 @@ end
 
 puts header
 (0..1).each  {|x| puts expand_1(x)}
-(2..15).each {|x| puts expand_2(x)}
+(2..15).each {|x| puts expand_2(x, 2)}
 puts footer
\ No newline at end of file
index 5faca0fa095da47f73bf908bd70e2aeac5bc6799..780e95398c58d9f59ca3d6f4cf718daa44216633 100644 (file)
@@ -5,6 +5,7 @@ header = <<EOF
 
 static inline
 void bmw_large_f1(uint64_t* q, const void* m, const void* h){ 
+  uint64_t even, odd;
 EOF
 
 footer = <<EOF
@@ -46,7 +47,7 @@ def expand_1(j)
 end
 
 
-def expand_2(j)
+def expand_2(j, start)
   s = sprintf("/* expand_2(%2d) */\n", j)
   s += sprintf("\tq[%2d] = \n", j+16)
   s += sprintf("\t\t((  ROTL64(((uint64_t*)m)[%2d], %d) \n", j%16,      (j%16)+1)
@@ -55,15 +56,28 @@ def expand_2(j)
   s += sprintf("\t\t  + 0x%016xULL \n", 0x0555_5555_5555_5555*(16+j))
   s += sprintf("\t\t )^ ((uint64_t*)h)[%2d] \n", (j+7)%16)
   s += sprintf("\t\t)");
-  (0..13).each do |x|
-    s += (x%4==0)?"\n\t\t":" "
-    if x%2==0
-      s += sprintf("+       q[%2d] ",  x+j)
+  if(j-1<=start) 
+    if(j%2==0)
+      # even
+      s += sprintf("\n\t\t + ( even =  q[%2d] + q[%2d] + q[%2d]",j,j+2,j+4)
+      s += sprintf("\n\t\t           + q[%2d] + q[%2d] + q[%2d] + q[%2d] )",j+6,j+8,j+10,j+12)
+      s += sprintf("\n\t\t + R64_1(q[%2d]) + R64_2(q[%2d]) + R64_3(q[%2d])",j+1,j+3,j+5)
+      s += sprintf("\n\t\t + R64_4(q[%2d]) + R64_5(q[%2d]) + R64_6(q[%2d])",j+7,j+9,j+11)
+      s += sprintf("\n\t\t + R64_7(q[%2d]) + S64_4(q[%2d]) + S64_5(q[%2d])",j+13,j+14,j+15)
     else
-      s += sprintf("+ R64_%d(q[%2d])", (x+1)/2, x+j)
-    end
-  end
-  s += sprintf(" + S64_4(q[%2d]) + S64_5(q[%2d])", j+14, j+15)
+      # odd
+      s += sprintf("\n\t\t + ( odd  =  q[%2d] + q[%2d] + q[%2d]",j,j+2,j+4)
+      s += sprintf("\n\t\t           + q[%2d] + q[%2d] + q[%2d] + q[%2d] )",j+6,j+8,j+10,j+12)
+      s += sprintf("\n\t\t + R64_1(q[%2d]) + R64_2(q[%2d]) + R64_3(q[%2d])",j+1,j+3,j+5)
+      s += sprintf("\n\t\t + R64_4(q[%2d]) + R64_5(q[%2d]) + R64_6(q[%2d])",j+7,j+9,j+11)
+      s += sprintf("\n\t\t + R64_7(q[%2d]) + S64_4(q[%2d]) + S64_5(q[%2d])",j+13,j+14,j+15)
+    end 
+  else 
+    s += sprintf("\n\t\t + ( %s  +=  q[%2d] - q[%2d] )",(j%2==0)?"even":"odd ",j+12,j-2)    
+    s += sprintf("\n\t\t + R64_1(q[%2d]) + R64_2(q[%2d]) + R64_3(q[%2d])",j+1,j+3,j+5)
+    s += sprintf("\n\t\t + R64_4(q[%2d]) + R64_5(q[%2d]) + R64_6(q[%2d])",j+7,j+9,j+11)
+    s += sprintf("\n\t\t + R64_7(q[%2d]) + S64_4(q[%2d]) + S64_5(q[%2d])",j+13,j+14,j+15)  
+  end 
   s += ';'
   return s
 end
@@ -71,5 +85,5 @@ end
 
 puts header
 (0..1).each  {|x| puts expand_1(x)}
-(2..15).each {|x| puts expand_2(x)}
+(2..15).each {|x| puts expand_2(x, 2)}
 puts footer
\ No newline at end of file
index 31217b77bee6f80394cf2fa31c28021af78a614a..976fa404b051c8ffdff61545521a4eb6cd8bf1b1 100644 (file)
@@ -2,6 +2,7 @@
 
 static inline
 void bmw_small_f1(uint32_t* q, const void* m, const void* h){ 
+  uint32_t even, odd;
 /* expand_1( 0) */
        q[16] = 
                ((  ROTL32(((uint32_t*)m)[ 0], 1) 
@@ -34,10 +35,11 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x5ffffffaUL 
                 )^ ((uint32_t*)h)[ 9] 
                )
-               +       q[ 2]  + R32_1(q[ 3]) +       q[ 4]  + R32_2(q[ 5])
-               +       q[ 6]  + R32_3(q[ 7]) +       q[ 8]  + R32_4(q[ 9])
-               +       q[10]  + R32_5(q[11]) +       q[12]  + R32_6(q[13])
-               +       q[14]  + R32_7(q[15]) + S32_4(q[16]) + S32_5(q[17]);
+                + ( even =  q[ 2] + q[ 4] + q[ 6]
+                          + q[ 8] + q[10] + q[12] + q[14] )
+                + R32_1(q[ 3]) + R32_2(q[ 5]) + R32_3(q[ 7])
+                + R32_4(q[ 9]) + R32_5(q[11]) + R32_6(q[13])
+                + R32_7(q[15]) + S32_4(q[16]) + S32_5(q[17]);
 /* expand_2( 3) */
        q[19] = 
                ((  ROTL32(((uint32_t*)m)[ 3], 4) 
@@ -46,10 +48,11 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x6555554fUL 
                 )^ ((uint32_t*)h)[10] 
                )
-               +       q[ 3]  + R32_1(q[ 4]) +       q[ 5]  + R32_2(q[ 6])
-               +       q[ 7]  + R32_3(q[ 8]) +       q[ 9]  + R32_4(q[10])
-               +       q[11]  + R32_5(q[12]) +       q[13]  + R32_6(q[14])
-               +       q[15]  + R32_7(q[16]) + S32_4(q[17]) + S32_5(q[18]);
+                + ( odd  =  q[ 3] + q[ 5] + q[ 7]
+                          + q[ 9] + q[11] + q[13] + q[15] )
+                + R32_1(q[ 4]) + R32_2(q[ 6]) + R32_3(q[ 8])
+                + R32_4(q[10]) + R32_5(q[12]) + R32_6(q[14])
+                + R32_7(q[16]) + S32_4(q[17]) + S32_5(q[18]);
 /* expand_2( 4) */
        q[20] = 
                ((  ROTL32(((uint32_t*)m)[ 4], 5) 
@@ -58,10 +61,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x6aaaaaa4UL 
                 )^ ((uint32_t*)h)[11] 
                )
-               +       q[ 4]  + R32_1(q[ 5]) +       q[ 6]  + R32_2(q[ 7])
-               +       q[ 8]  + R32_3(q[ 9]) +       q[10]  + R32_4(q[11])
-               +       q[12]  + R32_5(q[13]) +       q[14]  + R32_6(q[15])
-               +       q[16]  + R32_7(q[17]) + S32_4(q[18]) + S32_5(q[19]);
+                + ( even  +=  q[16] - q[ 2] )
+                + R32_1(q[ 5]) + R32_2(q[ 7]) + R32_3(q[ 9])
+                + R32_4(q[11]) + R32_5(q[13]) + R32_6(q[15])
+                + R32_7(q[17]) + S32_4(q[18]) + S32_5(q[19]);
 /* expand_2( 5) */
        q[21] = 
                ((  ROTL32(((uint32_t*)m)[ 5], 6) 
@@ -70,10 +73,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x6ffffff9UL 
                 )^ ((uint32_t*)h)[12] 
                )
-               +       q[ 5]  + R32_1(q[ 6]) +       q[ 7]  + R32_2(q[ 8])
-               +       q[ 9]  + R32_3(q[10]) +       q[11]  + R32_4(q[12])
-               +       q[13]  + R32_5(q[14]) +       q[15]  + R32_6(q[16])
-               +       q[17]  + R32_7(q[18]) + S32_4(q[19]) + S32_5(q[20]);
+                + ( odd   +=  q[17] - q[ 3] )
+                + R32_1(q[ 6]) + R32_2(q[ 8]) + R32_3(q[10])
+                + R32_4(q[12]) + R32_5(q[14]) + R32_6(q[16])
+                + R32_7(q[18]) + S32_4(q[19]) + S32_5(q[20]);
 /* expand_2( 6) */
        q[22] = 
                ((  ROTL32(((uint32_t*)m)[ 6], 7) 
@@ -82,10 +85,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x7555554eUL 
                 )^ ((uint32_t*)h)[13] 
                )
-               +       q[ 6]  + R32_1(q[ 7]) +       q[ 8]  + R32_2(q[ 9])
-               +       q[10]  + R32_3(q[11]) +       q[12]  + R32_4(q[13])
-               +       q[14]  + R32_5(q[15]) +       q[16]  + R32_6(q[17])
-               +       q[18]  + R32_7(q[19]) + S32_4(q[20]) + S32_5(q[21]);
+                + ( even  +=  q[18] - q[ 4] )
+                + R32_1(q[ 7]) + R32_2(q[ 9]) + R32_3(q[11])
+                + R32_4(q[13]) + R32_5(q[15]) + R32_6(q[17])
+                + R32_7(q[19]) + S32_4(q[20]) + S32_5(q[21]);
 /* expand_2( 7) */
        q[23] = 
                ((  ROTL32(((uint32_t*)m)[ 7], 8) 
@@ -94,10 +97,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x7aaaaaa3UL 
                 )^ ((uint32_t*)h)[14] 
                )
-               +       q[ 7]  + R32_1(q[ 8]) +       q[ 9]  + R32_2(q[10])
-               +       q[11]  + R32_3(q[12]) +       q[13]  + R32_4(q[14])
-               +       q[15]  + R32_5(q[16]) +       q[17]  + R32_6(q[18])
-               +       q[19]  + R32_7(q[20]) + S32_4(q[21]) + S32_5(q[22]);
+                + ( odd   +=  q[19] - q[ 5] )
+                + R32_1(q[ 8]) + R32_2(q[10]) + R32_3(q[12])
+                + R32_4(q[14]) + R32_5(q[16]) + R32_6(q[18])
+                + R32_7(q[20]) + S32_4(q[21]) + S32_5(q[22]);
 /* expand_2( 8) */
        q[24] = 
                ((  ROTL32(((uint32_t*)m)[ 8], 9) 
@@ -106,10 +109,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x7ffffff8UL 
                 )^ ((uint32_t*)h)[15] 
                )
-               +       q[ 8]  + R32_1(q[ 9]) +       q[10]  + R32_2(q[11])
-               +       q[12]  + R32_3(q[13]) +       q[14]  + R32_4(q[15])
-               +       q[16]  + R32_5(q[17]) +       q[18]  + R32_6(q[19])
-               +       q[20]  + R32_7(q[21]) + S32_4(q[22]) + S32_5(q[23]);
+                + ( even  +=  q[20] - q[ 6] )
+                + R32_1(q[ 9]) + R32_2(q[11]) + R32_3(q[13])
+                + R32_4(q[15]) + R32_5(q[17]) + R32_6(q[19])
+                + R32_7(q[21]) + S32_4(q[22]) + S32_5(q[23]);
 /* expand_2( 9) */
        q[25] = 
                ((  ROTL32(((uint32_t*)m)[ 9], 10) 
@@ -118,10 +121,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x8555554dUL 
                 )^ ((uint32_t*)h)[ 0] 
                )
-               +       q[ 9]  + R32_1(q[10]) +       q[11]  + R32_2(q[12])
-               +       q[13]  + R32_3(q[14]) +       q[15]  + R32_4(q[16])
-               +       q[17]  + R32_5(q[18]) +       q[19]  + R32_6(q[20])
-               +       q[21]  + R32_7(q[22]) + S32_4(q[23]) + S32_5(q[24]);
+                + ( odd   +=  q[21] - q[ 7] )
+                + R32_1(q[10]) + R32_2(q[12]) + R32_3(q[14])
+                + R32_4(q[16]) + R32_5(q[18]) + R32_6(q[20])
+                + R32_7(q[22]) + S32_4(q[23]) + S32_5(q[24]);
 /* expand_2(10) */
        q[26] = 
                ((  ROTL32(((uint32_t*)m)[10], 11) 
@@ -130,10 +133,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x8aaaaaa2UL 
                 )^ ((uint32_t*)h)[ 1] 
                )
-               +       q[10]  + R32_1(q[11]) +       q[12]  + R32_2(q[13])
-               +       q[14]  + R32_3(q[15]) +       q[16]  + R32_4(q[17])
-               +       q[18]  + R32_5(q[19]) +       q[20]  + R32_6(q[21])
-               +       q[22]  + R32_7(q[23]) + S32_4(q[24]) + S32_5(q[25]);
+                + ( even  +=  q[22] - q[ 8] )
+                + R32_1(q[11]) + R32_2(q[13]) + R32_3(q[15])
+                + R32_4(q[17]) + R32_5(q[19]) + R32_6(q[21])
+                + R32_7(q[23]) + S32_4(q[24]) + S32_5(q[25]);
 /* expand_2(11) */
        q[27] = 
                ((  ROTL32(((uint32_t*)m)[11], 12) 
@@ -142,10 +145,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x8ffffff7UL 
                 )^ ((uint32_t*)h)[ 2] 
                )
-               +       q[11]  + R32_1(q[12]) +       q[13]  + R32_2(q[14])
-               +       q[15]  + R32_3(q[16]) +       q[17]  + R32_4(q[18])
-               +       q[19]  + R32_5(q[20]) +       q[21]  + R32_6(q[22])
-               +       q[23]  + R32_7(q[24]) + S32_4(q[25]) + S32_5(q[26]);
+                + ( odd   +=  q[23] - q[ 9] )
+                + R32_1(q[12]) + R32_2(q[14]) + R32_3(q[16])
+                + R32_4(q[18]) + R32_5(q[20]) + R32_6(q[22])
+                + R32_7(q[24]) + S32_4(q[25]) + S32_5(q[26]);
 /* expand_2(12) */
        q[28] = 
                ((  ROTL32(((uint32_t*)m)[12], 13) 
@@ -154,10 +157,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x9555554cUL 
                 )^ ((uint32_t*)h)[ 3] 
                )
-               +       q[12]  + R32_1(q[13]) +       q[14]  + R32_2(q[15])
-               +       q[16]  + R32_3(q[17]) +       q[18]  + R32_4(q[19])
-               +       q[20]  + R32_5(q[21]) +       q[22]  + R32_6(q[23])
-               +       q[24]  + R32_7(q[25]) + S32_4(q[26]) + S32_5(q[27]);
+                + ( even  +=  q[24] - q[10] )
+                + R32_1(q[13]) + R32_2(q[15]) + R32_3(q[17])
+                + R32_4(q[19]) + R32_5(q[21]) + R32_6(q[23])
+                + R32_7(q[25]) + S32_4(q[26]) + S32_5(q[27]);
 /* expand_2(13) */
        q[29] = 
                ((  ROTL32(((uint32_t*)m)[13], 14) 
@@ -166,10 +169,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x9aaaaaa1UL 
                 )^ ((uint32_t*)h)[ 4] 
                )
-               +       q[13]  + R32_1(q[14]) +       q[15]  + R32_2(q[16])
-               +       q[17]  + R32_3(q[18]) +       q[19]  + R32_4(q[20])
-               +       q[21]  + R32_5(q[22]) +       q[23]  + R32_6(q[24])
-               +       q[25]  + R32_7(q[26]) + S32_4(q[27]) + S32_5(q[28]);
+                + ( odd   +=  q[25] - q[11] )
+                + R32_1(q[14]) + R32_2(q[16]) + R32_3(q[18])
+                + R32_4(q[20]) + R32_5(q[22]) + R32_6(q[24])
+                + R32_7(q[26]) + S32_4(q[27]) + S32_5(q[28]);
 /* expand_2(14) */
        q[30] = 
                ((  ROTL32(((uint32_t*)m)[14], 15) 
@@ -178,10 +181,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0x9ffffff6UL 
                 )^ ((uint32_t*)h)[ 5] 
                )
-               +       q[14]  + R32_1(q[15]) +       q[16]  + R32_2(q[17])
-               +       q[18]  + R32_3(q[19]) +       q[20]  + R32_4(q[21])
-               +       q[22]  + R32_5(q[23]) +       q[24]  + R32_6(q[25])
-               +       q[26]  + R32_7(q[27]) + S32_4(q[28]) + S32_5(q[29]);
+                + ( even  +=  q[26] - q[12] )
+                + R32_1(q[15]) + R32_2(q[17]) + R32_3(q[19])
+                + R32_4(q[21]) + R32_5(q[23]) + R32_6(q[25])
+                + R32_7(q[27]) + S32_4(q[28]) + S32_5(q[29]);
 /* expand_2(15) */
        q[31] = 
                ((  ROTL32(((uint32_t*)m)[15], 16) 
@@ -190,10 +193,10 @@ void bmw_small_f1(uint32_t* q, const void* m, const void* h){
                  + 0xa555554bUL 
                 )^ ((uint32_t*)h)[ 6] 
                )
-               +       q[15]  + R32_1(q[16]) +       q[17]  + R32_2(q[18])
-               +       q[19]  + R32_3(q[20]) +       q[21]  + R32_4(q[22])
-               +       q[23]  + R32_5(q[24]) +       q[25]  + R32_6(q[26])
-               +       q[27]  + R32_7(q[28]) + S32_4(q[29]) + S32_5(q[30]);
+                + ( odd   +=  q[27] - q[13] )
+                + R32_1(q[16]) + R32_2(q[18]) + R32_3(q[20])
+                + R32_4(q[22]) + R32_5(q[24]) + R32_6(q[26])
+                + R32_7(q[28]) + S32_4(q[29]) + S32_5(q[30]);
 }
 
 /* END of automatic generated code */
index 75eff07bc911332108317499e5cc152cbdb63de5..d3450b048f5473af4ba892c31a9eaba6d8171c06 100644 (file)
@@ -2,6 +2,7 @@
 
 static inline
 void bmw_large_f1(uint64_t* q, const void* m, const void* h){ 
+  uint64_t even, odd;
 /* expand_1( 0) */
        q[16] = 
                ((  ROTL64(((uint64_t*)m)[ 0], 1) 
@@ -34,10 +35,11 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x5ffffffffffffffaULL 
                 )^ ((uint64_t*)h)[ 9] 
                )
-               +       q[ 2]  + R64_1(q[ 3]) +       q[ 4]  + R64_2(q[ 5])
-               +       q[ 6]  + R64_3(q[ 7]) +       q[ 8]  + R64_4(q[ 9])
-               +       q[10]  + R64_5(q[11]) +       q[12]  + R64_6(q[13])
-               +       q[14]  + R64_7(q[15]) + S64_4(q[16]) + S64_5(q[17]);
+                + ( even =  q[ 2] + q[ 4] + q[ 6]
+                          + q[ 8] + q[10] + q[12] + q[14] )
+                + R64_1(q[ 3]) + R64_2(q[ 5]) + R64_3(q[ 7])
+                + R64_4(q[ 9]) + R64_5(q[11]) + R64_6(q[13])
+                + R64_7(q[15]) + S64_4(q[16]) + S64_5(q[17]);
 /* expand_2( 3) */
        q[19] = 
                ((  ROTL64(((uint64_t*)m)[ 3], 4) 
@@ -46,10 +48,11 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x655555555555554fULL 
                 )^ ((uint64_t*)h)[10] 
                )
-               +       q[ 3]  + R64_1(q[ 4]) +       q[ 5]  + R64_2(q[ 6])
-               +       q[ 7]  + R64_3(q[ 8]) +       q[ 9]  + R64_4(q[10])
-               +       q[11]  + R64_5(q[12]) +       q[13]  + R64_6(q[14])
-               +       q[15]  + R64_7(q[16]) + S64_4(q[17]) + S64_5(q[18]);
+                + ( odd  =  q[ 3] + q[ 5] + q[ 7]
+                          + q[ 9] + q[11] + q[13] + q[15] )
+                + R64_1(q[ 4]) + R64_2(q[ 6]) + R64_3(q[ 8])
+                + R64_4(q[10]) + R64_5(q[12]) + R64_6(q[14])
+                + R64_7(q[16]) + S64_4(q[17]) + S64_5(q[18]);
 /* expand_2( 4) */
        q[20] = 
                ((  ROTL64(((uint64_t*)m)[ 4], 5) 
@@ -58,10 +61,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x6aaaaaaaaaaaaaa4ULL 
                 )^ ((uint64_t*)h)[11] 
                )
-               +       q[ 4]  + R64_1(q[ 5]) +       q[ 6]  + R64_2(q[ 7])
-               +       q[ 8]  + R64_3(q[ 9]) +       q[10]  + R64_4(q[11])
-               +       q[12]  + R64_5(q[13]) +       q[14]  + R64_6(q[15])
-               +       q[16]  + R64_7(q[17]) + S64_4(q[18]) + S64_5(q[19]);
+                + ( even  +=  q[16] - q[ 2] )
+                + R64_1(q[ 5]) + R64_2(q[ 7]) + R64_3(q[ 9])
+                + R64_4(q[11]) + R64_5(q[13]) + R64_6(q[15])
+                + R64_7(q[17]) + S64_4(q[18]) + S64_5(q[19]);
 /* expand_2( 5) */
        q[21] = 
                ((  ROTL64(((uint64_t*)m)[ 5], 6) 
@@ -70,10 +73,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x6ffffffffffffff9ULL 
                 )^ ((uint64_t*)h)[12] 
                )
-               +       q[ 5]  + R64_1(q[ 6]) +       q[ 7]  + R64_2(q[ 8])
-               +       q[ 9]  + R64_3(q[10]) +       q[11]  + R64_4(q[12])
-               +       q[13]  + R64_5(q[14]) +       q[15]  + R64_6(q[16])
-               +       q[17]  + R64_7(q[18]) + S64_4(q[19]) + S64_5(q[20]);
+                + ( odd   +=  q[17] - q[ 3] )
+                + R64_1(q[ 6]) + R64_2(q[ 8]) + R64_3(q[10])
+                + R64_4(q[12]) + R64_5(q[14]) + R64_6(q[16])
+                + R64_7(q[18]) + S64_4(q[19]) + S64_5(q[20]);
 /* expand_2( 6) */
        q[22] = 
                ((  ROTL64(((uint64_t*)m)[ 6], 7) 
@@ -82,10 +85,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x755555555555554eULL 
                 )^ ((uint64_t*)h)[13] 
                )
-               +       q[ 6]  + R64_1(q[ 7]) +       q[ 8]  + R64_2(q[ 9])
-               +       q[10]  + R64_3(q[11]) +       q[12]  + R64_4(q[13])
-               +       q[14]  + R64_5(q[15]) +       q[16]  + R64_6(q[17])
-               +       q[18]  + R64_7(q[19]) + S64_4(q[20]) + S64_5(q[21]);
+                + ( even  +=  q[18] - q[ 4] )
+                + R64_1(q[ 7]) + R64_2(q[ 9]) + R64_3(q[11])
+                + R64_4(q[13]) + R64_5(q[15]) + R64_6(q[17])
+                + R64_7(q[19]) + S64_4(q[20]) + S64_5(q[21]);
 /* expand_2( 7) */
        q[23] = 
                ((  ROTL64(((uint64_t*)m)[ 7], 8) 
@@ -94,10 +97,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x7aaaaaaaaaaaaaa3ULL 
                 )^ ((uint64_t*)h)[14] 
                )
-               +       q[ 7]  + R64_1(q[ 8]) +       q[ 9]  + R64_2(q[10])
-               +       q[11]  + R64_3(q[12]) +       q[13]  + R64_4(q[14])
-               +       q[15]  + R64_5(q[16]) +       q[17]  + R64_6(q[18])
-               +       q[19]  + R64_7(q[20]) + S64_4(q[21]) + S64_5(q[22]);
+                + ( odd   +=  q[19] - q[ 5] )
+                + R64_1(q[ 8]) + R64_2(q[10]) + R64_3(q[12])
+                + R64_4(q[14]) + R64_5(q[16]) + R64_6(q[18])
+                + R64_7(q[20]) + S64_4(q[21]) + S64_5(q[22]);
 /* expand_2( 8) */
        q[24] = 
                ((  ROTL64(((uint64_t*)m)[ 8], 9) 
@@ -106,10 +109,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x7ffffffffffffff8ULL 
                 )^ ((uint64_t*)h)[15] 
                )
-               +       q[ 8]  + R64_1(q[ 9]) +       q[10]  + R64_2(q[11])
-               +       q[12]  + R64_3(q[13]) +       q[14]  + R64_4(q[15])
-               +       q[16]  + R64_5(q[17]) +       q[18]  + R64_6(q[19])
-               +       q[20]  + R64_7(q[21]) + S64_4(q[22]) + S64_5(q[23]);
+                + ( even  +=  q[20] - q[ 6] )
+                + R64_1(q[ 9]) + R64_2(q[11]) + R64_3(q[13])
+                + R64_4(q[15]) + R64_5(q[17]) + R64_6(q[19])
+                + R64_7(q[21]) + S64_4(q[22]) + S64_5(q[23]);
 /* expand_2( 9) */
        q[25] = 
                ((  ROTL64(((uint64_t*)m)[ 9], 10) 
@@ -118,10 +121,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x855555555555554dULL 
                 )^ ((uint64_t*)h)[ 0] 
                )
-               +       q[ 9]  + R64_1(q[10]) +       q[11]  + R64_2(q[12])
-               +       q[13]  + R64_3(q[14]) +       q[15]  + R64_4(q[16])
-               +       q[17]  + R64_5(q[18]) +       q[19]  + R64_6(q[20])
-               +       q[21]  + R64_7(q[22]) + S64_4(q[23]) + S64_5(q[24]);
+                + ( odd   +=  q[21] - q[ 7] )
+                + R64_1(q[10]) + R64_2(q[12]) + R64_3(q[14])
+                + R64_4(q[16]) + R64_5(q[18]) + R64_6(q[20])
+                + R64_7(q[22]) + S64_4(q[23]) + S64_5(q[24]);
 /* expand_2(10) */
        q[26] = 
                ((  ROTL64(((uint64_t*)m)[10], 11) 
@@ -130,10 +133,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x8aaaaaaaaaaaaaa2ULL 
                 )^ ((uint64_t*)h)[ 1] 
                )
-               +       q[10]  + R64_1(q[11]) +       q[12]  + R64_2(q[13])
-               +       q[14]  + R64_3(q[15]) +       q[16]  + R64_4(q[17])
-               +       q[18]  + R64_5(q[19]) +       q[20]  + R64_6(q[21])
-               +       q[22]  + R64_7(q[23]) + S64_4(q[24]) + S64_5(q[25]);
+                + ( even  +=  q[22] - q[ 8] )
+                + R64_1(q[11]) + R64_2(q[13]) + R64_3(q[15])
+                + R64_4(q[17]) + R64_5(q[19]) + R64_6(q[21])
+                + R64_7(q[23]) + S64_4(q[24]) + S64_5(q[25]);
 /* expand_2(11) */
        q[27] = 
                ((  ROTL64(((uint64_t*)m)[11], 12) 
@@ -142,10 +145,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x8ffffffffffffff7ULL 
                 )^ ((uint64_t*)h)[ 2] 
                )
-               +       q[11]  + R64_1(q[12]) +       q[13]  + R64_2(q[14])
-               +       q[15]  + R64_3(q[16]) +       q[17]  + R64_4(q[18])
-               +       q[19]  + R64_5(q[20]) +       q[21]  + R64_6(q[22])
-               +       q[23]  + R64_7(q[24]) + S64_4(q[25]) + S64_5(q[26]);
+                + ( odd   +=  q[23] - q[ 9] )
+                + R64_1(q[12]) + R64_2(q[14]) + R64_3(q[16])
+                + R64_4(q[18]) + R64_5(q[20]) + R64_6(q[22])
+                + R64_7(q[24]) + S64_4(q[25]) + S64_5(q[26]);
 /* expand_2(12) */
        q[28] = 
                ((  ROTL64(((uint64_t*)m)[12], 13) 
@@ -154,10 +157,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x955555555555554cULL 
                 )^ ((uint64_t*)h)[ 3] 
                )
-               +       q[12]  + R64_1(q[13]) +       q[14]  + R64_2(q[15])
-               +       q[16]  + R64_3(q[17]) +       q[18]  + R64_4(q[19])
-               +       q[20]  + R64_5(q[21]) +       q[22]  + R64_6(q[23])
-               +       q[24]  + R64_7(q[25]) + S64_4(q[26]) + S64_5(q[27]);
+                + ( even  +=  q[24] - q[10] )
+                + R64_1(q[13]) + R64_2(q[15]) + R64_3(q[17])
+                + R64_4(q[19]) + R64_5(q[21]) + R64_6(q[23])
+                + R64_7(q[25]) + S64_4(q[26]) + S64_5(q[27]);
 /* expand_2(13) */
        q[29] = 
                ((  ROTL64(((uint64_t*)m)[13], 14) 
@@ -166,10 +169,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x9aaaaaaaaaaaaaa1ULL 
                 )^ ((uint64_t*)h)[ 4] 
                )
-               +       q[13]  + R64_1(q[14]) +       q[15]  + R64_2(q[16])
-               +       q[17]  + R64_3(q[18]) +       q[19]  + R64_4(q[20])
-               +       q[21]  + R64_5(q[22]) +       q[23]  + R64_6(q[24])
-               +       q[25]  + R64_7(q[26]) + S64_4(q[27]) + S64_5(q[28]);
+                + ( odd   +=  q[25] - q[11] )
+                + R64_1(q[14]) + R64_2(q[16]) + R64_3(q[18])
+                + R64_4(q[20]) + R64_5(q[22]) + R64_6(q[24])
+                + R64_7(q[26]) + S64_4(q[27]) + S64_5(q[28]);
 /* expand_2(14) */
        q[30] = 
                ((  ROTL64(((uint64_t*)m)[14], 15) 
@@ -178,10 +181,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0x9ffffffffffffff6ULL 
                 )^ ((uint64_t*)h)[ 5] 
                )
-               +       q[14]  + R64_1(q[15]) +       q[16]  + R64_2(q[17])
-               +       q[18]  + R64_3(q[19]) +       q[20]  + R64_4(q[21])
-               +       q[22]  + R64_5(q[23]) +       q[24]  + R64_6(q[25])
-               +       q[26]  + R64_7(q[27]) + S64_4(q[28]) + S64_5(q[29]);
+                + ( even  +=  q[26] - q[12] )
+                + R64_1(q[15]) + R64_2(q[17]) + R64_3(q[19])
+                + R64_4(q[21]) + R64_5(q[23]) + R64_6(q[25])
+                + R64_7(q[27]) + S64_4(q[28]) + S64_5(q[29]);
 /* expand_2(15) */
        q[31] = 
                ((  ROTL64(((uint64_t*)m)[15], 16) 
@@ -190,10 +193,10 @@ void bmw_large_f1(uint64_t* q, const void* m, const void* h){
                  + 0xa55555555555554bULL 
                 )^ ((uint64_t*)h)[ 6] 
                )
-               +       q[15]  + R64_1(q[16]) +       q[17]  + R64_2(q[18])
-               +       q[19]  + R64_3(q[20]) +       q[21]  + R64_4(q[22])
-               +       q[23]  + R64_5(q[24]) +       q[25]  + R64_6(q[26])
-               +       q[27]  + R64_7(q[28]) + S64_4(q[29]) + S64_5(q[30]);
+                + ( odd   +=  q[27] - q[13] )
+                + R64_1(q[16]) + R64_2(q[18]) + R64_3(q[20])
+                + R64_4(q[22]) + R64_5(q[24]) + R64_6(q[26])
+                + R64_7(q[28]) + S64_4(q[29]) + S64_5(q[30]);
 }
 
 /* END of automatic generated code */
index a6c10eab69accb7fb590264869538d85e70756f3..f0081ba52b1caad1ee6dce827def8f46284811f6 100644 (file)
@@ -2,6 +2,6 @@ source [find /usr/local/share/openocd/scripts/interface/luminary-icdi.cfg]
 source [find /usr/local/share/openocd/scripts/target/lm3s9b9x.cfg]
 # GDB can also flash my flash!
 gdb_memory_map enable
-gdb_flash_program enabe
+gdb_flash_program enable
 jtag_khz 500
 #source [find /usr/local/share/openocd/scripts/target/lm3s9b9x.cfg]