/* RxRPC key type1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#ifndef _KEYS_RXRPC_TYPE_H12#define _KEYS_RXRPC_TYPE_H1314#include <linux/key.h>1516/*17* key type for AF_RXRPC keys18*/19extern struct key_type key_type_rxrpc;2021extern struct key *rxrpc_get_null_key(const char *);2223/*24* RxRPC key for Kerberos IV (type-2 security)25*/26struct rxkad_key {27u32 vice_id;28u32 start; /* time at which ticket starts */29u32 expiry; /* time at which ticket expires */30u32 kvno; /* key version number */31u8 primary_flag; /* T if key for primary cell for this user */32u16 ticket_len; /* length of ticket[] */33u8 session_key[8]; /* DES session key */34u8 ticket[0]; /* the encrypted ticket */35};3637/*38* Kerberos 5 principal39* name/name/name@realm40*/41struct krb5_principal {42u8 n_name_parts; /* N of parts of the name part of the principal */43char **name_parts; /* parts of the name part of the principal */44char *realm; /* parts of the realm part of the principal */45};4647/*48* Kerberos 5 tagged data49*/50struct krb5_tagged_data {51/* for tag value, see /usr/include/krb5/krb5.h52* - KRB5_AUTHDATA_* for auth data53* -54*/55s32 tag;56u32 data_len;57u8 *data;58};5960/*61* RxRPC key for Kerberos V (type-5 security)62*/63struct rxk5_key {64u64 authtime; /* time at which auth token generated */65u64 starttime; /* time at which auth token starts */66u64 endtime; /* time at which auth token expired */67u64 renew_till; /* time to which auth token can be renewed */68s32 is_skey; /* T if ticket is encrypted in another ticket's69* skey */70s32 flags; /* mask of TKT_FLG_* bits (krb5/krb5.h) */71struct krb5_principal client; /* client principal name */72struct krb5_principal server; /* server principal name */73u16 ticket_len; /* length of ticket */74u16 ticket2_len; /* length of second ticket */75u8 n_authdata; /* number of authorisation data elements */76u8 n_addresses; /* number of addresses */77struct krb5_tagged_data session; /* session data; tag is enctype */78struct krb5_tagged_data *addresses; /* addresses */79u8 *ticket; /* krb5 ticket */80u8 *ticket2; /* second krb5 ticket, if related to ticket (via81* DUPLICATE-SKEY or ENC-TKT-IN-SKEY) */82struct krb5_tagged_data *authdata; /* authorisation data */83};8485/*86* list of tokens attached to an rxrpc key87*/88struct rxrpc_key_token {89u16 security_index; /* RxRPC header security index */90struct rxrpc_key_token *next; /* the next token in the list */91union {92struct rxkad_key *kad;93struct rxk5_key *k5;94};95};9697/*98* structure of raw payloads passed to add_key() or instantiate key99*/100struct rxrpc_key_data_v1 {101u16 security_index;102u16 ticket_length;103u32 expiry; /* time_t */104u32 kvno;105u8 session_key[8];106u8 ticket[0];107};108109/*110* AF_RXRPC key payload derived from XDR format111* - based on openafs-1.4.10/src/auth/afs_token.xg112*/113#define AFSTOKEN_LENGTH_MAX 16384 /* max payload size */114#define AFSTOKEN_STRING_MAX 256 /* max small string length */115#define AFSTOKEN_DATA_MAX 64 /* max small data length */116#define AFSTOKEN_CELL_MAX 64 /* max cellname length */117#define AFSTOKEN_MAX 8 /* max tokens per payload */118#define AFSTOKEN_BDATALN_MAX 16384 /* max big data length */119#define AFSTOKEN_RK_TIX_MAX 12000 /* max RxKAD ticket size */120#define AFSTOKEN_GK_KEY_MAX 64 /* max GSSAPI key size */121#define AFSTOKEN_GK_TOKEN_MAX 16384 /* max GSSAPI token size */122#define AFSTOKEN_K5_COMPONENTS_MAX 16 /* max K5 components */123#define AFSTOKEN_K5_NAME_MAX 128 /* max K5 name length */124#define AFSTOKEN_K5_REALM_MAX 64 /* max K5 realm name length */125#define AFSTOKEN_K5_TIX_MAX 16384 /* max K5 ticket size */126#define AFSTOKEN_K5_ADDRESSES_MAX 16 /* max K5 addresses */127#define AFSTOKEN_K5_AUTHDATA_MAX 16 /* max K5 pieces of auth data */128129#endif /* _KEYS_RXRPC_TYPE_H */130131132