Whamcloud - gitweb
Mass conversion of all copyright messages to Oracle.
[fs/lustre-release.git] / lustre / ptlrpc / gss / gss_krb5.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * Modifications for Lustre
5  *
6  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
7  *
8  * Author: Eric Mei <ericm@clusterfs.com>
9  */
10
11 /*
12  *  linux/include/linux/sunrpc/gss_krb5_types.h
13  *
14  *  Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h,
15  *  lib/gssapi/krb5/gssapiP_krb5.h, and others
16  *
17  *  Copyright (c) 2000 The Regents of the University of Michigan.
18  *  All rights reserved.
19  *
20  *  Andy Adamson   <andros@umich.edu>
21  *  Bruce Fields   <bfields@umich.edu>
22  */
23
24 /*
25  * Copyright 1995 by the Massachusetts Institute of Technology.
26  * All Rights Reserved.
27  *
28  * Export of this software from the United States of America may
29  *   require a specific license from the United States Government.
30  *   It is the responsibility of any person or organization contemplating
31  *   export to obtain such a license before exporting.
32  *
33  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
34  * distribute this software and its documentation for any purpose and
35  * without fee is hereby granted, provided that the above copyright
36  * notice appear in all copies and that both that copyright notice and
37  * this permission notice appear in supporting documentation, and that
38  * the name of M.I.T. not be used in advertising or publicity pertaining
39  * to distribution of the software without specific, written prior
40  * permission.  Furthermore if you modify this software you must label
41  * your software as modified software and not distribute it in such a
42  * fashion that it might be confused with the original M.I.T. software.
43  * M.I.T. makes no representations about the suitability of
44  * this software for any purpose.  It is provided "as is" without express
45  * or implied warranty.
46  *
47  */
48
49 #ifndef PTLRPC_GSS_KRB5_H
50 #define PTLRPC_GSS_KRB5_H
51
52 /*
53  * RFC 4142
54  */
55
56 #define KG_USAGE_ACCEPTOR_SEAL          22
57 #define KG_USAGE_ACCEPTOR_SIGN          23
58 #define KG_USAGE_INITIATOR_SEAL         24
59 #define KG_USAGE_INITIATOR_SIGN         25
60
61 #define KG_TOK_MIC_MSG                  0x0404
62 #define KG_TOK_WRAP_MSG                 0x0504
63
64 #define FLAG_SENDER_IS_ACCEPTOR         0x01
65 #define FLAG_WRAP_CONFIDENTIAL          0x02
66 #define FLAG_ACCEPTOR_SUBKEY            0x04
67
68 struct krb5_header {
69         __u16           kh_tok_id;      /* token id */
70         __u8            kh_flags;       /* acceptor flags */
71         __u8            kh_filler;      /* 0xff */
72         __u16           kh_ec;          /* extra count */
73         __u16           kh_rrc;         /* right rotation count */
74         __u64           kh_seq;         /* sequence number */
75         __u8            kh_cksum[0];    /* checksum */
76 };
77
78 struct krb5_keyblock {
79         rawobj_t                 kb_key;
80         struct ll_crypto_cipher *kb_tfm;
81 };
82
83 struct krb5_ctx {
84         unsigned int            kc_initiate:1,
85                                 kc_cfx:1,
86                                 kc_seed_init:1,
87                                 kc_have_acceptor_subkey:1;
88         __s32                   kc_endtime;
89         __u8                    kc_seed[16];
90         __u64                   kc_seq_send;
91         __u64                   kc_seq_recv;
92         __u32                   kc_enctype;
93         struct krb5_keyblock    kc_keye;        /* encryption */
94         struct krb5_keyblock    kc_keyi;        /* integrity */
95         struct krb5_keyblock    kc_keyc;        /* checksum */
96         rawobj_t                kc_mech_used;
97 };
98
99 enum sgn_alg {
100         SGN_ALG_DES_MAC_MD5           = 0x0000,
101         SGN_ALG_MD2_5                 = 0x0001,
102         SGN_ALG_DES_MAC               = 0x0002,
103         SGN_ALG_3                     = 0x0003, /* not published */
104         SGN_ALG_HMAC_MD5              = 0x0011, /* microsoft w2k; no support */
105         SGN_ALG_HMAC_SHA1_DES3_KD     = 0x0004
106 };
107
108 enum seal_alg {
109         SEAL_ALG_NONE                 = 0xffff,
110         SEAL_ALG_DES                  = 0x0000,
111         SEAL_ALG_1                    = 0x0001, /* not published */
112         SEAL_ALG_MICROSOFT_RC4        = 0x0010, /* microsoft w2k; no support */
113         SEAL_ALG_DES3KD               = 0x0002
114 };
115
116 #define CKSUMTYPE_CRC32                 0x0001
117 #define CKSUMTYPE_RSA_MD4               0x0002
118 #define CKSUMTYPE_RSA_MD4_DES           0x0003
119 #define CKSUMTYPE_DESCBC                0x0004
120 /* des-mac-k */
121 /* rsa-md4-des-k */
122 #define CKSUMTYPE_RSA_MD5               0x0007
123 #define CKSUMTYPE_RSA_MD5_DES           0x0008
124 #define CKSUMTYPE_NIST_SHA              0x0009
125 #define CKSUMTYPE_HMAC_SHA1_DES3        0x000c
126 #define CKSUMTYPE_HMAC_SHA1_96_AES128   0x000f
127 #define CKSUMTYPE_HMAC_SHA1_96_AES256   0x0010
128 #define CKSUMTYPE_HMAC_MD5_ARCFOUR      -138
129
130 /* from gssapi_err_krb5.h */
131 #define KG_CCACHE_NOMATCH                        (39756032L)
132 #define KG_KEYTAB_NOMATCH                        (39756033L)
133 #define KG_TGT_MISSING                           (39756034L)
134 #define KG_NO_SUBKEY                             (39756035L)
135 #define KG_CONTEXT_ESTABLISHED                   (39756036L)
136 #define KG_BAD_SIGN_TYPE                         (39756037L)
137 #define KG_BAD_LENGTH                            (39756038L)
138 #define KG_CTX_INCOMPLETE                        (39756039L)
139 #define KG_CONTEXT                               (39756040L)
140 #define KG_CRED                                  (39756041L)
141 #define KG_ENC_DESC                              (39756042L)
142 #define KG_BAD_SEQ                               (39756043L)
143 #define KG_EMPTY_CCACHE                          (39756044L)
144 #define KG_NO_CTYPES                             (39756045L)
145
146 /* per Kerberos v5 protocol spec crypto types from the wire. 
147  * these get mapped to linux kernel crypto routines.  
148  */
149 #define ENCTYPE_NULL            0x0000
150 #define ENCTYPE_DES_CBC_CRC     0x0001        /* DES cbc mode with CRC-32 */
151 #define ENCTYPE_DES_CBC_MD4     0x0002        /* DES cbc mode with RSA-MD4 */
152 #define ENCTYPE_DES_CBC_MD5     0x0003        /* DES cbc mode with RSA-MD5 */
153 #define ENCTYPE_DES_CBC_RAW     0x0004        /* DES cbc mode raw */
154 /* XXX deprecated? */
155 #define ENCTYPE_DES3_CBC_SHA    0x0005        /* DES-3 cbc mode with NIST-SHA */
156 #define ENCTYPE_DES3_CBC_RAW    0x0006        /* DES-3 cbc mode raw */
157 #define ENCTYPE_DES_HMAC_SHA1   0x0008
158 #define ENCTYPE_DES3_CBC_SHA1   0x0010
159 #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011
160 #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012
161 #define ENCTYPE_ARCFOUR_HMAC    0x0017
162 #define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018
163 #define ENCTYPE_UNKNOWN         0x01ff
164
165 #endif /* PTLRPC_GSS_KRB5_H */