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
; /* operational switches, use 0 in doubt */
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 /* struct crypt_op flags */
100 #define COP_FLAG_NONE (0 << 0) /* totally no flag */
102 /* Stuff for bignum arithmetic and public key
103 * cryptography - not supported yet by linux
107 #define CRYPTO_ALG_FLAG_SUPPORTED 1
108 #define CRYPTO_ALG_FLAG_RNG_ENABLE 2
109 #define CRYPTO_ALG_FLAG_DSA_SHA 4
116 #define CRK_MAXPARAM 8
118 /* input of CIOCKEY */
120 uint32_t crk_op
; /* cryptodev_crk_ot_t */
122 uint16_t crk_iparams
;
123 uint16_t crk_oparams
;
125 struct crparam crk_param
[CRK_MAXPARAM
];
133 CRK_DH_COMPUTE_KEY
=4,
135 } cryptodev_crk_op_t
;
137 #define CRK_ALGORITHM_MAX CRK_ALGORITHM_ALL-1
139 /* features to be queried with CIOCASYMFEAT ioctl
141 #define CRF_MOD_EXP (1 << CRK_MOD_EXP)
142 #define CRF_MOD_EXP_CRT (1 << CRK_MOD_EXP_CRT)
143 #define CRF_DSA_SIGN (1 << CRK_DSA_SIGN)
144 #define CRF_DSA_VERIFY (1 << CRK_DSA_VERIFY)
145 #define CRF_DH_COMPUTE_KEY (1 << CRK_DH_COMPUTE_KEY)
148 /* ioctl's. Compatible with old linux cryptodev.h
150 #define CRIOGET _IOWR('c', 101, uint32_t)
151 #define CIOCGSESSION _IOWR('c', 102, struct session_op)
152 #define CIOCFSESSION _IOW('c', 103, uint32_t)
153 #define CIOCCRYPT _IOWR('c', 104, struct crypt_op)
154 #define CIOCKEY _IOWR('c', 105, struct crypt_kop)
155 #define CIOCASYMFEAT _IOR('c', 106, uint32_t)
157 #endif /* L_CRYPTODEV_H */