]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - host/gf256_table_gen.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / host / gf256_table_gen.c
index 0d55db48f44acaa66954151ae676f1166129f436..d9217c896f7a7e41fa980a8632a94d323942cc47 100644 (file)
@@ -1,7 +1,7 @@
 /* gf256_table_gen.c */
 /*
-    This file is part of the Crypto-avr-lib/microcrypt-lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 */
 /**
  * \file     gf256_table_gen.c
- * \email    daniel.otte@rub.de
+ * \email    bg@nerilex.org
  * \author   Daniel Otte 
  * \date     2009-01-13
  * \license  GPLv3 or later
@@ -36,7 +36,7 @@ int print_header =  1,
     print_align  =  1,
     print_prefix =  1;
 
-charfmt_strings[]={"%d", "%3d",
+char *fmt_strings[]={"%d", "%3d",
                      "%X", "%2.2X",
                      "%o", "%3o",
                      "%d", "%3d",
@@ -58,13 +58,14 @@ void print_help(void){
 " -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;
        int option_index=0;
-       charfmt=NULL;
+       char *fmt=NULL;
        static struct option long_options[] =
              {
                /* These options set a flag. */
@@ -97,9 +98,9 @@ int main(int argc, char** argv){
        unsigned long ul_reducer=0x00, max=0xff, min=0x00;
        uint8_t reducer, a;
        char** eptr;
-       FILEof = stdout;
+       FILE *of = stdout;
        while(c!=-1){
-               c = getopt_long(argc, argv,"cCbBdhoaApPr:l:u:f:", 
+               c = getopt_long(argc, argv,"cCbBdh8aApPr:l:u:f:", 
                                long_options, &option_index);
                switch(c){
                        case 'c': print_header=1; break;
@@ -135,13 +136,16 @@ int main(int argc, char** argv){
                                          }
                                          break;
                        case 'f': fmt = optarg; break;
+                       case  -1: break;
                        case '?': 
                        default: 
+                               printf ("unknown option '%c' (%2.2X) !\n\t", c, c);
                                print_help();
+                               return 0;
                                break;
                }
        }
-       if(!reducer = ul_reducer&0xff){
+       if(!(reducer = ul_reducer&0xff)){
                        fprintf(stderr, "You must specify a reductionpolynomial!\n", argv[i]);
                        return -1;
        }