Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (10 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_tiger1_64.c

    r474 r481  
    384384void tiger_compress(const word64 *str, word64 state[3])
    385385{
    386   tiger_compress_macro(((word64*)str), ((word64*)state));
     386  tiger_compress_macro(((const word64*)str), ((word64*)state));
    387387}
    388388
     
    419419  register word64 i;
    420420  register word64 j = 0;
    421   unsigned char temp[64];
     421  union {
     422    word64 w64_temp[8];
     423    unsigned char temp[64];
     424  } dd;
    422425  union {
    423426    word64 itmp;
     
    435438#ifdef BIG_ENDIAN
    436439      for(j=0; j<64; j++)
    437         temp[j^7] = ((sh_byte*)str)[j];
    438       tiger_compress(((word64*)temp), res);
     440        dd.temp[j^7] = ((sh_byte*)str)[j];
     441      tiger_compress((dd.w64_temp), res);
    439442#else
    440443      tiger_compress(str, res);
     
    445448#ifdef BIG_ENDIAN
    446449  for(j=0; j<i; j++)
    447     temp[j^7] = ((sh_byte*)str)[j];
    448 
    449   temp[j^7] = 0x01;
     450    dd.temp[j^7] = ((sh_byte*)str)[j];
     451
     452  dd.temp[j^7] = 0x01;
    450453  j++;
    451454  for(; j&7; j++)
    452     temp[j^7] = 0;
     455    dd.temp[j^7] = 0;
    453456#else
    454457
    455458#ifndef USE_MEMSET
    456459  for(j=0; j<i; j++)
    457     temp[j] = ((sh_byte*)str)[j];
    458 #else
    459   memcpy( temp, str, j=i );
    460 #endif
    461   temp[j++] = 0x01;
     460    dd.temp[j] = ((const sh_byte*)str)[j];
     461#else
     462  memcpy( dd.temp, str, j=i );
     463#endif
     464  dd.temp[j++] = 0x01;
    462465  for(; j&7; j++)
    463         temp[j] = 0;
     466        dd.temp[j] = 0;
    464467
    465468#endif
     
    469472#ifndef USE_MEMSET
    470473      for(; j<64; j++)
    471         temp[j] = 0;
    472 #else
    473       memset( temp+j, 0, 64-j);
    474 #endif
    475       tiger_compress(((word64*)temp), res);
     474        dd.temp[j] = 0;
     475#else
     476      memset( (dd.temp)+j, 0, 64-j);
     477#endif
     478      tiger_compress((dd.w64_temp), res);
    476479      j=0;
    477480    }
     
    479482#ifndef USE_MEMSET
    480483  for(; j<56; j++)
    481     temp[j] = 0;
    482 #else
    483   memset( temp+j, 0, 56-j);
     484    dd.temp[j] = 0;
     485#else
     486  memset( (dd.temp)+j, 0, 56-j);
    484487#endif
    485488
     
    488491  uu.itmp = ((word64)length)<<3;
    489492  for (j=0; j<8; j++)
    490         temp[56+j] = uu.ctmp[j];
    491 
    492   tiger_compress(((word64*)temp), res);
     493        dd.temp[56+j] = uu.ctmp[j];
     494
     495  tiger_compress((dd.w64_temp), res);
    493496}
    494497
Note: See TracChangeset for help on using the changeset viewer.