arch: remove tile port
[sfrench/cifs-2.6.git] / arch / cris / include / uapi / arch-v32 / arch / cryptocop.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * The device /dev/cryptocop is accessible using this driver using
4  * CRYPTOCOP_MAJOR (254) and minor number 0.
5  */
6
7 #ifndef _UAPICRYPTOCOP_H
8 #define _UAPICRYPTOCOP_H
9
10 #include <linux/uio.h>
11
12
13 #define CRYPTOCOP_SESSION_ID_NONE (0)
14
15 typedef unsigned long long int cryptocop_session_id;
16
17 /* cryptocop ioctls */
18 #define ETRAXCRYPTOCOP_IOCTYPE         (250)
19
20 #define CRYPTOCOP_IO_CREATE_SESSION    _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 1, struct strcop_session_op)
21 #define CRYPTOCOP_IO_CLOSE_SESSION     _IOW(ETRAXCRYPTOCOP_IOCTYPE, 2, struct strcop_session_op)
22 #define CRYPTOCOP_IO_PROCESS_OP        _IOWR(ETRAXCRYPTOCOP_IOCTYPE, 3, struct strcop_crypto_op)
23 #define CRYPTOCOP_IO_MAXNR             (3)
24
25 typedef enum {
26         cryptocop_cipher_des = 0,
27         cryptocop_cipher_3des = 1,
28         cryptocop_cipher_aes = 2,
29         cryptocop_cipher_m2m = 3, /* mem2mem is essentially a NULL cipher with blocklength=1 */
30         cryptocop_cipher_none
31 } cryptocop_cipher_type;
32
33 typedef enum {
34         cryptocop_digest_sha1 = 0,
35         cryptocop_digest_md5 = 1,
36         cryptocop_digest_none
37 } cryptocop_digest_type;
38
39 typedef enum {
40         cryptocop_csum_le = 0,
41         cryptocop_csum_be = 1,
42         cryptocop_csum_none
43 } cryptocop_csum_type;
44
45 typedef enum {
46         cryptocop_cipher_mode_ecb = 0,
47         cryptocop_cipher_mode_cbc,
48         cryptocop_cipher_mode_none
49 } cryptocop_cipher_mode;
50
51 typedef enum {
52         cryptocop_3des_eee = 0,
53         cryptocop_3des_eed = 1,
54         cryptocop_3des_ede = 2,
55         cryptocop_3des_edd = 3,
56         cryptocop_3des_dee = 4,
57         cryptocop_3des_ded = 5,
58         cryptocop_3des_dde = 6,
59         cryptocop_3des_ddd = 7
60 } cryptocop_3des_mode;
61
62 /* Usermode accessible (ioctl) operations. */
63 struct strcop_session_op{
64         cryptocop_session_id    ses_id;
65
66         cryptocop_cipher_type   cipher; /* AES, DES, 3DES, m2m, none */
67
68         cryptocop_cipher_mode   cmode; /* ECB, CBC, none */
69         cryptocop_3des_mode     des3_mode;
70
71         cryptocop_digest_type   digest; /* MD5, SHA1, none */
72
73         cryptocop_csum_type     csum;   /* BE, LE, none */
74
75         unsigned char           *key;
76         size_t                  keylen;
77 };
78
79 #define CRYPTOCOP_CSUM_LENGTH         (2)
80 #define CRYPTOCOP_MAX_DIGEST_LENGTH   (20)  /* SHA-1 20, MD5 16 */
81 #define CRYPTOCOP_MAX_IV_LENGTH       (16)  /* (3)DES==8, AES == 16 */
82 #define CRYPTOCOP_MAX_KEY_LENGTH      (32)
83
84 struct strcop_crypto_op{
85         cryptocop_session_id ses_id;
86
87         /* Indata. */
88         unsigned char            *indata;
89         size_t                   inlen; /* Total indata length. */
90
91         /* Cipher configuration. */
92         unsigned char            do_cipher:1;
93         unsigned char            decrypt:1; /* 1 == decrypt, 0 == encrypt */
94         unsigned char            cipher_explicit:1;
95         size_t                   cipher_start;
96         size_t                   cipher_len;
97         /* cipher_iv is used if do_cipher and cipher_explicit and the cipher
98            mode is CBC.  The length is controlled by the type of cipher,
99            e.g. DES/3DES 8 octets and AES 16 octets. */
100         unsigned char            cipher_iv[CRYPTOCOP_MAX_IV_LENGTH];
101         /* Outdata. */
102         unsigned char            *cipher_outdata;
103         size_t                   cipher_outlen;
104
105         /* digest configuration. */
106         unsigned char            do_digest:1;
107         size_t                   digest_start;
108         size_t                   digest_len;
109         /* Outdata.  The actual length is determined by the type of the digest. */
110         unsigned char            digest[CRYPTOCOP_MAX_DIGEST_LENGTH];
111
112         /* Checksum configuration. */
113         unsigned char            do_csum:1;
114         size_t                   csum_start;
115         size_t                   csum_len;
116         /* Outdata. */
117         unsigned char            csum[CRYPTOCOP_CSUM_LENGTH];
118 };
119
120
121
122
123 #endif /* _UAPICRYPTOCOP_H */