1 /* src/rxgk/rxgk_private.h - Declarations of RXGK-internal routines */
3 * Copyright (C) 2013, 2014 by the Massachusetts Institute of Technology.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Prototypes for routines internal to RXGK.
36 #ifndef RXGK_PRIVATE_H
37 #define RXGK_PRIVATE_H
39 /* RX-internal headers we depend on. */
40 #include <rx/rx_identity.h>
42 /** Statistics about a connection. Bytes and packets sent/received. */
50 /* The packet pseudoheader used for auth and crypt connections. */
54 afs_uint32 callNumber;
58 } __attribute__((packed));
65 * Security Object private data for the server.
67 * Per-connection flags, and a way to get a decryption key for what the client
70 struct rxgk_sprivate {
73 rxgk_getkey_func getkey;
76 * Per-connection security data for the server.
78 * Security level, authentication state, expiration, the current challenge
79 * nonce, status, the connection start time and current key derivation key
80 * number. Cache both the user identity and callback identity presented
81 * in the token, for later use.
85 unsigned char tried_auth;
88 unsigned char challenge[RXGK_CHALLENGE_NONCE_LEN];
89 struct rxgkStats stats;
91 struct rx_identity *client;
92 afs_uint32 key_number;
103 * Security Object private data for client.
105 * The session key ("token master key"), plust the enctype of the
106 * token and the token itself.
107 * UUIDs for both the client (cache manager) and target server. This is
108 * doable because the token is either a db server (the target has no UUID)
109 * or tied to a particular file server (which does have a UUID).
111 struct rxgk_cprivate {
117 afsUUID *client_uuid;
118 afsUUID *target_uuid;
121 * Per-connection security data for client.
123 * The start time of the connection and connection key number are used
124 * for key derivation, information about the callback key to be presented in
125 * the authenticator for the connection, and the requisite connection
130 afs_uint32 key_number;
133 afs_int32 cb_enctype;
134 struct rxgkStats stats;
137 /* rxgk_crypto_IMPL.c (currently rfc3961 is the only IMPL) */
138 ssize_t rxgk_etype_to_len(int etype);
141 afs_int32 rxgk_extract_token(RXGK_Data *tc, RXGK_Token *out,
142 rxgk_getkey_func getkey, void *rock)
143 AFS_NONNULL((1,2,3));
146 int rxgk_check_mic_packet(rxgk_key tk, afs_int32 keyusage,
147 struct rx_connection *aconn,
148 struct rx_packet *apacket);
149 int rxgk_decrypt_packet(rxgk_key tk, afs_int32 keyusage,
150 struct rx_connection *aconn, struct rx_packet *apacket);
151 int rxgk_mic_packet(rxgk_key tk, afs_int32 keyusage,
152 struct rx_connection *aconn, struct rx_packet *apacket);
153 int rxgk_enc_packet(rxgk_key tk, afs_int32 keyusage,
154 struct rx_connection *aconn, struct rx_packet *apacket);
156 #endif /* RXGK_PRIVATE_H */