EXTRA_DIST = \
libcfs.h \
- libcfs_crypto.h \
libcfs_debug.h \
libcfs_fail.h \
libcfs_hash.h \
libcfs-crypto-objs := $(addprefix crypto/,$(libcfs-crypto-objs))
libcfs-all-objs := debug.o fail.o module.o tracefile.o \
- libcfs_string.o hash.o \
- linux-crypto.o linux-crypto-adler.o
+ libcfs_string.o hash.o
libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
@LLCRYPT_TRUE@libcfs-objs += $(libcfs-crypto-objs)
MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ linux/*.o libcfs crypto/*.o
EXTRA_DIST := $(libcfs-all-objs:%.o=%.c) tracefile.h \
- fail.c linux-crypto.h
+ fail.c
#define DEBUG_SUBSYSTEM S_LNET
#include <libcfs/libcfs.h>
-#include <libcfs/libcfs_crypto.h>
#include <lnet/lib-lnet.h>
#include <lustre_crypto.h>
#include "tracefile.h"
mutex_lock(&libcfs_startup);
if (libcfs_active)
- goto out;
+ goto cleanup_lock;
rc = libcfs_debug_init(5 * 1024 * 1024);
if (rc < 0) {
rc = -ENOMEM;
CERROR("libcfs: failed to start rehash workqueue: rc = %d\n",
rc);
- goto cleanup_debug;
- }
-
- rc = cfs_crypto_register();
- if (rc) {
- CERROR("cfs_crypto_register: error %d\n", rc);
- goto cleanup_wq;
+ libcfs_debug_cleanup();
+ goto cleanup_lock;
}
CDEBUG(D_OTHER, "libcfs setup OK\n");
-out:
libcfs_active = 1;
- mutex_unlock(&libcfs_startup);
- return 0;
-
-cleanup_wq:
- destroy_workqueue(cfs_rehash_wq);
- cfs_rehash_wq = NULL;
-cleanup_debug:
- libcfs_debug_cleanup();
cleanup_lock:
mutex_unlock(&libcfs_startup);
return rc;
if (cfs_rehash_wq)
destroy_workqueue(cfs_rehash_wq);
- cfs_crypto_unregister();
-
/* the below message is checked in test-framework.sh check_mem_leak() */
if (libcfs_kmem_read() != 0)
CERROR("Portals memory leaked: %lld bytes\n",
lib-lnet.h \
lib-types.h \
udsp.h \
+ lnet_crypto.h \
lnet_rdma.h \
lnet_gds.h \
lock.h \
--- /dev/null
+/* GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * 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.
+ *
+ * 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
+ * version 2 along with this program; If not, see http://www.gnu.org/licenses
+ *
+ * Please visit http://www.xyratex.com/contact if you need additional
+ * information or have any questions.
+ *
+ * GPL HEADER END
+ */
+
+/* Copyright 2012 Xyratex Technology Limited
+ *
+ * Copyright (c) 2014, Intel Corporation.
+ */
+
+#ifndef _LNET_CRYPTO_H
+#define _LNET_CRYPTO_H
+
+#include <asm/page.h>
+#include <uapi/linux/lnet/lnet-crypto.h>
+
+/* cfs crypto hash descriptor */
+struct ahash_request *
+ cfs_crypto_hash_init(enum cfs_crypto_hash_alg hash_alg,
+ unsigned char *key, unsigned int key_len);
+int cfs_crypto_hash_update_page(struct ahash_request *req,
+ struct page *page, unsigned int offset,
+ unsigned int len);
+int cfs_crypto_hash_update(struct ahash_request *req, const void *buf,
+ unsigned int buf_len);
+int cfs_crypto_hash_final(struct ahash_request *req,
+ unsigned char *hash, unsigned int *hash_len);
+int cfs_crypto_register(void);
+void cfs_crypto_unregister(void);
+int cfs_crypto_hash_speed(enum cfs_crypto_hash_alg hash_alg);
+
+#endif
libcfs_debug.h \
libcfs_ioctl.h \
lnetctl.h \
+ lnet-crypto.h \
lnet-dlc.h \
lnetst.h \
lnet-idl.h \
libcfs_debug.h \
libcfs_ioctl.h \
lnetctl.h \
+ lnet-crypto.h \
lnet-dlc.h \
lnetst.h \
lnet-idl.h \
* GPL HEADER END
*/
-/*
- * Copyright 2012 Xyratex Technology Limited
+/* Copyright 2012 Xyratex Technology Limited
*
* Copyright (c) 2014, Intel Corporation.
*/
-#ifndef _LIBCFS_CRYPTO_H
-#define _LIBCFS_CRYPTO_H
+#ifndef _UAPI_LNET_CRYPTO_H
+#define _UAPI_LNET_CRYPTO_H
+
+#include <linux/types.h>
+#include <linux/string.h>
struct cfs_crypto_hash_type {
- char *cht_name; /**< hash algorithm name, equal to
- * format name for crypto api */
- unsigned int cht_key; /**< init key by default (vaild for
- * 4 bytes context like crc32, adler */
- unsigned int cht_size; /**< hash digest size */
+ char *cht_name; /* hash algorithm name, equal to
+ * format name for crypto api
+ */
+ unsigned int cht_key; /* init key by default (vaild for
+ * 4 bytes context like crc32, adler
+ */
+ unsigned int cht_size; /* hash digest size */
};
struct cfs_crypto_crypt_type {
- char *cct_name; /**< crypto algorithm name, equal to
- * format name for crypto api */
- unsigned int cct_size; /**< crypto key size */
+ char *cct_name; /* crypto algorithm name, equal to
+ * format name for crypto api
+ */
+ unsigned int cct_size; /* crypto key size */
};
enum cfs_crypto_hash_alg {
*
* Hash information includes algorithm name, initial seed, hash size.
*
- * \retval cfs_crypto_hash_type for valid ID (CFS_HASH_ALG_*)
- * \retval NULL for unknown algorithm identifier
+ * RETURN cfs_crypto_hash_type for valid ID (CFS_HASH_ALG_*)
+ * NULL for unknown algorithm identifier
*/
static inline const struct
cfs_crypto_hash_type *cfs_crypto_hash_type(enum cfs_crypto_hash_alg hash_alg)
if (hash_alg < CFS_HASH_ALG_MAX) {
ht = &hash_types[hash_alg];
- if (ht->cht_name != NULL)
+ if (ht->cht_name)
return ht;
}
return NULL;
/**
* Return hash name for hash algorithm identifier
*
- * \param[in] hash_alg hash alrgorithm id (CFS_HASH_ALG_*)
+ * @hash_alg hash alrgorithm id (CFS_HASH_ALG_*)
*
- * \retval string name of known hash algorithm
- * \retval "unknown" if hash algorithm is unknown
+ * RETURN string name of known hash algorithm
+ * "unknown" if hash algorithm is unknown
*/
static inline const
char *cfs_crypto_hash_name(enum cfs_crypto_hash_alg hash_alg)
/**
* Return digest size for hash algorithm type
*
- * \param[in] hash_alg hash alrgorithm id (CFS_HASH_ALG_*)
+ * @hash_alg hash alrgorithm id (CFS_HASH_ALG_*)
*
- * \retval hash algorithm digest size in bytes
- * \retval 0 if hash algorithm type is unknown
+ * RETURN hash algorithm digest size in bytes
+ * 0 if hash algorithm type is unknown
*/
static inline
unsigned int cfs_crypto_hash_digestsize(enum cfs_crypto_hash_alg hash_alg)
const struct cfs_crypto_hash_type *ht;
ht = cfs_crypto_hash_type(hash_alg);
- if (ht != NULL)
+ if (ht)
return ht->cht_size;
return 0;
/**
* Find hash algorithm ID for the specified algorithm name
*
- * \retval hash algorithm ID for valid ID (CFS_HASH_ALG_*)
- * \retval CFS_HASH_ALG_UNKNOWN for unknown algorithm name
+ * RETURN hash algorithm ID for valid ID (CFS_HASH_ALG_*)
+ * CFS_HASH_ALG_UNKNOWN for unknown algorithm name
*/
static inline unsigned char cfs_crypto_hash_alg(const char *algname)
{
*
* Crypt information includes algorithm name, key size.
*
- * \retval cfs_crypto_crupt_type for valid ID (CFS_CRYPT_ALG_*)
- * \retval NULL for unknown algorithm identifier
+ * RETURN cfs_crypto_crupt_type for valid ID (CFS_CRYPT_ALG_*)
+ * NULL for unknown algorithm identifier
*/
static inline const struct
cfs_crypto_crypt_type *cfs_crypto_crypt_type(
if (crypt_alg < CFS_CRYPT_ALG_MAX) {
ct = &crypt_types[crypt_alg];
- if (ct->cct_name != NULL)
+ if (ct->cct_name)
return ct;
}
return NULL;
/**
* Return crypt name for crypt algorithm identifier
*
- * \param[in] crypt_alg crypt alrgorithm id (CFS_CRYPT_ALG_*)
+ * @crypt_alg crypt alrgorithm id (CFS_CRYPT_ALG_*)
*
- * \retval string name of known crypt algorithm
- * \retval "unknown" if hash algorithm is unknown
+ * RETURN string name of known crypt algorithm
+ * "unknown" if hash algorithm is unknown
*/
static inline const
char *cfs_crypto_crypt_name(enum cfs_crypto_crypt_alg crypt_alg)
/**
* Return key size for crypto algorithm type
*
- * \param[in] crypt_alg crypt alrgorithm id (CFS_CRYPT_ALG_*)
+ * @crypt_alg crypt alrgorithm id (CFS_CRYPT_ALG_*)
*
- * \retval crypt algorithm key size in bytes
- * \retval 0 if crypt algorithm type is unknown
+ * RETURN crypt algorithm key size in bytes
+ * 0 if crypt algorithm type is unknown
*/
static inline
unsigned int cfs_crypto_crypt_keysize(enum cfs_crypto_crypt_alg crypt_alg)
const struct cfs_crypto_crypt_type *ct;
ct = cfs_crypto_crypt_type(crypt_alg);
- if (ct != NULL)
+ if (ct)
return ct->cct_size;
return 0;
/**
* Find crypto algorithm ID for the specified algorithm name
*
- * \retval crypto algorithm ID for valid ID (CFS_CRYPT_ALG_*)
- * \retval CFS_CRYPT_ALG_UNKNOWN for unknown algorithm name
+ * RETURN crypto algorithm ID for valid ID (CFS_CRYPT_ALG_*)
+ * CFS_CRYPT_ALG_UNKNOWN for unknown algorithm name
*/
static inline unsigned char cfs_crypto_crypt_alg(const char *algname)
{
unsigned char *key, unsigned int key_len,
unsigned char *hash, unsigned int *hash_len);
-/* cfs crypto hash descriptor */
-struct page;
-
-struct ahash_request *
- cfs_crypto_hash_init(enum cfs_crypto_hash_alg hash_alg,
- unsigned char *key, unsigned int key_len);
-int cfs_crypto_hash_update_page(struct ahash_request *req,
- struct page *page, unsigned int offset,
- unsigned int len);
-int cfs_crypto_hash_update(struct ahash_request *req, const void *buf,
- unsigned int buf_len);
-int cfs_crypto_hash_final(struct ahash_request *req,
- unsigned char *hash, unsigned int *hash_len);
-int cfs_crypto_register(void);
-void cfs_crypto_unregister(void);
-int cfs_crypto_hash_speed(enum cfs_crypto_hash_alg hash_alg);
-#endif
+#endif /* _UAPI_LNET_CRYPT_H_ */
lnet-objs += lib-me.o lib-msg.o lib-md.o lib-ptl.o
lnet-objs += lib-socket.o lib-move.o module.o lo.o
lnet-objs += router.o lnet_debugfs.o acceptor.o peer.o net_fault.o udsp.o
+lnet-objs += lnet-crypto.o adler.o
lnet-objs += $(lnet-objs-y)
CFLAGS_lnet_rdma.o += -I @GDS_PATH@ -I@CUDA_PATH@
* GPL HEADER END
*/
-/*
- * Copyright 2012 Xyratex Technology Limited
- */
-
-/*
+/* Copyright 2012 Xyratex Technology Limited
+ *
* This is crypto api shash wrappers to zlib_adler32.
*/
#include <linux/module.h>
#include <linux/zutil.h>
#include <crypto/internal/hash.h>
-#include "linux-crypto.h"
+#include "adler.h"
#define CHKSUM_BLOCK_SIZE 1
#define CHKSUM_DIGEST_SIZE 4
* GPL HEADER END
*/
-/*
- * Copyright 2012 Xyratex Technology Limited
- */
-
-/**
- * Linux crypto hash specific functions.
+/* Copyright 2012 Xyratex Technology Limited
+ *
+ * Alder crypto hash specific functions.
*/
-/**
- * Functions for start/stop shash adler32 algorithm.
- */
+/* Functions for start/stop shash adler32 algorithm. */
int cfs_crypto_adler32_register(void);
void cfs_crypto_adler32_unregister(void);
endif # MODULES
-EXTRA_DIST := $(lnet-objs:%.o=%.c) lib-cpt.c
+EXTRA_DIST := $(lnet-objs:%.o=%.c) lib-cpt.c adler.h
MOSTLYCLEANFILES = @MOSTLYCLEANFILES@ lnet
* GPL HEADER END
*/
-/*
- * Copyright 2012 Xyratex Technology Limited
+/* Copyright 2012 Xyratex Technology Limited
*
* Copyright (c) 2012, 2014, Intel Corporation.
*/
#include <linux/scatterlist.h>
#include <linux/pagemap.h>
#include <libcfs/libcfs.h>
-#include <libcfs/libcfs_crypto.h>
-#include "linux-crypto.h"
+#include <lnet/lnet_crypto.h>
+#include "adler.h"
#ifndef HAVE_CRYPTO_HASH_HELPERS
static inline const char *crypto_ahash_alg_name(struct crypto_ahash *tfm)
#include <linux/miscdevice.h>
#include <lnet/lib-lnet.h>
+#include <lnet/lnet_crypto.h>
#include <uapi/linux/lnet/lnet-dlc.h>
#include <uapi/linux/lustre/lustre_ver.h>
RETURN(rc);
}
+ rc = cfs_crypto_register();
+ if (rc) {
+ CERROR("cfs_crypto_register: rc = %d\n", rc);
+ cfs_cpu_fini();
+ RETURN(rc);
+ }
+
rc = lnet_lib_init();
if (rc != 0) {
CERROR("lnet_lib_init: rc = %d\n", rc);
+ cfs_crypto_unregister();
cfs_cpu_fini();
RETURN(rc);
}
rc = misc_register(&lnet_dev);
if (rc) {
CERROR("misc_register: rc = %d\n", rc);
+ lnet_lib_exit();
+ cfs_crypto_unregister();
cfs_cpu_fini();
RETURN(rc);
}
lnet_router_exit();
lnet_lib_exit();
+ cfs_crypto_unregister();
cfs_cpu_fini();
}
#ifndef __OBD_CKSUM
#define __OBD_CKSUM
#include <libcfs/libcfs.h>
-#include <libcfs/libcfs_crypto.h>
+#include <lnet/lnet_crypto.h>
#include <uapi/linux/lustre/lustre_idl.h>
int obd_t10_cksum_speed(const char *obd_name,
#include "llite_internal.h"
#ifdef HAVE_LUSTRE_CRYPTO
-#include <libcfs/libcfs_crypto.h>
static int ll_get_context(struct inode *inode, void *ctx, size_t len)
{
#include <lustre_kernelcomm.h>
#include <lustre_swab.h>
#include <lustre_quota.h>
-#include <libcfs/libcfs_crypto.h>
#include "llite_internal.h"
#include <linux/kobject.h>
#include <libcfs/libcfs.h>
-#include <libcfs/libcfs_crypto.h>
+#include <lnet/lnet_crypto.h>
#include <obd_support.h>
#include <obd_class.h>
#include <lprocfs_status.h>
#define __PTLRPC_GSS_GSS_INTERNAL_H_
#include <crypto/hash.h>
-#include <libcfs/libcfs_crypto.h>
+#include <lnet/lnet_crypto.h>
#include <lustre_sec.h>
#include <upcall_cache.h>
#include <linux/key.h>
#include <libcfs/libcfs.h>
+#include <lnet/lnet_crypto.h>
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
#include <lustre_import.h>
#include <lustre_dlm.h>
#include <lustre_sec.h>
-#include <libcfs/libcfs_crypto.h>
#include "ptlrpc_internal.h"
#include <openssl/err.h>
#include <sys/types.h>
-#include <libcfs/libcfs_crypto.h>
+#include <linux/lnet/lnet-crypto.h>
#include "lsupport.h"
#ifndef ARRAY_SIZE