1
2
3
4
5
6#ifndef __CRYPTO_DES_H
7#define __CRYPTO_DES_H
8
9#include <linux/types.h>
10
11#define DES_KEY_SIZE 8
12#define DES_EXPKEY_WORDS 32
13#define DES_BLOCK_SIZE 8
14
15#define DES3_EDE_KEY_SIZE (3 * DES_KEY_SIZE)
16#define DES3_EDE_EXPKEY_WORDS (3 * DES_EXPKEY_WORDS)
17#define DES3_EDE_BLOCK_SIZE DES_BLOCK_SIZE
18
19struct des_ctx {
20 u32 expkey[DES_EXPKEY_WORDS];
21};
22
23struct des3_ede_ctx {
24 u32 expkey[DES3_EDE_EXPKEY_WORDS];
25};
26
27void des_encrypt(const struct des_ctx *ctx, u8 *dst, const u8 *src);
28void des_decrypt(const struct des_ctx *ctx, u8 *dst, const u8 *src);
29
30void des3_ede_encrypt(const struct des3_ede_ctx *dctx, u8 *dst, const u8 *src);
31void des3_ede_decrypt(const struct des3_ede_ctx *dctx, u8 *dst, const u8 *src);
32
33
34
35
36
37
38
39
40
41
42int des_expand_key(struct des_ctx *ctx, const u8 *key, unsigned int keylen);
43
44
45
46
47
48
49
50
51
52
53
54int des3_ede_expand_key(struct des3_ede_ctx *ctx, const u8 *key,
55 unsigned int keylen);
56
57#endif
58