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 */
12 /* API extensions for linux */
13 #define CRYPTO_HMAC_MAX_KEY_LEN 512
14 #define CRYPTO_CIPHER_MAX_KEY_LEN 64
16 /* All the supported algorithms
23 CRYPTO_SKIPJACK_CBC
=5,
26 CRYPTO_RIPEMD160_HMAC
=8,
29 CRYPTO_RIJNDAEL128_CBC
=11,
30 CRYPTO_AES_CBC
=CRYPTO_RIJNDAEL128_CBC
,
34 CRYPTO_DEFLATE_COMP
=15,
37 CRYPTO_SHA2_256_HMAC
=18,
38 CRYPTO_SHA2_384_HMAC
=19,
39 CRYPTO_SHA2_512_HMAC
=20,
43 CRYPTO_CAMELLIA_CBC
=101,
48 CRYPTO_ALGORITHM_ALL
, /* Keep updated - see below */
49 } cryptodev_crypto_op_t
;
50 #define CRYPTO_ALGORITHM_MAX (CRYPTO_ALGORITHM_ALL - 1)
52 /* Values for ciphers */
53 #define DES_BLOCK_LEN 8
54 #define DES3_BLOCK_LEN 8
55 #define RIJNDAEL128_BLOCK_LEN 16
56 #define AES_BLOCK_LEN RIJNDAEL128_BLOCK_LEN
57 #define CAMELLIA_BLOCK_LEN
58 #define BLOWFISH_BLOCK_LEN 8
59 #define SKIPJACK_BLOCK_LEN 8
60 #define CAST128_BLOCK_LEN 8
62 /* the maximum of the above */
63 #define EALG_MAX_BLOCK_LEN 16
65 /* Values for hashes/MAC */
66 #define AALG_MAX_RESULT_LEN 64
68 /* input of CIOCGSESSION */
70 /* Specify either cipher or mac
72 uint32_t cipher
; /* cryptodev_crypto_op_t */
73 uint32_t mac
; /* cryptodev_crypto_op_t */
80 uint32_t ses
; /* session identifier */
86 /* input of CIOCCRYPT */
88 uint32_t ses
; /* session identifier */
89 uint16_t op
; /* COP_ENCRYPT or COP_DECRYPT */
90 uint16_t flags
; /* no usage so far, use 0 */
91 uint32_t len
; /* length of source data */
92 uint8_t * src
; /* source data */
93 uint8_t * dst
; /* pointer to output data */
94 uint8_t * mac
; /* pointer to output data for hash/MAC operations */
95 uint8_t * iv
; /* initialization vector for encryption operations */
98 /* Stuff for bignum arithmetic and public key
99 * cryptography - not supported yet by linux
103 #define CRYPTO_ALG_FLAG_SUPPORTED 1
104 #define CRYPTO_ALG_FLAG_RNG_ENABLE 2
105 #define CRYPTO_ALG_FLAG_DSA_SHA 4
112 #define CRK_MAXPARAM 8
114 /* input of CIOCKEY */
116 uint32_t crk_op
; /* cryptodev_crk_ot_t */
118 uint16_t crk_iparams
;
119 uint16_t crk_oparams
;
121 struct crparam crk_param
[CRK_MAXPARAM
];
129 CRK_DH_COMPUTE_KEY
=4,
131 } cryptodev_crk_op_t
;
133 #define CRK_ALGORITHM_MAX CRK_ALGORITHM_ALL-1
135 /* features to be queried with CIOCASYMFEAT ioctl
137 #define CRF_MOD_EXP (1 << CRK_MOD_EXP)
138 #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT)
139 #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN)
140 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
141 #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
144 /* ioctl's. Compatible with old linux cryptodev.h
146 #define CRIOGET _IOWR('c', 101, uint32_t)
147 #define CIOCGSESSION _IOWR('c', 102, struct session_op)
148 #define CIOCFSESSION _IOW('c', 103, uint32_t)
149 #define CIOCCRYPT _IOWR('c', 104, struct crypt_op)
150 #define CIOCKEY _IOWR('c', 105, struct crypt_kop)
151 #define CIOCASYMFEAT _IOR('c', 106, uint32_t)
153 #endif /* L_CRYPTODEV_H */