Changeset 481 for trunk/src/sh_tiger0.c


Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (6 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_tiger0.c

    r444 r481  
    5555#endif
    5656
     57#if defined(__GNUC__) && (__GNUC__ >= 3)
     58#undef  SH_GNUC_ALIGN8
     59#define SH_GNUC_ALIGN8   __attribute__((aligned(8)))
     60#else
     61#undef  SH_GNUC_ALIGN8
     62#define SH_GNUC_ALIGN8
     63#endif
     64
     65
    5766typedef unsigned char sh_byte;
    5867
     
    121130  char    * tmp;
    122131  sh_byte * bptr;
    123   sh_byte   bbuf[64];
     132  sh_byte   SH_GNUC_ALIGN8 bbuf[64];
    124133  UINT64    bcount = 0;
    125134
     
    186195
    187196#if defined(HAVE_MLOCK) && !defined(HAVE_BROKEN_MLOCK)
    188     if (skey->mlock_failed == SL_FALSE)
     197    if (skey->mlock_failed == S_FALSE)
    189198      {
    190199        if ( (-1) == sh_unix_mlock(FIL__, __LINE__,
     
    193202          {
    194203            SH_MUTEX_LOCK_UNSAFE(mutex_skey); 
    195             skey->mlock_failed = SL_TRUE;
     204            skey->mlock_failed = S_TRUE;
    196205            SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    197206          }
    198207      }
    199208#else
    200     if (skey->mlock_failed == SL_FALSE)
     209    if (skey->mlock_failed == S_FALSE)
    201210      {
    202211        SH_MUTEX_LOCK_UNSAFE(mutex_skey); 
    203         skey->mlock_failed = SL_TRUE;
     212        skey->mlock_failed = S_TRUE;
    204213        SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    205214      }
     
    215224      {
    216225        if (timeout > 0)
    217           count = sl_read_timeout (fd, buffer, PRIV_MAX, timeout, SL_TRUE);
     226          count = sl_read_timeout (fd, buffer, PRIV_MAX, timeout, S_TRUE);
    218227        else
    219228          count = sl_read         (fd, buffer, PRIV_MAX);
     
    903912
    904913      n = (off_t) sl_read_timeout (fd, buffer + sum,
    905                                    (size_t) BLOCKSIZE - sum, timeout, SL_FALSE);
     914                                   (size_t) BLOCKSIZE - sum, timeout, S_FALSE);
    906915
    907916      if (SL_ISERROR (n))
     
    14501459    do {
    14511460      n = (off_t) sl_read_timeout(fd, buffer + sum,
    1452                                   (size_t) BLOCKSIZE - sum, timeout, SL_FALSE);
     1461                                  (size_t) BLOCKSIZE - sum, timeout, S_FALSE);
    14531462
    14541463      if (SL_ISERROR (n))
     
    16091618}
    16101619
     1620void sh_tiger_get_mask_hashtype(unsigned long * mask)
     1621{
     1622  if (hash_type == SH_TIGER192)
     1623    *mask |= MODI_TIGER192;
     1624  else if (hash_type == SH_SHA1)
     1625    *mask |= MODI_SHA1;
     1626  else if (hash_type == SH_MD5)
     1627    *mask |= MODI_MD5;
     1628  else if (hash_type == SH_SHA256)
     1629    *mask |= MODI_SHA256;
     1630  return;
     1631}
     1632
     1633void sh_tiger_set_hashtype_mask(unsigned long mask)
     1634{
     1635  unsigned long type = mask & MODI_HASHTYPE;
     1636
     1637  if (type == MODI_TIGER192)
     1638    hash_type = SH_TIGER192;
     1639  else if (type == MODI_SHA1)
     1640    hash_type = SH_SHA1;
     1641  else if (type == MODI_MD5)
     1642    hash_type = SH_MD5;
     1643  else if (type == MODI_SHA256)
     1644    hash_type = SH_SHA256;
     1645  return;
     1646}
     1647
     1648
    16111649int sh_tiger_hashtype (const char * c)
    16121650{
Note: See TracChangeset for help on using the changeset viewer.