Browse Source

timing - silence valgrind warning

Karel Miko 8 years ago
parent
commit
03437a1bdd
1 changed files with 7 additions and 7 deletions
  1. 7 7
      demos/timing.c

+ 7 - 7
demos/timing.c

@@ -173,7 +173,7 @@ static void time_cipher_ecb(void)
   unsigned long x, y1;
   unsigned long x, y1;
   ulong64  t1, t2, c1, c2, a1, a2;
   ulong64  t1, t2, c1, c2, a1, a2;
   symmetric_ECB ecb;
   symmetric_ECB ecb;
-  unsigned char key[MAXBLOCKSIZE], pt[4096];
+  unsigned char key[MAXBLOCKSIZE] = { 0 }, pt[4096] = { 0 };
   int err;
   int err;
 
 
   fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
   fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
@@ -246,7 +246,7 @@ static void time_cipher_cbc(void)
   unsigned long x, y1;
   unsigned long x, y1;
   ulong64  t1, t2, c1, c2, a1, a2;
   ulong64  t1, t2, c1, c2, a1, a2;
   symmetric_CBC cbc;
   symmetric_CBC cbc;
-  unsigned char key[MAXBLOCKSIZE], pt[4096];
+  unsigned char key[MAXBLOCKSIZE] = { 0 }, pt[4096] = { 0 };
   int err;
   int err;
 
 
   fprintf(stderr, "\n\nCBC Time Trials for the Symmetric Ciphers:\n");
   fprintf(stderr, "\n\nCBC Time Trials for the Symmetric Ciphers:\n");
@@ -319,7 +319,7 @@ static void time_cipher_ctr(void)
   unsigned long x, y1;
   unsigned long x, y1;
   ulong64  t1, t2, c1, c2, a1, a2;
   ulong64  t1, t2, c1, c2, a1, a2;
   symmetric_CTR ctr;
   symmetric_CTR ctr;
-  unsigned char key[MAXBLOCKSIZE], pt[4096];
+  unsigned char key[MAXBLOCKSIZE] = { 0 }, pt[4096] = { 0 };
   int err;
   int err;
 
 
   fprintf(stderr, "\n\nCTR Time Trials for the Symmetric Ciphers:\n");
   fprintf(stderr, "\n\nCTR Time Trials for the Symmetric Ciphers:\n");
@@ -392,7 +392,7 @@ static void time_cipher_lrw(void)
   unsigned long x, y1;
   unsigned long x, y1;
   ulong64  t1, t2, c1, c2, a1, a2;
   ulong64  t1, t2, c1, c2, a1, a2;
   symmetric_LRW lrw;
   symmetric_LRW lrw;
-  unsigned char key[MAXBLOCKSIZE], pt[4096];
+  unsigned char key[MAXBLOCKSIZE] = { 0 }, pt[4096] = { 0 };
   int err;
   int err;
 
 
   fprintf(stderr, "\n\nLRW Time Trials for the Symmetric Ciphers:\n");
   fprintf(stderr, "\n\nLRW Time Trials for the Symmetric Ciphers:\n");
@@ -468,7 +468,7 @@ static void time_hash(void)
   ulong64 t1, t2, c1, c2;
   ulong64 t1, t2, c1, c2;
   hash_state md;
   hash_state md;
   int    (*func)(hash_state *, const unsigned char *, unsigned long), err;
   int    (*func)(hash_state *, const unsigned char *, unsigned long), err;
-  unsigned char pt[MAXBLOCKSIZE];
+  unsigned char pt[MAXBLOCKSIZE] = { 0 };
 
 
 
 
   fprintf(stderr, "\n\nHASH Time Trials for:\n");
   fprintf(stderr, "\n\nHASH Time Trials for:\n");
@@ -688,7 +688,7 @@ static void time_rsa(void)
 {
 {
    rsa_key       key;
    rsa_key       key;
    ulong64       t1, t2;
    ulong64       t1, t2;
-   unsigned char buf[2][2048];
+   unsigned char buf[2][2048] = { 0 };
    unsigned long x, y, z, zzz;
    unsigned long x, y, z, zzz;
    int           err, zz, stat;
    int           err, zz, stat;
 
 
@@ -934,7 +934,7 @@ static void time_ecc(void)
 {
 {
    ecc_key key;
    ecc_key key;
    ulong64 t1, t2;
    ulong64 t1, t2;
-   unsigned char buf[2][256];
+   unsigned char buf[2][256] = { 0 };
    unsigned long i, w, x, y, z;
    unsigned long i, w, x, y, z;
    int           err, stat;
    int           err, stat;
    static unsigned long sizes[] = {
    static unsigned long sizes[] = {