diff options
author | Miloslav Trmač <mitr@redhat.com> | 2010-08-08 02:03:13 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2010-08-08 02:18:53 +0200 |
commit | f28aa3e7b3a1cd96f5e6449e3793561409f1ac94 (patch) | |
tree | 8c701dfb9f59cf81dc93feb48ab37c6db7bd6b3a | |
parent | cb519ef9fc39d3ccb1272ec7685524443490ca54 (diff) | |
download | cryptodev-linux-f28aa3e7b3a1cd96f5e6449e3793561409f1ac94.tar.gz cryptodev-linux-f28aa3e7b3a1cd96f5e6449e3793561409f1ac94.tar.xz cryptodev-linux-f28aa3e7b3a1cd96f5e6449e3793561409f1ac94.zip |
Use types from <linux/types.h> for public headers.
When included in the kernel tree, <inttypes.h> is not available, so
<linux/types.h> has to be used. <linux/types.h> does not provide the
uintNN_t and size_t types when installed to /usr/include/linux (package
kernel-headers on Fedora).
Therefore, use the types from <linux/types.h> that are available in
userspace.
Also fix user-space users of the headers not to assume that they provide
the <stdint.h> types.
-rw-r--r-- | cryptodev.h | 53 | ||||
-rw-r--r-- | examples/cipher.c | 1 | ||||
-rw-r--r-- | examples/hmac.c | 1 | ||||
-rw-r--r-- | examples/ncr.c | 1 | ||||
-rw-r--r-- | examples/pk.c | 1 | ||||
-rw-r--r-- | ncr.h | 44 | ||||
-rw-r--r-- | userspace/setkey.c | 1 |
7 files changed, 54 insertions, 48 deletions
diff --git a/cryptodev.h b/cryptodev.h index 4d6b712..4a546b8 100644 --- a/cryptodev.h +++ b/cryptodev.h @@ -5,10 +5,9 @@ #ifndef L_CRYPTODEV_H #define L_CRYPTODEV_H +#include <linux/types.h> #ifndef __KERNEL__ -#include <inttypes.h> #define __user -#else #endif /* API extensions for linux */ @@ -71,15 +70,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 @@ -87,14 +86,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 @@ -107,19 +106,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]; }; @@ -145,11 +144,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 /* L_CRYPTODEV_H */ diff --git a/examples/cipher.c b/examples/cipher.c index 1334f02..52b4996 100644 --- a/examples/cipher.c +++ b/examples/cipher.c @@ -4,6 +4,7 @@ * Placed under public domain. * */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/examples/hmac.c b/examples/hmac.c index 9757f90..c54d741 100644 --- a/examples/hmac.c +++ b/examples/hmac.c @@ -4,6 +4,7 @@ * Placed under public domain. * */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/examples/ncr.c b/examples/ncr.c index 4231ffa..9a75a99 100644 --- a/examples/ncr.c +++ b/examples/ncr.c @@ -4,6 +4,7 @@ * Placed under public domain. * */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> diff --git a/examples/pk.c b/examples/pk.c index 69450b1..3102a3b 100644 --- a/examples/pk.c +++ b/examples/pk.c @@ -4,6 +4,7 @@ * Placed under public domain. * */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> @@ -1,8 +1,8 @@ #ifndef L_NCR_H #define L_NCR_H +#include <linux/types.h> #ifndef __KERNEL__ -#include <inttypes.h> #define __user #endif @@ -96,10 +96,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; }; @@ -126,12 +126,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; @@ -168,19 +168,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 */ @@ -212,7 +212,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) @@ -220,8 +221,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) @@ -232,7 +233,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) @@ -285,13 +287,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; diff --git a/userspace/setkey.c b/userspace/setkey.c index ea9d30e..b090bd5 100644 --- a/userspace/setkey.c +++ b/userspace/setkey.c @@ -4,6 +4,7 @@ * Placed under public domain. * */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> |