Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[pandora-kernel.git] / include / linux / sunrpc / gss_krb5.h
index db0522b..5af2931 100644 (file)
@@ -53,6 +53,8 @@
 /* Maximum blocksize for the supported crypto algorithms */
 #define GSS_KRB5_MAX_BLOCKSIZE  (16)
 
+struct krb5_ctx;
+
 struct gss_krb5_enctype {
        const u32               etype;          /* encryption (key) type */
        const u32               ctype;          /* checksum type */
@@ -62,6 +64,9 @@ struct gss_krb5_enctype {
        const u16               signalg;        /* signing algorithm */
        const u16               sealalg;        /* sealing algorithm */
        const u32               blocksize;      /* encryption blocksize */
+       const u32               conflen;        /* confounder length
+                                                  (normally the same as
+                                                  the blocksize) */
        const u32               cksumlength;    /* checksum length */
        const u32               keyed_cksum;    /* is it a keyed cksum? */
        const u32               keybytes;       /* raw key len, in bytes */
@@ -75,6 +80,12 @@ struct gss_krb5_enctype {
        u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,
                       struct xdr_netobj *in,
                       struct xdr_netobj *out); /* complete key generation */
+       u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
+                          struct xdr_buf *buf, int ec,
+                          struct page **pages); /* v2 encryption function */
+       u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
+                          struct xdr_buf *buf, u32 *headskip,
+                          u32 *tailskip);      /* v2 decryption function */
 };
 
 /* krb5_ctx flags definitions */
@@ -91,6 +102,9 @@ struct krb5_ctx {
        struct crypto_blkcipher *seq;
        struct crypto_blkcipher *acceptor_enc;
        struct crypto_blkcipher *initiator_enc;
+       struct crypto_blkcipher *acceptor_enc_aux;
+       struct crypto_blkcipher *initiator_enc_aux;
+       u8                      Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
        u8                      cksum[GSS_KRB5_MAX_KEYLEN];
        s32                     endtime;
        u32                     seq_send;
@@ -112,6 +126,18 @@ extern spinlock_t krb5_seq_lock;
 #define KG_TOK_MIC_MSG    0x0101
 #define KG_TOK_WRAP_MSG   0x0201
 
+#define KG2_TOK_INITIAL     0x0101
+#define KG2_TOK_RESPONSE    0x0202
+#define KG2_TOK_MIC         0x0404
+#define KG2_TOK_WRAP        0x0504
+
+#define KG2_TOKEN_FLAG_SENTBYACCEPTOR   0x01
+#define KG2_TOKEN_FLAG_SEALED           0x02
+#define KG2_TOKEN_FLAG_ACCEPTORSUBKEY   0x04
+
+#define KG2_RESP_FLAG_ERROR             0x0001
+#define KG2_RESP_FLAG_DELEG_OK          0x0002
+
 enum sgn_alg {
        SGN_ALG_DES_MAC_MD5 = 0x0000,
        SGN_ALG_MD2_5 = 0x0001,
@@ -136,6 +162,9 @@ enum seal_alg {
 #define CKSUMTYPE_RSA_MD5_DES          0x0008
 #define CKSUMTYPE_NIST_SHA             0x0009
 #define CKSUMTYPE_HMAC_SHA1_DES3       0x000c
+#define CKSUMTYPE_HMAC_SHA1_96_AES128   0x000f
+#define CKSUMTYPE_HMAC_SHA1_96_AES256   0x0010
+#define CKSUMTYPE_HMAC_MD5_ARCFOUR      -138 /* Microsoft md5 hmac cksumtype */
 
 /* from gssapi_err_krb5.h */
 #define KG_CCACHE_NOMATCH                        (39756032L)
@@ -210,7 +239,12 @@ enum seal_alg {
 u32
 make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
                struct xdr_buf *body, int body_offset, u8 *cksumkey,
-               struct xdr_netobj *cksumout);
+               unsigned int usage, struct xdr_netobj *cksumout);
+
+u32
+make_checksum_v2(struct krb5_ctx *, char *header, int hdrlen,
+                struct xdr_buf *body, int body_offset, u8 *key,
+                unsigned int usage, struct xdr_netobj *cksum);
 
 u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *,
                struct xdr_netobj *);
@@ -244,12 +278,13 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
                    int offset);
 
 s32
-krb5_make_seq_num(struct crypto_blkcipher *key,
+krb5_make_seq_num(struct krb5_ctx *kctx,
+               struct crypto_blkcipher *key,
                int direction,
                u32 seqnum, unsigned char *cksum, unsigned char *buf);
 
 s32
-krb5_get_seq_num(struct crypto_blkcipher *key,
+krb5_get_seq_num(struct krb5_ctx *kctx,
               unsigned char *cksum,
               unsigned char *buf, int *direction, u32 *seqnum);
 
@@ -260,9 +295,37 @@ u32
 krb5_derive_key(const struct gss_krb5_enctype *gk5e,
                const struct xdr_netobj *inkey,
                struct xdr_netobj *outkey,
-               const struct xdr_netobj *in_constant);
+               const struct xdr_netobj *in_constant,
+               gfp_t gfp_mask);
 
 u32
 gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e,
                       struct xdr_netobj *randombits,
                       struct xdr_netobj *key);
+
+u32
+gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
+                     struct xdr_netobj *randombits,
+                     struct xdr_netobj *key);
+
+u32
+gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
+                    struct xdr_buf *buf, int ec,
+                    struct page **pages);
+
+u32
+gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset,
+                    struct xdr_buf *buf, u32 *plainoffset,
+                    u32 *plainlen);
+
+int
+krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
+                      struct crypto_blkcipher *cipher,
+                      unsigned char *cksum);
+
+int
+krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
+                      struct crypto_blkcipher *cipher,
+                      s32 seqnum);
+void
+gss_krb5_make_confounder(char *p, u32 conflen);