summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2010-08-08 02:47:26 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-08 02:47:26 +0200
commitca1f42282167031868fc1b72512c2d5c49bceb99 (patch)
tree174862541920512f4798e66a465b2bd88cc6753a
parente7f1c4b12cbb143e9b6d1cdd0f1ec9a7725b4cac (diff)
parentd465b18ea8d04ae3fce2e27016de8d3cdcc571e2 (diff)
downloadkernel-crypto-ca1f42282167031868fc1b72512c2d5c49bceb99.tar.gz
kernel-crypto-ca1f42282167031868fc1b72512c2d5c49bceb99.tar.xz
kernel-crypto-ca1f42282167031868fc1b72512c2d5c49bceb99.zip
Merge branch 'standalone-rename' into userspace-crypto
Conflicts: crypto/userspace/cryptodev_main.c crypto/userspace/ncr-dh.c crypto/userspace/ncr-key-storage.c crypto/userspace/ncr-key-wrap.c crypto/userspace/ncr-key.c crypto/userspace/ncr-pk.c crypto/userspace/ncr-sessions.c crypto/userspace/ncr.c include/linux/cryptodev.h include/linux/ncr.h
-rw-r--r--crypto/userspace/cryptodev_cipher.c4
-rw-r--r--crypto/userspace/cryptodev_main.c7
-rw-r--r--crypto/userspace/ncr-dh.c5
-rw-r--r--crypto/userspace/ncr-int.h2
-rw-r--r--crypto/userspace/ncr-key-storage.c5
-rw-r--r--crypto/userspace/ncr-key-wrap.c5
-rw-r--r--crypto/userspace/ncr-key.c5
-rw-r--r--crypto/userspace/ncr-pk.c5
-rw-r--r--crypto/userspace/ncr-sessions.c12
-rw-r--r--crypto/userspace/ncr.c5
-rw-r--r--include/linux/cryptodev.h50
-rw-r--r--include/linux/ncr.h42
12 files changed, 71 insertions, 76 deletions
diff --git a/crypto/userspace/cryptodev_cipher.c b/crypto/userspace/cryptodev_cipher.c
index 00fa76391fe..8a003c5613a 100644
--- a/crypto/userspace/cryptodev_cipher.c
+++ b/crypto/userspace/cryptodev_cipher.c
@@ -26,10 +26,10 @@
#include <linux/cryptodev.h>
#include <linux/mm.h>
#include <linux/highmem.h>
+#include <linux/ioctl.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
#include <linux/scatterlist.h>
+#include <linux/uaccess.h>
#include <crypto/algapi.h>
#include <crypto/hash.h>
#include "cryptodev_int.h"
diff --git a/crypto/userspace/cryptodev_main.c b/crypto/userspace/cryptodev_main.c
index 1e64120547a..a56d845f897 100644
--- a/crypto/userspace/cryptodev_main.c
+++ b/crypto/userspace/cryptodev_main.c
@@ -32,14 +32,13 @@
*/
#include <linux/crypto.h>
-#include <linux/cryptodev.h>
#include <linux/mm.h>
#include <linux/highmem.h>
+#include <linux/ioctl.h>
#include <linux/random.h>
#include <linux/syscalls.h>
#include <linux/pagemap.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include "cryptodev_int.h"
#include "ncr-int.h"
@@ -950,7 +949,7 @@ cryptodev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg_)
#endif /* CONFIG_COMPAT */
-static struct file_operations cryptodev_fops = {
+static const struct file_operations cryptodev_fops = {
.owner = THIS_MODULE,
.open = cryptodev_open,
.release = cryptodev_release,
diff --git a/crypto/userspace/ncr-dh.c b/crypto/userspace/ncr-dh.c
index c1851581269..3a00c0bbc38 100644
--- a/crypto/userspace/ncr-dh.c
+++ b/crypto/userspace/ncr-dh.c
@@ -22,13 +22,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/ncr.h>
#include <linux/slab.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include <ncr-int.h>
#include <tomcrypt.h>
diff --git a/crypto/userspace/ncr-int.h b/crypto/userspace/ncr-int.h
index c93bf4d8290..fdc0200a931 100644
--- a/crypto/userspace/ncr-int.h
+++ b/crypto/userspace/ncr-int.h
@@ -48,7 +48,7 @@ struct session_item_st {
struct page **pages;
unsigned array_size;
unsigned available_pages;
- struct semaphore mem_mutex; /* down when the
+ struct mutex mem_mutex; /* down when the
* values above are changed.
*/
diff --git a/crypto/userspace/ncr-key-storage.c b/crypto/userspace/ncr-key-storage.c
index c97b80c7042..0db4eeddfff 100644
--- a/crypto/userspace/ncr-key-storage.c
+++ b/crypto/userspace/ncr-key-storage.c
@@ -22,12 +22,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/ncr.h>
#include <linux/slab.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include "ncr-int.h"
#include "cryptodev_int.h"
diff --git a/crypto/userspace/ncr-key-wrap.c b/crypto/userspace/ncr-key-wrap.c
index f2b3b6130b1..e36a7db0080 100644
--- a/crypto/userspace/ncr-key-wrap.c
+++ b/crypto/userspace/ncr-key-wrap.c
@@ -22,14 +22,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/ncr.h>
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include "ncr-int.h"
#include "cryptodev_int.h"
diff --git a/crypto/userspace/ncr-key.c b/crypto/userspace/ncr-key.c
index 31a88098ab3..82fa5113662 100644
--- a/crypto/userspace/ncr-key.c
+++ b/crypto/userspace/ncr-key.c
@@ -22,13 +22,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/ncr.h>
#include <linux/slab.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include "ncr-int.h"
diff --git a/crypto/userspace/ncr-pk.c b/crypto/userspace/ncr-pk.c
index 36ea3983dad..4500495430a 100644
--- a/crypto/userspace/ncr-pk.c
+++ b/crypto/userspace/ncr-pk.c
@@ -22,13 +22,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/ncr.h>
#include <linux/slab.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include "ncr-int.h"
#include <tomcrypt.h>
diff --git a/crypto/userspace/ncr-sessions.c b/crypto/userspace/ncr-sessions.c
index 8052ba6123f..f3d3590359f 100644
--- a/crypto/userspace/ncr-sessions.c
+++ b/crypto/userspace/ncr-sessions.c
@@ -24,7 +24,7 @@
*/
#include <linux/crypto.h>
-#include <linux/cryptodev.h>
+#include <linux/mutex.h>
#include <linux/ncr.h>
#include "ncr-int.h"
#include <linux/mm_types.h>
@@ -102,7 +102,7 @@ struct session_item_st* ncr_session_new(struct ncr_lists *lst)
err();
goto err_sess;
}
- init_MUTEX(&sess->mem_mutex);
+ mutex_init(&sess->mem_mutex);
atomic_set(&sess->refcnt, 2); /* One for lst->list, one for "sess" */
@@ -625,7 +625,7 @@ static int _ncr_session_update(struct ncr_lists* lists, struct ncr_session_op_st
return -EINVAL;
}
- if (down_interruptible(&sess->mem_mutex)) {
+ if (mutex_lock_interruptible(&sess->mem_mutex)) {
err();
_ncr_sessions_item_put(sess);
return -ERESTARTSYS;
@@ -706,7 +706,7 @@ fail:
release_user_pages(sess->pages, sess->available_pages);
sess->available_pages = 0;
}
- up(&sess->mem_mutex);
+ mutex_unlock(&sess->mem_mutex);
_ncr_sessions_item_put(sess);
return ret;
@@ -752,7 +752,7 @@ static int _ncr_session_final(struct ncr_lists* lists, struct ncr_session_op_st*
return ret;
}
- if (down_interruptible(&sess->mem_mutex)) {
+ if (mutex_lock_interruptible(&sess->mem_mutex)) {
err();
_ncr_sessions_item_put(sess);
return -ERESTARTSYS;
@@ -879,7 +879,7 @@ fail:
release_user_pages(sess->pages, sess->available_pages);
sess->available_pages = 0;
}
- up(&sess->mem_mutex);
+ mutex_unlock(&sess->mem_mutex);
cryptodev_hash_deinit(&sess->hash);
if (sess->algorithm->is_symmetric) {
diff --git a/crypto/userspace/ncr.c b/crypto/userspace/ncr.c
index 61e8b1e853b..dad8adc4cc0 100644
--- a/crypto/userspace/ncr.c
+++ b/crypto/userspace/ncr.c
@@ -23,12 +23,11 @@
*/
#include <linux/crypto.h>
-#include <linux/cryptodev.h>
+#include <linux/ioctl.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/random.h>
-#include <asm/uaccess.h>
-#include <asm/ioctl.h>
+#include <linux/uaccess.h>
#include <linux/scatterlist.h>
#include <linux/cred.h>
#include <linux/capability.h>
diff --git a/include/linux/cryptodev.h b/include/linux/cryptodev.h
index ce3840c6359..a916177eaa7 100644
--- a/include/linux/cryptodev.h
+++ b/include/linux/cryptodev.h
@@ -67,15 +67,15 @@ typedef enum {
struct session_op {
/* Specify either cipher or mac
*/
- uint32_t cipher; /* cryptodev_crypto_op_t */
- uint32_t mac; /* cryptodev_crypto_op_t */
+ __u32 cipher; /* cryptodev_crypto_op_t */
+ __u32 mac; /* cryptodev_crypto_op_t */
- uint32_t keylen;
- uint8_t __user *key;
- uint32_t mackeylen;
- uint8_t __user *mackey;
+ __u32 keylen;
+ __u8 __user *key;
+ __u32 mackeylen;
+ __u8 __user *mackey;
- uint32_t ses; /* session identifier */
+ __u32 ses; /* session identifier */
};
#define COP_ENCRYPT 0
@@ -83,14 +83,14 @@ struct session_op {
/* input of CIOCCRYPT */
struct crypt_op {
- uint32_t ses; /* session identifier */
- uint16_t op; /* COP_ENCRYPT or COP_DECRYPT */
- uint16_t flags; /* no usage so far, use 0 */
- uint32_t len; /* length of source data */
- uint8_t __user *src; /* source data */
- uint8_t __user *dst; /* pointer to output data */
- uint8_t __user *mac; /* pointer to output data for hash/MAC operations */
- uint8_t __user *iv; /* initialization vector for encryption operations */
+ __u32 ses; /* session identifier */
+ __u16 op; /* COP_ENCRYPT or COP_DECRYPT */
+ __u16 flags; /* no usage so far, use 0 */
+ __u32 len; /* length of source data */
+ __u8 __user *src; /* source data */
+ __u8 __user *dst; /* pointer to output data */
+ __u8 __user *mac; /* pointer to output data for hash/MAC operations */
+ __u8 __user *iv; /* initialization vector for encryption operations */
};
/* Stuff for bignum arithmetic and public key
@@ -103,19 +103,19 @@ struct session_op {
#define CRYPTO_ALG_FLAG_DSA_SHA 4
struct crparam {
- uint8_t* crp_p;
- uint32_t crp_nbits;
+ __u8* crp_p;
+ __u32 crp_nbits;
};
#define CRK_MAXPARAM 8
/* input of CIOCKEY */
struct crypt_kop {
- uint32_t crk_op; /* cryptodev_crk_ot_t */
- uint32_t crk_status;
- uint16_t crk_iparams;
- uint16_t crk_oparams;
- uint32_t crk_pad1;
+ __u32 crk_op; /* cryptodev_crk_ot_t */
+ __u32 crk_status;
+ __u16 crk_iparams;
+ __u16 crk_oparams;
+ __u32 crk_pad1;
struct crparam crk_param[CRK_MAXPARAM];
};
@@ -141,11 +141,11 @@ typedef enum {
/* ioctl's. Compatible with old linux cryptodev.h
*/
-#define CRIOGET _IOWR('c', 101, uint32_t)
+#define CRIOGET _IOWR('c', 101, __u32)
#define CIOCGSESSION _IOWR('c', 102, struct session_op)
-#define CIOCFSESSION _IOW('c', 103, uint32_t)
+#define CIOCFSESSION _IOW('c', 103, __u32)
#define CIOCCRYPT _IOWR('c', 104, struct crypt_op)
#define CIOCKEY _IOWR('c', 105, struct crypt_kop)
-#define CIOCASYMFEAT _IOR('c', 106, uint32_t)
+#define CIOCASYMFEAT _IOR('c', 106, __u32)
#endif /* _LINUX_CRYPTODEV_H */
diff --git a/include/linux/ncr.h b/include/linux/ncr.h
index 06f34e2812a..9c1f33a24b4 100644
--- a/include/linux/ncr.h
+++ b/include/linux/ncr.h
@@ -93,10 +93,10 @@ struct ncr_key_generate_params_st {
unsigned int q_bits;
} dsa;
struct {
- uint8_t __user *p; /* prime */
- size_t p_size;
- uint8_t __user *g; /* generator */
- size_t g_size;
+ __u8 __user *p; /* prime */
+ __kernel_size_t p_size;
+ __u8 __user *g; /* generator */
+ __kernel_size_t g_size;
} dh;
} params;
};
@@ -123,12 +123,12 @@ struct ncr_key_params_st {
* key */
union {
struct {
- uint8_t iv[NCR_CIPHER_MAX_BLOCK_LEN];
- size_t iv_size;
+ __u8 iv[NCR_CIPHER_MAX_BLOCK_LEN];
+ __kernel_size_t iv_size;
} cipher;
struct {
- uint8_t __user *pub;
- size_t pub_size;
+ __u8 __user *pub;
+ __kernel_size_t pub_size;
} dh;
struct {
ncr_rsa_type_t type;
@@ -165,19 +165,19 @@ struct ncr_key_info_st {
ncr_key_type_t type;
ncr_algorithm_t algorithm; /* valid for public/private keys */
- uint8_t key_id[MAX_KEY_ID_SIZE];
- size_t key_id_size;
+ __u8 key_id[MAX_KEY_ID_SIZE];
+ __kernel_size_t key_id_size;
};
struct ncr_key_data_st {
ncr_key_t key;
void __user *idata;
- size_t idata_size; /* rw in get */
+ __kernel_size_t idata_size; /* rw in get */
/* in case of import this will be used as key id */
- uint8_t key_id[MAX_KEY_ID_SIZE];
- size_t key_id_size;
+ __u8 key_id[MAX_KEY_ID_SIZE];
+ __kernel_size_t key_id_size;
ncr_key_type_t type;
unsigned int flags;
ncr_algorithm_t algorithm; /* valid for public/private keys */
@@ -209,7 +209,8 @@ struct ncr_key_wrap_st {
struct ncr_key_params_st params;
void __user * io; /* encrypted keytowrap */
- size_t io_size; /* this will be updated by the actual size on wrap */
+ /* this will be updated by the actual size on wrap */
+ __kernel_size_t io_size;
};
#define NCRIO_KEY_WRAP _IOWR ('c', 250, struct ncr_key_wrap_st)
@@ -217,8 +218,8 @@ struct ncr_key_wrap_st {
/* Internal ops */
struct ncr_master_key_st {
- uint8_t __user * key;
- uint16_t key_size;
+ __u8 __user * key;
+ __u16 key_size;
};
#define NCRIO_MASTER_KEY_SET _IOR ('c', 260, struct ncr_master_key_st)
@@ -229,7 +230,8 @@ struct ncr_key_storage_wrap_st {
ncr_key_t keytowrap;
void __user * io; /* encrypted keytowrap */
- size_t io_size; /* this will be updated by the actual size on wrap */
+ /* this will be updated by the actual size on wrap */
+ __kernel_size_t io_size;
};
#define NCRIO_KEY_STORAGE_WRAP _IOWR ('c', 261, struct ncr_key_storage_wrap_st)
@@ -282,13 +284,13 @@ struct ncr_session_op_st {
void __user * output; /* when verifying signature this is
* the place of the signature.
*/
- size_t output_size;
+ __kernel_size_t output_size;
} kdata; /* NCR_KEY_DATA */
struct {
void __user * input;
- size_t input_size;
+ __kernel_size_t input_size;
void __user * output;
- size_t output_size;
+ __kernel_size_t output_size;
} udata; /* NCR_DIRECT_DATA */
} data;
ncr_data_type_t type;