Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/linux/sunrpc/gss_spkm3.h |
| 3 | * |
| 4 | * Copyright (c) 2000 The Regents of the University of Michigan. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Andy Adamson <andros@umich.edu> |
| 8 | */ |
| 9 | |
| 10 | #include <linux/sunrpc/auth_gss.h> |
| 11 | #include <linux/sunrpc/gss_err.h> |
| 12 | #include <linux/sunrpc/gss_asn1.h> |
| 13 | |
| 14 | struct spkm3_ctx { |
| 15 | struct xdr_netobj ctx_id; /* per message context id */ |
| 16 | int qop; /* negotiated qop */ |
| 17 | struct xdr_netobj mech_used; |
| 18 | unsigned int ret_flags ; |
| 19 | unsigned int req_flags ; |
| 20 | struct xdr_netobj share_key; |
| 21 | int conf_alg; |
Herbert Xu | 378c669 | 2006-08-22 20:33:54 +1000 | [diff] [blame] | 22 | struct crypto_blkcipher *derived_conf_key; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | int intg_alg; |
Herbert Xu | 378c669 | 2006-08-22 20:33:54 +1000 | [diff] [blame] | 24 | struct crypto_blkcipher *derived_integ_key; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | int keyestb_alg; /* alg used to get share_key */ |
| 26 | int owf_alg; /* one way function */ |
| 27 | }; |
| 28 | |
| 29 | /* from openssl/objects.h */ |
| 30 | /* XXX need SEAL_ALG_NONE */ |
| 31 | #define NID_md5 4 |
| 32 | #define NID_dhKeyAgreement 28 |
| 33 | #define NID_des_cbc 31 |
| 34 | #define NID_sha1 64 |
| 35 | #define NID_cast5_cbc 108 |
| 36 | |
| 37 | /* SPKM InnerContext Token types */ |
| 38 | |
| 39 | #define SPKM_ERROR_TOK 3 |
| 40 | #define SPKM_MIC_TOK 4 |
| 41 | #define SPKM_WRAP_TOK 5 |
| 42 | #define SPKM_DEL_TOK 6 |
| 43 | |
J. Bruce Fields | 00fd6e1 | 2005-10-13 16:55:18 -0400 | [diff] [blame] | 44 | u32 spkm3_make_token(struct spkm3_ctx *ctx, struct xdr_buf * text, struct xdr_netobj * token, int toktype); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
J. Bruce Fields | 00fd6e1 | 2005-10-13 16:55:18 -0400 | [diff] [blame] | 46 | u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int toktype); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #define CKSUMTYPE_RSA_MD5 0x0007 |
| 49 | |
| 50 | s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, |
J. Bruce Fields | 9eed129 | 2006-01-03 09:56:00 +0100 | [diff] [blame] | 51 | int body_offset, struct xdr_netobj *cksum); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits); |
| 53 | int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, |
| 54 | int explen); |
| 55 | void spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen, |
| 56 | unsigned char *ctxhdr, int elen, int zbit); |
| 57 | void spkm3_make_mic_token(unsigned char **tokp, int toklen, |
| 58 | struct xdr_netobj *mic_hdr, |
| 59 | struct xdr_netobj *md5cksum, int md5elen, int md5zbit); |
| 60 | u32 spkm3_verify_mic_token(unsigned char **tokp, int *mic_hdrlen, |
| 61 | unsigned char **cksum); |