X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_sec.h;h=cf6cf4faf59cd831652729ec9cafa259b5fc44fd;hb=86aeca3550c902b96b434ff51754d037282347cc;hp=64558588bf2c716a56659aca54cea25ac1f6ad82;hpb=3192e52a89946f12fd36d28a686c169d01d36e64;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 6455858..cf6cf4f 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -1,22 +1,37 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2004-2007 Cluster File Systems, Inc. + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef _LUSTRE_SEC_H_ @@ -168,8 +183,8 @@ static inline void rpc_flvr_set_svc(__u16 *flvr, __u16 svc) struct sptlrpc_flavor { __u16 sf_rpc; /* rpc flavor */ - __u8 sf_bulk_priv; /* bulk encrypt alg */ - __u8 sf_bulk_csum; /* bulk checksum alg */ + __u8 sf_bulk_ciph; /* bulk cipher alg */ + __u8 sf_bulk_hash; /* bulk hash alg */ __u32 sf_flags; /* general flags */ }; @@ -467,35 +482,66 @@ struct ptlrpc_user_desc { /* * bulk flavors */ -enum bulk_checksum_alg { - BULK_CSUM_ALG_NULL = 0, - BULK_CSUM_ALG_CRC32, - BULK_CSUM_ALG_MD5, - BULK_CSUM_ALG_SHA1, - BULK_CSUM_ALG_SHA256, - BULK_CSUM_ALG_SHA384, - BULK_CSUM_ALG_SHA512, - BULK_CSUM_ALG_MAX +enum sptlrpc_bulk_hash_alg { + BULK_HASH_ALG_NULL = 0, + BULK_HASH_ALG_ADLER32, + BULK_HASH_ALG_CRC32, + BULK_HASH_ALG_MD5, + BULK_HASH_ALG_SHA1, + BULK_HASH_ALG_SHA256, + BULK_HASH_ALG_SHA384, + BULK_HASH_ALG_SHA512, + BULK_HASH_ALG_WP256, + BULK_HASH_ALG_WP384, + BULK_HASH_ALG_WP512, + BULK_HASH_ALG_MAX }; -enum bulk_encrypt_alg { - BULK_PRIV_ALG_NULL = 0, - BULK_PRIV_ALG_ARC4, - BULK_PRIV_ALG_MAX +enum sptlrpc_bulk_cipher_alg { + BULK_CIPH_ALG_NULL = 0, + BULK_CIPH_ALG_ARC4, + BULK_CIPH_ALG_AES128, + BULK_CIPH_ALG_AES192, + BULK_CIPH_ALG_AES256, + BULK_CIPH_ALG_CAST128, + BULK_CIPH_ALG_CAST256, + BULK_CIPH_ALG_TWOFISH128, + BULK_CIPH_ALG_TWOFISH256, + BULK_CIPH_ALG_MAX }; +struct sptlrpc_hash_type { + char *sht_name; + char *sht_tfm_name; + unsigned int sht_size; +}; + +struct sptlrpc_ciph_type { + char *sct_name; + char *sct_tfm_name; + __u32 sct_tfm_flags; + unsigned int sct_ivsize; + unsigned int sct_keysize; +}; + +const struct sptlrpc_hash_type *sptlrpc_get_hash_type(__u8 hash_alg); +const char * sptlrpc_get_hash_name(__u8 hash_alg); +const struct sptlrpc_ciph_type *sptlrpc_get_ciph_type(__u8 ciph_alg); +const char *sptlrpc_get_ciph_name(__u8 ciph_alg); + +#define CIPHER_MAX_BLKSIZE (16) +#define CIPHER_MAX_KEYSIZE (64) + struct ptlrpc_bulk_sec_desc { - __u32 bsd_version; - __u8 bsd_csum_alg; /* checksum algorithm */ - __u8 bsd_priv_alg; /* encrypt algorithm */ - __u16 bsd_pad; - __u8 bsd_iv[16]; /* encrypt iv */ + __u8 bsd_version; + __u8 bsd_flags; + __u8 bsd_pad[4]; + __u8 bsd_hash_alg; /* hash algorithm */ + __u8 bsd_ciph_alg; /* cipher algorithm */ + __u8 bsd_key[CIPHER_MAX_KEYSIZE]; /* encrypt key seed */ __u8 bsd_csum[0]; }; -const char * sptlrpc_bulk_csum_alg2name(__u8 csum_alg); -const char * sptlrpc_bulk_priv_alg2name(__u8 priv_alg); -__u32 sptlrpc_bulk_priv_alg2flags(__u8 priv_alg); /* * lprocfs @@ -625,6 +671,9 @@ int sptlrpc_cli_alloc_repbuf(struct ptlrpc_request *req, int msgsize); void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req); int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req, int segment, int newsize); +int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req); +int sptlrpc_cli_finish_early_reply(struct ptlrpc_request *req); + void sptlrpc_request_out_callback(struct ptlrpc_request *req); /* @@ -717,7 +766,7 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset); int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset); /* bulk helpers (internal use only by policies) */ -int bulk_sec_desc_size(__u8 csum_alg, int request, int read); +int bulk_sec_desc_size(__u8 hash_alg, int request, int read); int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset); int bulk_csum_cli_request(struct ptlrpc_bulk_desc *desc, int read,