Changeset 156


Ignore:
Timestamp:
Jan 13, 2008, 7:25:06 PM (17 years ago)
Author:
katerina
Message:

Put result vector of rng in skey struct, fix HP-UX compile error.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/acconfig.h

    r1 r156  
    342342/* Define if UINT64 is 32 bits.                 */
    343343#undef UINT64_IS_32
     344
     345/* Define if you have uint64_t.               */
     346#undef HAVE_UINT64_T
    344347
    345348/* Define if you have utmpx.h.                */
  • trunk/aclocal.m4

    r153 r156  
    250250    sh_cv_typedef_foo=`echo sh_cv_typedef_$1 | sed -e 's% %_%g'`
    251251    AC_CACHE_VAL( $sh_cv_typedef_foo,
    252     [AC_TRY_COMPILE([#include <stdlib.h>
    253     #include <sys/types.h>], [
     252    [AC_TRY_COMPILE([
     253#include <stdlib.h>
     254#include <sys/types.h>
     255#ifdef HAVE_STDINT_H
     256#include <stdint.h>
     257#endif
     258#ifdef HAVE_INTTYPES_H
     259#include <inttypes.h>
     260#endif], [
    254261    #undef $1
    255262    int a = sizeof($1);
  • trunk/configure.ac

    r153 r156  
    3434AC_SUBST(BUILD_CC)
    3535
    36 GCC_STACK_PROTECT_LIB
    37 GCC_STACK_PROTECT_CC
     36if test "x$GCC" == "xyes"; then
     37   GCC_STACK_PROTECT_LIB
     38   GCC_STACK_PROTECT_CC
     39fi
    3840
    3941AC_HEADER_STDC
     
    399401AC_C_LONG_DOUBLE
    400402SH_CHECK_TYPEDEF(long long, HAVE_LONG_LONG)
     403SH_CHECK_TYPEDEF(uint64_t, HAVE_UINT64_T)
    401404if test "$sh_HAVE_LONG_LONG" = "yes"; then
    402405   AC_CHECK_SIZEOF(unsigned long long, 4)
  • trunk/docs/Changelog

    r154 r156  
    112.4.2:
     2        * put result vector of rng in skey struct
    23        * fix more compiler warnings, and a potential (compiler-dependent)
    34          NULL dereference in the unix entropy collector
  • trunk/include/samhain.h

    r149 r156  
    9898#ifdef HAVE_INTTYPES_H
    9999#include <inttypes.h>
    100 #else
     100#endif
    101101#ifdef HAVE_STDINT_H
    102102#include <stdint.h>
    103103#endif
    104 #endif
    105 
    106 #if !defined(HAVE_INTTYPES_H) && !defined(HAVE_STDINT_H)
     104
     105#if !defined(HAVE_UINT64_T)
    107106
    108107#ifdef HAVE_LONG_LONG_64
     
    112111#define  UINT64 unsigned long
    113112#else
    114 #define UINT64_IS_32
    115 #define  UINT64 unsigned long
     113#error "no 64bit type found"
    116114#endif
    117115#endif
     
    135133#define SH_MOD_ACTIVE  0
    136134#define SH_MOD_FAILED -1
    137  
     135
    138136/* Flags for file status
    139137 */
     
    325323  UINT32 rng2[3];
    326324
     325  UINT32 res_vec[6];
     326
    327327  UINT32 ErrFlag[2];
    328328
  • trunk/include/sh_unix.h

    r149 r156  
    2323#define SH_UNIX_H
    2424
     25/* For PATH_MAX */
    2526#include <limits.h>
     27#if !defined(PATH_MAX)
     28#define PATH_MAX 1024
     29#endif
     30
    2631#include <unistd.h>
    2732#include "samhain.h"
  • trunk/include/slib.h

    r149 r156  
    6868#define SL_GNUC_CONST   __attribute__((const))
    6969#else
    70 #undef  SH_GNUC_CONST
    71 #define SH_GNUC_CONST
     70#undef  SL_GNUC_CONST
     71#define SL_GNUC_CONST
    7272#endif
    7373
  • trunk/src/sh_utils.c

    r149 r156  
    941941UINT32 taus_get ()
    942942{
    943   UINT32   taus_svec[6];
     943#define TAUS_SAMPLE 12
     944
     945  UINT32   taus_svec[TAUS_SAMPLE];
    944946  UINT32   retval;
    945947  UINT32 * res;
    946   static   UINT32   res_vec[6];
     948  UINT32 * res_vec = &(skey->res_vec[0]);
    947949  static   int      res_num = 0;
    948950  register int i;
     
    962964
    963965  SH_MUTEX_LOCK_UNSAFE(mutex_skey);
    964   taus_svec[0] = taus_get_long (&(skey->rng0[0]));
    965   taus_svec[1] = taus_get_long (&(skey->rng1[0]));
    966   taus_svec[2] = taus_get_long (&(skey->rng2[0]));
    967   taus_svec[3] = taus_get_long (&(skey->rng0[0]));
    968   taus_svec[4] = taus_get_long (&(skey->rng1[0]));
    969   taus_svec[5] = taus_get_long (&(skey->rng2[0]));
     966  for (i = 0; i < (TAUS_SAMPLE/3); ++i)
     967    {
     968      taus_svec[i*3]   = taus_get_long (&(skey->rng0[0]));
     969      taus_svec[i*3+1] = taus_get_long (&(skey->rng1[0]));
     970      taus_svec[i*3+2] = taus_get_long (&(skey->rng2[0]));
     971    }
    970972  SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    971973
    972974  res     = sh_tiger_hash_uint32 ( (char *) &taus_svec[0],
    973975                                   TIGER_DATA,
    974                                    (unsigned long)(6 * sizeof(UINT32)),
     976                                   (unsigned long)(TAUS_SAMPLE * sizeof(UINT32)),
    975977                                   kbuf, KEY_BYT/sizeof(UINT32));
    976978
     
    980982      res_vec[i] = res[i];
    981983    }
    982   retval  = taus_svec[0];
     984  retval  = res[0];
    983985  res_num = 1;
    984986  SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    985987
    986   taus_svec[0] = 0; taus_svec[1] = 0; taus_svec[2] = 0;
    987   taus_svec[3] = 0; taus_svec[4] = 0; taus_svec[5] = 0;
     988  memset(taus_svec, '\0', TAUS_SAMPLE * sizeof(UINT32));
    988989
    989990  return retval;
Note: See TracChangeset for help on using the changeset viewer.