From: bg Date: Wed, 14 Jan 2009 18:44:53 +0000 (+0000) Subject: squeezing out a little more speed X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=398d0518495db71641bb0676b716002ac0ffd5da;p=avr-crypto-lib.git squeezing out a little more speed --- diff --git a/aes_enc-asm.S b/aes_enc-asm.S index 72b9e6e..a2235cf 100644 --- a/aes_enc-asm.S +++ b/aes_enc-asm.S @@ -207,7 +207,7 @@ aes_encrypt_core: eor T1, xREDUCER 3: eor T1, r1 - eor T1, ST01 + eor ST01, T1 mov T2, ST02 eor T2, ST03 @@ -216,7 +216,7 @@ aes_encrypt_core: eor T2, xREDUCER 3: eor T2, r1 - eor T2, ST02 + eor ST02, T2 mov T3, ST03 eor T3, ST00 @@ -225,13 +225,9 @@ aes_encrypt_core: eor T3, xREDUCER 3: eor T3, r1 - eor T3, ST03 + eor ST03, T3 mov ST00, T0 - mov ST01, T1 - mov ST02, T2 - mov ST03, T3 - mov r1, ST10 eor r1, ST11 @@ -254,7 +250,7 @@ aes_encrypt_core: eor T1, xREDUCER 3: eor T1, r1 - eor T1, ST11 + eor ST11, T1 mov T2, ST12 eor T2, ST13 @@ -263,7 +259,7 @@ aes_encrypt_core: eor T2, xREDUCER 3: eor T2, r1 - eor T2, ST12 + eor ST12, T2 mov T3, ST13 eor T3, ST10 @@ -272,12 +268,9 @@ aes_encrypt_core: eor T3, xREDUCER 3: eor T3, r1 - eor T3, ST13 + eor ST13, T3 mov ST10, T0 - mov ST11, T1 - mov ST12, T2 - mov ST13, T3 mov r1, ST20 eor r1, ST21 @@ -300,7 +293,7 @@ aes_encrypt_core: eor T1, xREDUCER 3: eor T1, r1 - eor T1, ST21 + eor ST21, T1 mov T2, ST22 eor T2, ST23 @@ -309,7 +302,7 @@ aes_encrypt_core: eor T2, xREDUCER 3: eor T2, r1 - eor T2, ST22 + eor ST22, T2 mov T3, ST23 eor T3, ST20 @@ -318,12 +311,9 @@ aes_encrypt_core: eor T3, xREDUCER 3: eor T3, r1 - eor T3, ST23 + eor ST23, T3 mov ST20, T0 - mov ST21, T1 - mov ST22, T2 - mov ST23, T3 mov r1, ST30 eor r1, ST31 @@ -346,7 +336,7 @@ aes_encrypt_core: eor T1, xREDUCER 3: eor T1, r1 - eor T1, ST31 + eor ST31, T1 mov T2, ST32 eor T2, ST33 @@ -355,7 +345,7 @@ aes_encrypt_core: eor T2, xREDUCER 3: eor T2, r1 - eor T2, ST32 + eor ST32, T2 mov T3, ST33 eor T3, ST30 @@ -364,12 +354,9 @@ aes_encrypt_core: eor T3, xREDUCER 3: eor T3, r1 - eor T3, ST33 + eor ST33, T3 mov ST30, T0 - mov ST31, T1 - mov ST32, T2 - mov ST33, T3 /* mix colums (rows) done */ diff --git a/host/gf256_table_gen.c b/host/gf256_table_gen.c index 87887d6..0d55db4 100644 --- a/host/gf256_table_gen.c +++ b/host/gf256_table_gen.c @@ -43,6 +43,23 @@ char* fmt_strings[]={"%d", "%3d", "0x%X", "0x%2.2X", "0%o", "0%3o"}; +void print_help(void){ + puts( +"gf256_table_gen [-cCbBdhoaApP] [-l min] [-u max]\n" +" [-f formatstring] [-o file] -r reducer value {values} \n" +"\n" +" -c/-C turn C-header on/off (default: on)\n" +" -b/-B turn braces on/off (defaul: on)\n" +" -d/-h/-8 print values in decimal/hexadecimal/octal (default: hexadecimal)\n" +" -a/-a turn alignment on/off (default: on)\n" +" -p/-P turn base prefix on/off (default: on)\n" +" -r reducer reducer is the reduction polynomial represented as numeric value\n" +" -l min starting value for multiplication table (default: 0)\n" +" -u max upper limit value for multiplication table (default: 255)\n" +" -f formatstring string for formating the output of a singel multiplicxation\n" +" -o file outputfile\n" +} + int main(int argc, char** argv){ int i,j; int c; @@ -65,6 +82,7 @@ int main(int argc, char** argv){ /* These options don't set a flag. We distinguish them by their indices. */ + {"help", no_argument , 0, '?'}, {"reducer", required_argument, 0, 'r'}, {"min", required_argument, 0, 'l'}, {"max", required_argument, 0, 'u'}, @@ -76,7 +94,7 @@ int main(int argc, char** argv){ unsigned long ul_a; int columns=8; - unsigned long ul_reducer=0x1b, max=0xff, min=0x00; + unsigned long ul_reducer=0x00, max=0xff, min=0x00; uint8_t reducer, a; char** eptr; FILE* of = stdout; @@ -90,7 +108,7 @@ int main(int argc, char** argv){ case 'B': print_braces=0; break; case 'h': print_base = 1; break; case 'd': print_base = 0; break; - case 'o': print_base = 2; break; + case '8': print_base = 2; break; case 'a': print_align =1; break; case 'A': print_align =0; break; case 'p': print_prefix=1; break; @@ -117,10 +135,16 @@ int main(int argc, char** argv){ } break; case 'f': fmt = optarg; break; - default: break; + case '?': + default: + print_help(); + break; } } - reducer = ul_reducer&0xff; + if(!reducer = ul_reducer&0xff){ + fprintf(stderr, "You must specify a reductionpolynomial!\n", argv[i]); + return -1; + } if(!fmt) fmt = fmt_strings[print_prefix*6+print_base*2+print_align];