From: Sam Hartman Date: Thu, 8 Nov 2001 22:50:21 +0000 (+0000) Subject: First pass cleaning up headers and types X-Git-Tag: krb5-1.3-alpha1~958 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=57ff23538aea342704c6ec97307dfb4797d6dc6d;p=krb5.git First pass cleaning up headers and types git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13971 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/yarrow/ChangeLog b/src/lib/crypto/yarrow/ChangeLog new file mode 100644 index 000000000..4581ea036 --- /dev/null +++ b/src/lib/crypto/yarrow/ChangeLog @@ -0,0 +1,9 @@ +2001-11-08 Sam Hartman + + * yarrow.h: Don't use #error + (YARROW_DLL): Don't actually ever export or import from win32 dlls as Yarrow is not a public part of krb5 API + (yarrow_poll): Drop from the API + Remove MAc-specific memset and memcpy + + * ytypes.h yarrow.c: Align with krb5 int types + diff --git a/src/lib/crypto/yarrow/yarrow.c b/src/lib/crypto/yarrow/yarrow.c index 74dc809cb..3c5d83862 100644 --- a/src/lib/crypto/yarrow/yarrow.c +++ b/src/lib/crypto/yarrow/yarrow.c @@ -601,7 +601,7 @@ int Yarrow_Reseed(Yarrow_CTX* y, int pool) HASH_CTX hash; byte v_0[HASH_DIGEST_SIZE]; byte v_i[HASH_DIGEST_SIZE]; - uint32 big_endian_int32; + krb5_ui_4 big_endian_int32; COUNTER i; if (!y) { THROW( YARROW_BAD_ARG ); } @@ -654,9 +654,9 @@ int Yarrow_Reseed(Yarrow_CTX* y, int pool) HASH_Update(&hash, v_i, sizeof(v_i)); HASH_Update(&hash, v_0, sizeof(v_0)); big_endian_int32 = make_big_endian32(i >> 32); /* MS word */ - HASH_Update(&hash, &big_endian_int32, sizeof(uint32)); + HASH_Update(&hash, &big_endian_int32, sizeof(krb5_ui_4)); big_endian_int32 = make_big_endian32(i & 0xFFFFFFFF); /* LS word */ - HASH_Update(&hash, &big_endian_int32, sizeof(uint32)); + HASH_Update(&hash, &big_endian_int32, sizeof(krb5_ui_4)); HASH_Final(&hash, v_i); } diff --git a/src/lib/crypto/yarrow/yarrow.h b/src/lib/crypto/yarrow/yarrow.h index dc74a3ba0..b8b888405 100644 --- a/src/lib/crypto/yarrow/yarrow.h +++ b/src/lib/crypto/yarrow/yarrow.h @@ -3,7 +3,8 @@ #ifndef YARROW_H #define YARROW_H -#if defined( YARROW_DETECT_FORK ) +#ifdef HAVE_UNISTD_H +#define YARROW_DETECT_FORK #include #endif @@ -66,19 +67,19 @@ extern "C" { /* sanity checks */ #if YARROW_FAST_THRESH > YARROW_POOL_SIZE -#error "can't have higher YARROW_FAST_THRESH than pool size" +error "can't have higher YARROW_FAST_THRESH than pool size" #endif #if YARROW_SLOW_THRESH > YARROW_POOL_SIZE -#error "can't have higher YARROW_SLOW_THRESH than pool size" +error "can't have higher YARROW_SLOW_THRESH than pool size" #endif #if YARROW_FAST_INIT_THRESH > YARROW_POOL_SIZE -#error "can't have higher YARROW_FAST_INIT_THRESH than pool size" +error "can't have higher YARROW_FAST_INIT_THRESH than pool size" #endif #if YARROW_SLOW_INIT_THRESH > YARROW_POOL_SIZE -#error "can't have higher YARROW_SLOW_INIT_THRESH than pool size" +error "can't have higher YARROW_SLOW_INIT_THRESH than pool size" #endif typedef size_t estimator_fn(const void* sample, size_t size); @@ -124,21 +125,12 @@ typedef struct int slow_k_of_n_thresh; } Yarrow_CTX; -#if defined(WIN32) -# if defined(YARROW_IMPL) -# define YARROW_DLL __declspec(dllexport) -# else -# define YARROW_DLL __declspec(dllimport) -# endif -#else # define YARROW_DLL -#endif + YARROW_DLL int Yarrow_Init( Yarrow_CTX* y, const char *filename ); -YARROW_DLL -int Yarrow_Poll( Yarrow_CTX *y, unsigned source_id ); YARROW_DLL int Yarrow_Input( Yarrow_CTX* y, unsigned source_id, @@ -175,22 +167,16 @@ YARROW_DLL const char* Yarrow_Str_Error( int ); -/* portability stuff */ - -#if defined(macintosh) && YARROW_DRIVER && TARGET_CPU_PPC -# define mem_zero(p, n) BlockZero((p), (n)) -# define mem_copy(d, s, n) BlockMoveData((s), (d), (n)) -#else # define mem_zero(p, n) memset((p), 0, (n)) # define mem_copy(d, s, n) memcpy((d), (s), (n)) -#endif + #if !defined(WIN32) # define min(x, y) ((x) < (y) ? (x) : (y)) # define max(x, y) ((x) > (y) ? (x) : (y)) #endif -/* end portability stuff */ + #ifdef __cplusplus } diff --git a/src/lib/crypto/yarrow/ytypes.h b/src/lib/crypto/yarrow/ytypes.h index dc0809817..d79bb7ed9 100644 --- a/src/lib/crypto/yarrow/ytypes.h +++ b/src/lib/crypto/yarrow/ytypes.h @@ -7,44 +7,16 @@ #include #include -#ifdef WIN32 -# include -#endif - #define byte unsigned char #define uint8 unsigned char #define int8 signed char -#define int16 signed short -#define uint16 unsigned short - -#if (ULONG_MAX > 0xFFFFFFFFUL) -# define int32 signed int -# define uint32 unsigned int -# define int64 signed long -# define uint64 unsigned long -#else -# define int32 signed long -# define uint32 unsigned long -# if defined(__GNUC__) -# define int64 signed long long -# define uint64 unsigned long long -# elif defined(__sgi) -# define int64 __int64_t -# define uint64 __uint64_t -# elif defined(__MWERKS__) -# define int64 signed long long -# define uint64 unsigned long long -# elif defined(WIN32) -# define uint64 unsigned __int64 -# endif -#endif #if defined(uint64) # define COUNTER uint64 #else -# define COUNTER uint32 +# define COUNTER krb5_ui_4 #endif #define COUNTER_MAX ((COUNTER)0 - 1)