[svn] / ecrypt / trunk / test / ecrypt-test.c  

svn: ecrypt/trunk/test/ecrypt-test.c

Diff for /ecrypt/trunk/test/ecrypt-test.c between version 48 and 59

version 48, Thu Aug 4 20:07:05 2005 UTC version 59, Mon Aug 15 21:47:12 2005 UTC
Line 82 
Line 82 
 double cpu_speed = 0.0;  double cpu_speed = 0.0;
 double test_time = 3.0;  double test_time = 3.0;
   
   int quiet = 0;
 int test_packet = 1;  int test_packet = 1;
 int test_setup = 1;  int test_setup = 1;
 int output_vectors = 0;  int output_vectors = 0;
Line 97 
Line 98 
   
   if (errors >= 10)    if (errors >= 10)
     {      {
       fprintf(stderr, "Too many errors (%d errors). Aborting test.\n", errors);        if (!quiet)
       exit(1);          fprintf(stderr,
             "Too many errors (%d errors). Aborting test.\n", errors);
   
         exit(3);
     }      }
   
   if (sec > test_time)    if (sec > test_time)
     {      {
       fprintf(stderr, "Time out (%.2f seconds). Aborting test.\n", sec);        if (!quiet)
       exit(2);          fprintf(stderr,
             "Time out (%.2f seconds). Aborting test.\n", sec);
   
         exit(1);
     }      }
 }  }
   
Line 180 
Line 187 
   fprintf(fd, "Primitive Name: %s\n", ECRYPT_NAME);    fprintf(fd, "Primitive Name: %s\n", ECRYPT_NAME);
   fprintf(fd, "================%.*s\n", (int)strlen(ECRYPT_NAME),    fprintf(fd, "================%.*s\n", (int)strlen(ECRYPT_NAME),
           "==========================================");            "==========================================");
     fprintf(fd, "Profile: %s\n", ECRYPT_PROFILE);
   fprintf(fd, "Key size: %d bits\n", keysize);    fprintf(fd, "Key size: %d bits\n", keysize);
   fprintf(fd, "IV size: %d bits\n", ivsize);    fprintf(fd, "IV size: %d bits\n", ivsize);
 #ifdef ECRYPT_AE  #ifdef ECRYPT_AE
Line 210 
Line 218 
   
   CTX ctx;    CTX ctx;
   
   u8 key[MAXKEYSIZEB];    ALIGN(u8 key[MAXKEYSIZEB]);
   u8 iv[MAXIVSIZEB];    ALIGN(u8 iv[MAXIVSIZEB]);
   
   u8 plaintext[LONG_TEST_STREAM_SIZEB];    ALIGN(u8 plaintext[LONG_TEST_STREAM_SIZEB]);
   u8 ciphertext[LONG_TEST_STREAM_SIZEB];    ALIGN(u8 ciphertext[LONG_TEST_STREAM_SIZEB]);
   u8 checktext[LONG_TEST_STREAM_SIZEB];    ALIGN(u8 checktext[LONG_TEST_STREAM_SIZEB]);
   
 #ifdef ECRYPT_AE  #ifdef ECRYPT_AE
   int macsize;    int macsize;
   int aadlen;    int aadlen;
   
   u8 aad[TEST_CHUNK];    ALIGN(u8 aad[TEST_CHUNK]);
   u8 mac[MAXMACSIZEB];    ALIGN(u8 mac[MAXMACSIZEB]);
   u8 checkmac[MAXMACSIZEB];    ALIGN(u8 checkmac[MAXMACSIZEB]);
 #endif  #endif
   
   u8 xored[TEST_CHUNK];    ALIGN(u8 xored[TEST_CHUNK]);
   
   FILE *fd;    FILE *fd;
   
Line 784 
Line 792 
 {  {
   CTX ctx[2];    CTX ctx[2];
   
   u8 key[2][MAXKEYSIZEB];    ALIGN(u8 key[2][MAXKEYSIZEB]);
   u8 iv[2][MAXIVSIZEB];    ALIGN(u8 iv[2][MAXIVSIZEB]);
   
   u8 plaintext[TEST_CHUNK + ECRYPT_BLOCKLENGTH];    ALIGN(u8 plaintext[TEST_CHUNK + ECRYPT_BLOCKLENGTH]);
   u8 ciphertext[3][TEST_CHUNK + ECRYPT_BLOCKLENGTH];    ALIGN(u8 ciphertext[3][TEST_CHUNK + ECRYPT_BLOCKLENGTH]);
 #ifdef ECRYPT_AE  #ifdef ECRYPT_AE
   u8 mac[3][MAXMACSIZEB];    ALIGN(u8 mac[3][MAXMACSIZEB]);
 #endif  #endif
   
   int msglen = TEST_CHUNK;    int msglen = TEST_CHUNK;
Line 1135 
Line 1143 
 {  {
   CTX ctx[KEYS_TO_TEST];    CTX ctx[KEYS_TO_TEST];
   
   u8 key[KEYS_TO_TEST][MAXKEYSIZEB];    ALIGN(u8 key[KEYS_TO_TEST][MAXKEYSIZEB]);
   u8 iv[KEYS_TO_TEST][MAXIVSIZEB];    ALIGN(u8 iv[KEYS_TO_TEST][MAXIVSIZEB]);
   u8 text[2][TEST_BLOCKS * ECRYPT_BLOCKLENGTH];    ALIGN(u8 text[2][TEST_BLOCKS * ECRYPT_BLOCKLENGTH]);
 #ifdef ECRYPT_AE  #ifdef ECRYPT_AE
   u8 mac[MAXMACSIZEB];    ALIGN(u8 mac[MAXMACSIZEB]);
 #endif  #endif
   
   int tests, tests_per_key, keys_to_test;    int tests, tests_per_key, keys_to_test;
Line 1389 
Line 1397 
         case 's':          case 's':
           single_key = 1;            single_key = 1;
           break;            break;
           case 'q':
             quiet = 1;
             break;
         }          }
   
       argc--;        argc--;
Line 1405 
Line 1416 
              "  -t SEC  limit the duration of the tests (default: 3 seconds)\n"               "  -t SEC  limit the duration of the tests (default: 3 seconds)\n"
              "  -p      do not test packet encryption speed\n"               "  -p      do not test packet encryption speed\n"
              "  -k      do not test key and IV setup speed\n"               "  -k      do not test key and IV setup speed\n"
              "  -s      perform tests for a single key and IV length\n");               "  -s      perform tests for a single key and IV length\n"
                "  -q      be quiet\n");
   
       exit(1);        exit(2);
     }      }
   
   print_header(stdout);    print_header(stdout);
Line 1505 
Line 1517 
           }            }
       }        }
   
     if (!quiet)
       {
   fprintf(stderr, "Elapsed time: %.2f seconds.\n",    fprintf(stderr, "Elapsed time: %.2f seconds.\n",
     (double)clock() / (double)CLOCKS_PER_SEC);      (double)clock() / (double)CLOCKS_PER_SEC);
   fprintf(stderr, "There were %d errors.\n", errors);    fprintf(stderr, "There were %d errors.\n", errors);
       }
   
   if (errors)    if (errors)
     return 1;      return 3;
   else    else
     return 0;      return 0;
 }  }


Generate output suitable for use with a patch program
Legend:
Removed from v.48  
changed lines
  Added in v.59

eSTREAM Project

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help