Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / kauth / kauth_internal.h
blob150334e93697c5f0581459a827217a69e42839e0
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9 #ifndef AFS_SRC_KAUTH_INTERNAL_H
10 #define AFS_SRC_KAUTH_INTERNAL_H
12 /* admin_tools.c */
13 extern afs_int32 ka_AdminInteractive(int cmd_argc, char *cmd_argv[]);
15 /* kadatabase.c */
16 extern void init_kadatabase(int initFlags);
18 extern afs_int32 ka_LookupKey(struct ubik_trans *tt,
19 char *name, char *inst,
20 afs_int32 *kvno,
21 struct ktc_encryptionKey *key);
23 struct kaentry;
24 extern afs_int32 FindBlock(struct ubik_trans *at, char *aname,
25 char *ainstance, afs_int32 *toP,
26 struct kaentry *tentry);
28 extern afs_int32 ThreadBlock(struct ubik_trans *at, afs_int32 index,
29 struct kaentry *tentry);
31 extern afs_int32 ka_FillKeyCache(struct ubik_trans *tt);
33 extern afs_int32 CheckInit(struct ubik_trans *at,
34 int (*db_init) (struct ubik_trans *));
36 extern afs_int32 AllocBlock(struct ubik_trans *at, struct kaentry *tentry);
38 extern afs_int32 ka_NewKey(struct ubik_trans *tt, afs_int32 tentryaddr,
39 struct kaentry *tentry,
40 struct ktc_encryptionKey *key);
42 extern int name_instance_legal(char *name, char *instance);
44 /* kalog.c */
45 extern void kalog_Init(void);
47 /* kaprocs.c */
48 struct ubik_trans;
49 extern afs_int32 InitAuthServ(struct ubik_trans **, int, int *);
51 /* krb_tf.c */
52 extern afs_int32 krb_write_ticket_file(char *realm);
54 /* krb_udp.c */
55 extern afs_int32 init_krb_udp(void);
57 static_inline unsigned char *
58 EncryptionKey_to_cblock(EncryptionKey *key) {
59 return (unsigned char *)key;
62 static_inline struct ktc_encryptionKey *
63 EncryptionKey_to_ktc(EncryptionKey *key) {
64 return (struct ktc_encryptionKey *)key;
67 static_inline EncryptionKey *
68 ktc_to_EncryptionKey(struct ktc_encryptionKey *key) {
69 return (EncryptionKey *)key;
73 * Some of the RPCs need to verify that two times are within a given
74 * skew window (usually KTC_TIME_UNCERTAINTY, 15 minutes). However,
75 * there are multiple sources of timestamps. The "AFS-native" type,
76 * Date, is afs_uint32; timestamps fetched from the system will
77 * generally be the output of time(NULL), i.e., time_t. However, the
78 * base type of time_t is platform-dependent -- on some systems, it
79 * is int32_t, and on others it is int64_t. Arithmetic operations
80 * and comparisons between integers of different type are subject to
81 * the usual arithmetic promotions in C -- comparing a uint32_t and
82 * an int32_t results in the int32_t being "promoted" to uint32_t, which
83 * has disasterous consequences when the value being promoted is
84 * negative. If, on the other hand, time_t is int64_t, then the promotions
85 * work the other way, with everything evaluated at int64_t precision,
86 * since int64_t has a higher conversion rank than int32_t (which has
87 * the same conversion rank as uint32_t). In order to properly and
88 * portably check the time skew, it is simplest to cast everything to
89 * afs_int64 before evaluating any expressions.
91 * The expression evaluates to true if the absolute value of the difference
92 * between the two time inputs is larger than the skew.
94 #define check_ka_skew(__t1, __t2, __skew) \
95 ((afs_int64)(__t1) - (afs_int64)(__skew) > (afs_int64)(__t2) || \
96 (afs_int64)(__t2) - (afs_int64)(__skew) > (afs_int64)(__t1))
98 #endif