summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2007-03-14 00:35:06 +0000
committerKen Raeburn <raeburn@mit.edu>2007-03-14 00:35:06 +0000
commitae0fee058ad883b2e82fa2b34f4e5f059e827a1b (patch)
tree9ea6a4f3bd613f92bccaaa851233c2457581a513 /src/include
parent47c316a300fd057dd220552fa159d002ab98a3fe (diff)
downloadkrb5-ae0fee058ad883b2e82fa2b34f4e5f059e827a1b.tar.gz
krb5-ae0fee058ad883b2e82fa2b34f4e5f059e827a1b.tar.xz
krb5-ae0fee058ad883b2e82fa2b34f4e5f059e827a1b.zip
* 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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/k5-platform.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 876335f94..27f85846a 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 <string.h>
/* 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