diff options
| -rw-r--r-- | arch/cris/include/arch-v32/arch/Kbuild | 2 | ||||
| -rw-r--r-- | arch/cris/include/arch-v32/arch/cryptocop.h | 116 | ||||
| -rw-r--r-- | arch/cris/include/uapi/arch-v32/arch/Kbuild | 2 | ||||
| -rw-r--r-- | arch/cris/include/uapi/arch-v32/arch/cryptocop.h | 122 | ||||
| -rw-r--r-- | arch/cris/include/uapi/arch-v32/arch/user.h (renamed from arch/cris/include/arch-v32/arch/user.h) | 0 |
5 files changed, 125 insertions, 117 deletions
diff --git a/arch/cris/include/arch-v32/arch/Kbuild b/arch/cris/include/arch-v32/arch/Kbuild index 35f2fc4f993e..e69de29bb2d1 100644 --- a/arch/cris/include/arch-v32/arch/Kbuild +++ b/arch/cris/include/arch-v32/arch/Kbuild | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | header-y += user.h | ||
| 2 | header-y += cryptocop.h | ||
diff --git a/arch/cris/include/arch-v32/arch/cryptocop.h b/arch/cris/include/arch-v32/arch/cryptocop.h index e1cd83dfabb5..716e434e9269 100644 --- a/arch/cris/include/arch-v32/arch/cryptocop.h +++ b/arch/cris/include/arch-v32/arch/cryptocop.h | |||
| @@ -2,124 +2,12 @@ | |||
| 2 | * The device /dev/cryptocop is accessible using this driver using | 2 | * The device /dev/cryptocop is accessible using this driver using |
| 3 | * CRYPTOCOP_MAJOR (254) and minor number 0. | 3 | * CRYPTOCOP_MAJOR (254) and minor number 0. |
| 4 | */ | 4 | */ |
| 5 | |||
| 6 | #ifndef CRYPTOCOP_H | 5 | #ifndef CRYPTOCOP_H |
| 7 | #define CRYPTOCOP_H | 6 | #define CRYPTOCOP_H |
| 8 | 7 | ||
| 9 | #include <linux/uio.h> | 8 | #include <uapi/arch-v32/arch/cryptocop.h> |
| 10 | |||
| 11 | |||
| 12 | #define CRYPTOCOP_SESSION_ID_NONE (0) | ||
| 13 | |||
| 14 | typedef unsigned long long int cryptocop_session_id; | ||
| 15 | |||
| 16 | /* cryptocop ioctls */ | ||
| 17 | #define ETRAXCRYPTOCOP_IOCTYPE (250) | ||
| 18 | |||
| 19 | #define CRYPTOCOP_IO_CREATE_SESSION _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op) | ||
| 20 | #define CRYPTOCOP_IO_CLOSE_SESSION _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op) | ||
| 21 | #define CRYPTOCOP_IO_PROCESS_OP _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op) | ||
| 22 | #define CRYPTOCOP_IO_MAXNR (3) | ||
| 23 | |||
| 24 | typedef enum { | ||
| 25 | cryptocop_cipher_des = 0, | ||
| 26 | cryptocop_cipher_3des = 1, | ||
| 27 | cryptocop_cipher_aes = 2, | ||
| 28 | cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */ | ||
| 29 | cryptocop_cipher_none | ||
| 30 | } cryptocop_cipher_type; | ||
| 31 | |||
| 32 | typedef enum { | ||
| 33 | cryptocop_digest_sha1 = 0, | ||
| 34 | cryptocop_digest_md5 = 1, | ||
| 35 | cryptocop_digest_none | ||
| 36 | } cryptocop_digest_type; | ||
| 37 | |||
| 38 | typedef enum { | ||
| 39 | cryptocop_csum_le = 0, | ||
| 40 | cryptocop_csum_be = 1, | ||
| 41 | cryptocop_csum_none | ||
| 42 | } cryptocop_csum_type; | ||
| 43 | |||
| 44 | typedef enum { | ||
| 45 | cryptocop_cipher_mode_ecb = 0, | ||
| 46 | cryptocop_cipher_mode_cbc, | ||
| 47 | cryptocop_cipher_mode_none | ||
| 48 | } cryptocop_cipher_mode; | ||
| 49 | |||
| 50 | typedef enum { | ||
| 51 | cryptocop_3des_eee = 0, | ||
| 52 | cryptocop_3des_eed = 1, | ||
| 53 | cryptocop_3des_ede = 2, | ||
| 54 | cryptocop_3des_edd = 3, | ||
| 55 | cryptocop_3des_dee = 4, | ||
| 56 | cryptocop_3des_ded = 5, | ||
| 57 | cryptocop_3des_dde = 6, | ||
| 58 | cryptocop_3des_ddd = 7 | ||
| 59 | } cryptocop_3des_mode; | ||
| 60 | |||
| 61 | /* Usermode accessible (ioctl) operations. */ | ||
| 62 | struct strcop_session_op{ | ||
| 63 | cryptocop_session_id ses_id; | ||
| 64 | |||
| 65 | cryptocop_cipher_type cipher; /* AES, DES, 3DES, m2m, none */ | ||
| 66 | |||
| 67 | cryptocop_cipher_mode cmode; /* ECB, CBC, none */ | ||
| 68 | cryptocop_3des_mode des3_mode; | ||
| 69 | |||
| 70 | cryptocop_digest_type digest; /* MD5, SHA1, none */ | ||
| 71 | |||
| 72 | cryptocop_csum_type csum; /* BE, LE, none */ | ||
| 73 | |||
| 74 | unsigned char *key; | ||
| 75 | size_t keylen; | ||
| 76 | }; | ||
| 77 | |||
| 78 | #define CRYPTOCOP_CSUM_LENGTH (2) | ||
| 79 | #define CRYPTOCOP_MAX_DIGEST_LENGTH (20) /* SHA-1 20, MD5 16 */ | ||
| 80 | #define CRYPTOCOP_MAX_IV_LENGTH (16) /* (3)DES==8, AES == 16 */ | ||
| 81 | #define CRYPTOCOP_MAX_KEY_LENGTH (32) | ||
| 82 | |||
| 83 | struct strcop_crypto_op{ | ||
| 84 | cryptocop_session_id ses_id; | ||
| 85 | |||
| 86 | /* Indata. */ | ||
| 87 | unsigned char *indata; | ||
| 88 | size_t inlen; /* Total indata length. */ | ||
| 89 | |||
| 90 | /* Cipher configuration. */ | ||
| 91 | unsigned char do_cipher:1; | ||
| 92 | unsigned char decrypt:1; /* 1 == decrypt, 0 == encrypt */ | ||
| 93 | unsigned char cipher_explicit:1; | ||
| 94 | size_t cipher_start; | ||
| 95 | size_t cipher_len; | ||
| 96 | /* cipher_iv is used if do_cipher and cipher_explicit and the cipher | ||
| 97 | mode is CBC. The length is controlled by the type of cipher, | ||
| 98 | e.g. DES/3DES 8 octets and AES 16 octets. */ | ||
| 99 | unsigned char cipher_iv[CRYPTOCOP_MAX_IV_LENGTH]; | ||
| 100 | /* Outdata. */ | ||
| 101 | unsigned char *cipher_outdata; | ||
| 102 | size_t cipher_outlen; | ||
| 103 | |||
| 104 | /* digest configuration. */ | ||
| 105 | unsigned char do_digest:1; | ||
| 106 | size_t digest_start; | ||
| 107 | size_t digest_len; | ||
| 108 | /* Outdata. The actual length is determined by the type of the digest. */ | ||
| 109 | unsigned char digest[CRYPTOCOP_MAX_DIGEST_LENGTH]; | ||
| 110 | |||
| 111 | /* Checksum configuration. */ | ||
| 112 | unsigned char do_csum:1; | ||
| 113 | size_t csum_start; | ||
| 114 | size_t csum_len; | ||
| 115 | /* Outdata. */ | ||
| 116 | unsigned char csum[CRYPTOCOP_CSUM_LENGTH]; | ||
| 117 | }; | ||
| 118 | 9 | ||
| 119 | 10 | ||
| 120 | |||
| 121 | #ifdef __KERNEL__ | ||
| 122 | |||
| 123 | /********** The API to use from inside the kernel. ************/ | 11 | /********** The API to use from inside the kernel. ************/ |
| 124 | 12 | ||
| 125 | #include <arch/hwregs/dma.h> | 13 | #include <arch/hwregs/dma.h> |
| @@ -267,6 +155,4 @@ int cryptocop_job_queue_insert_crypto(struct cryptocop_operation *operation); | |||
| 267 | 155 | ||
| 268 | int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation); | 156 | int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation); |
| 269 | 157 | ||
| 270 | #endif /* __KERNEL__ */ | ||
| 271 | |||
| 272 | #endif /* CRYPTOCOP_H */ | 158 | #endif /* CRYPTOCOP_H */ |
diff --git a/arch/cris/include/uapi/arch-v32/arch/Kbuild b/arch/cris/include/uapi/arch-v32/arch/Kbuild index aafaa5aa54d4..59efffd16b61 100644 --- a/arch/cris/include/uapi/arch-v32/arch/Kbuild +++ b/arch/cris/include/uapi/arch-v32/arch/Kbuild | |||
| @@ -1 +1,3 @@ | |||
| 1 | # UAPI Header export list | 1 | # UAPI Header export list |
| 2 | header-y += cryptocop.h | ||
| 3 | header-y += user.h | ||
diff --git a/arch/cris/include/uapi/arch-v32/arch/cryptocop.h b/arch/cris/include/uapi/arch-v32/arch/cryptocop.h new file mode 100644 index 000000000000..694fd13ce1cf --- /dev/null +++ b/arch/cris/include/uapi/arch-v32/arch/cryptocop.h | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | /* | ||
| 2 | * The device /dev/cryptocop is accessible using this driver using | ||
| 3 | * CRYPTOCOP_MAJOR (254) and minor number 0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef _UAPICRYPTOCOP_H | ||
| 7 | #define _UAPICRYPTOCOP_H | ||
| 8 | |||
| 9 | #include <linux/uio.h> | ||
| 10 | |||
| 11 | |||
| 12 | #define CRYPTOCOP_SESSION_ID_NONE (0) | ||
| 13 | |||
| 14 | typedef unsigned long long int cryptocop_session_id; | ||
| 15 | |||
| 16 | /* cryptocop ioctls */ | ||
| 17 | #define ETRAXCRYPTOCOP_IOCTYPE (250) | ||
| 18 | |||
| 19 | #define CRYPTOCOP_IO_CREATE_SESSION _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op) | ||
| 20 | #define CRYPTOCOP_IO_CLOSE_SESSION _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op) | ||
| 21 | #define CRYPTOCOP_IO_PROCESS_OP _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op) | ||
| 22 | #define CRYPTOCOP_IO_MAXNR (3) | ||
| 23 | |||
| 24 | typedef enum { | ||
| 25 | cryptocop_cipher_des = 0, | ||
| 26 | cryptocop_cipher_3des = 1, | ||
| 27 | cryptocop_cipher_aes = 2, | ||
| 28 | cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */ | ||
| 29 | cryptocop_cipher_none | ||
| 30 | } cryptocop_cipher_type; | ||
| 31 | |||
| 32 | typedef enum { | ||
| 33 | cryptocop_digest_sha1 = 0, | ||
| 34 | cryptocop_digest_md5 = 1, | ||
| 35 | cryptocop_digest_none | ||
| 36 | } cryptocop_digest_type; | ||
| 37 | |||
| 38 | typedef enum { | ||
| 39 | cryptocop_csum_le = 0, | ||
| 40 | cryptocop_csum_be = 1, | ||
| 41 | cryptocop_csum_none | ||
| 42 | } cryptocop_csum_type; | ||
| 43 | |||
| 44 | typedef enum { | ||
| 45 | cryptocop_cipher_mode_ecb = 0, | ||
| 46 | cryptocop_cipher_mode_cbc, | ||
| 47 | cryptocop_cipher_mode_none | ||
| 48 | } cryptocop_cipher_mode; | ||
| 49 | |||
| 50 | typedef enum { | ||
| 51 | cryptocop_3des_eee = 0, | ||
| 52 | cryptocop_3des_eed = 1, | ||
| 53 | cryptocop_3des_ede = 2, | ||
| 54 | cryptocop_3des_edd = 3, | ||
| 55 | cryptocop_3des_dee = 4, | ||
| 56 | cryptocop_3des_ded = 5, | ||
| 57 | cryptocop_3des_dde = 6, | ||
| 58 | cryptocop_3des_ddd = 7 | ||
| 59 | } cryptocop_3des_mode; | ||
| 60 | |||
| 61 | /* Usermode accessible (ioctl) operations. */ | ||
| 62 | struct strcop_session_op{ | ||
| 63 | cryptocop_session_id ses_id; | ||
| 64 | |||
| 65 | cryptocop_cipher_type cipher; /* AES, DES, 3DES, m2m, none */ | ||
| 66 | |||
| 67 | cryptocop_cipher_mode cmode; /* ECB, CBC, none */ | ||
| 68 | cryptocop_3des_mode des3_mode; | ||
| 69 | |||
| 70 | cryptocop_digest_type digest; /* MD5, SHA1, none */ | ||
| 71 | |||
| 72 | cryptocop_csum_type csum; /* BE, LE, none */ | ||
| 73 | |||
| 74 | unsigned char *key; | ||
| 75 | size_t keylen; | ||
| 76 | }; | ||
| 77 | |||
| 78 | #define CRYPTOCOP_CSUM_LENGTH (2) | ||
| 79 | #define CRYPTOCOP_MAX_DIGEST_LENGTH (20) /* SHA-1 20, MD5 16 */ | ||
| 80 | #define CRYPTOCOP_MAX_IV_LENGTH (16) /* (3)DES==8, AES == 16 */ | ||
| 81 | #define CRYPTOCOP_MAX_KEY_LENGTH (32) | ||
| 82 | |||
| 83 | struct strcop_crypto_op{ | ||
| 84 | cryptocop_session_id ses_id; | ||
| 85 | |||
| 86 | /* Indata. */ | ||
| 87 | unsigned char *indata; | ||
| 88 | size_t inlen; /* Total indata length. */ | ||
| 89 | |||
| 90 | /* Cipher configuration. */ | ||
| 91 | unsigned char do_cipher:1; | ||
| 92 | unsigned char decrypt:1; /* 1 == decrypt, 0 == encrypt */ | ||
| 93 | unsigned char cipher_explicit:1; | ||
| 94 | size_t cipher_start; | ||
| 95 | size_t cipher_len; | ||
| 96 | /* cipher_iv is used if do_cipher and cipher_explicit and the cipher | ||
| 97 | mode is CBC. The length is controlled by the type of cipher, | ||
| 98 | e.g. DES/3DES 8 octets and AES 16 octets. */ | ||
| 99 | unsigned char cipher_iv[CRYPTOCOP_MAX_IV_LENGTH]; | ||
| 100 | /* Outdata. */ | ||
| 101 | unsigned char *cipher_outdata; | ||
| 102 | size_t cipher_outlen; | ||
| 103 | |||
| 104 | /* digest configuration. */ | ||
| 105 | unsigned char do_digest:1; | ||
| 106 | size_t digest_start; | ||
| 107 | size_t digest_len; | ||
| 108 | /* Outdata. The actual length is determined by the type of the digest. */ | ||
| 109 | unsigned char digest[CRYPTOCOP_MAX_DIGEST_LENGTH]; | ||
| 110 | |||
| 111 | /* Checksum configuration. */ | ||
| 112 | unsigned char do_csum:1; | ||
| 113 | size_t csum_start; | ||
| 114 | size_t csum_len; | ||
| 115 | /* Outdata. */ | ||
| 116 | unsigned char csum[CRYPTOCOP_CSUM_LENGTH]; | ||
| 117 | }; | ||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | #endif /* _UAPICRYPTOCOP_H */ | ||
diff --git a/arch/cris/include/arch-v32/arch/user.h b/arch/cris/include/uapi/arch-v32/arch/user.h index 03fa1f3c3c00..03fa1f3c3c00 100644 --- a/arch/cris/include/arch-v32/arch/user.h +++ b/arch/cris/include/uapi/arch-v32/arch/user.h | |||
