From ae0fee058ad883b2e82fa2b34f4e5f059e827a1b Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 14 Mar 2007 00:35:06 +0000 Subject: * include/k5-platform.h: Add load_{16,32,64}_n for loading values from (possibly unaligned) memory in native order. * lib/krb5/krb/get_in_tkt.c (krb5_get_init_creds): Fetch four random bytes from the crypto library and generate a 31-bit (non-negative) nonce, instead of using the timestamp. ticket: 5425 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19223 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-platform.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/include') diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h index 876335f94d..27f85846ac 100644 --- a/src/include/k5-platform.h +++ b/src/include/k5-platform.h @@ -39,6 +39,8 @@ #define K5_PLATFORM_H #include "autoconf.h" +/* for memcpy */ +#include /* Initialization and finalization function support for libraries. @@ -655,6 +657,28 @@ load_64_le (const unsigned char *p) #endif } +static inline unsigned short +load_16_n (const unsigned char *p) +{ + uint16_t n; + memcpy(&n, p, 2); + return n; +} +static inline unsigned int +load_32_n (const unsigned char *p) +{ + uint32_t n; + memcpy(&n, p, 4); + return n; +} +static inline UINT64_TYPE +load_64_n (const unsigned char *p) +{ + UINT64_TYPE n; + memcpy(&n, p, 8); + return n; +} + /* Make the interfaces to getpwnam and getpwuid consistent. Model the wrappers on the POSIX thread-safe versions, but use the unsafe system versions if the safe ones don't exist -- cgit