1 /* This is a source compatible implementation with the original API of
2 * cryptodev by Angelos D. Keromytis, found at openbsd cryptodev.h.
3 * Placed under public domain */
8 #include <linux/types.h>
13 /* API extensions for linux */
14 #define CRYPTO_HMAC_MAX_KEY_LEN 512
15 #define CRYPTO_CIPHER_MAX_KEY_LEN 64
17 /* All the supported algorithms
19 enum cryptodev_crypto_op_t
{
24 CRYPTO_SKIPJACK_CBC
= 5,
27 CRYPTO_RIPEMD160_HMAC
= 8,
29 CRYPTO_SHA1_KPDK
= 10,
30 CRYPTO_RIJNDAEL128_CBC
= 11,
31 CRYPTO_AES_CBC
= CRYPTO_RIJNDAEL128_CBC
,
35 CRYPTO_DEFLATE_COMP
= 15,
38 CRYPTO_SHA2_256_HMAC
= 18,
39 CRYPTO_SHA2_384_HMAC
= 19,
40 CRYPTO_SHA2_512_HMAC
= 20,
44 CRYPTO_CAMELLIA_CBC
= 101,
49 CRYPTO_ALGORITHM_ALL
, /* Keep updated - see below */
52 #define CRYPTO_ALGORITHM_MAX (CRYPTO_ALGORITHM_ALL - 1)
54 /* Values for ciphers */
55 #define DES_BLOCK_LEN 8
56 #define DES3_BLOCK_LEN 8
57 #define RIJNDAEL128_BLOCK_LEN 16
58 #define AES_BLOCK_LEN RIJNDAEL128_BLOCK_LEN
59 #define CAMELLIA_BLOCK_LEN
60 #define BLOWFISH_BLOCK_LEN 8
61 #define SKIPJACK_BLOCK_LEN 8
62 #define CAST128_BLOCK_LEN 8
64 /* the maximum of the above */
65 #define EALG_MAX_BLOCK_LEN 16
67 /* Values for hashes/MAC */
68 #define AALG_MAX_RESULT_LEN 64
70 /* input of CIOCGSESSION */
72 /* Specify either cipher or mac
74 __u32 cipher
; /* cryptodev_crypto_op_t */
75 __u32 mac
; /* cryptodev_crypto_op_t */
82 __u32 ses
; /* session identifier */
88 /* input of CIOCCRYPT */
90 __u32 ses
; /* session identifier */
91 __u16 op
; /* COP_ENCRYPT or COP_DECRYPT */
92 __u16 flags
; /* no usage so far, use 0 */
93 __u32 len
; /* length of source data */
94 __u8 __user
*src
; /* source data */
95 __u8 __user
*dst
; /* pointer to output data */
96 /* pointer to output data for hash/MAC operations */
98 /* initialization vector for encryption operations */
102 /* struct crypt_op flags */
104 #define COP_FLAG_NONE (0 << 0) /* totally no flag */
105 #define COP_FLAG_UPDATE (1 << 0) /* multi-update hash mode */
106 #define COP_FLAG_FINAL (1 << 1) /* multi-update final hash mode */
108 /* Stuff for bignum arithmetic and public key
109 * cryptography - not supported yet by linux
113 #define CRYPTO_ALG_FLAG_SUPPORTED 1
114 #define CRYPTO_ALG_FLAG_RNG_ENABLE 2
115 #define CRYPTO_ALG_FLAG_DSA_SHA 4
122 #define CRK_MAXPARAM 8
124 /* input of CIOCKEY */
126 __u32 crk_op
; /* cryptodev_crk_ot_t */
131 struct crparam crk_param
[CRK_MAXPARAM
];
134 enum cryptodev_crk_op_t
{
139 CRK_DH_COMPUTE_KEY
= 4,
143 #define CRK_ALGORITHM_MAX (CRK_ALGORITHM_ALL-1)
145 /* features to be queried with CIOCASYMFEAT ioctl
147 #define CRF_MOD_EXP (1 << CRK_MOD_EXP)
148 #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT)
149 #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN)
150 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
151 #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
154 /* ioctl's. Compatible with old linux cryptodev.h
156 #define CRIOGET _IOWR('c', 101, __u32)
157 #define CIOCGSESSION _IOWR('c', 102, struct session_op)
158 #define CIOCFSESSION _IOW('c', 103, __u32)
159 #define CIOCCRYPT _IOWR('c', 104, struct crypt_op)
160 #define CIOCKEY _IOWR('c', 105, struct crypt_kop)
161 #define CIOCASYMFEAT _IOR('c', 106, __u32)
163 /* to indicate that CRIOGET is not required in linux
165 #define CRIOGET_NOT_NEEDED 1
167 #endif /* L_CRYPTODEV_H */