FreeTDS API: include/des.h Source File

FreeTDS API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
des.h
1 #ifndef DES_H
2 #define DES_H
3
4 #ifdef HAVE_NETTLE
5 #include <nettle/des.h>
6
7 typedef struct des_ctx DES_KEY;
8 #endif
9
10 #include <freetds/pushvis.h>
11
12 typedef unsigned char des_cblock[8];
13
14 #ifndef HAVE_NETTLE
15 typedef struct des_key
16 {
17 unsigned char kn[16][8];
18 TDS_UINT sp[8][64];
19 unsigned char iperm[16][16][8];
20 unsigned char fperm[16][16][8];
21 } DES_KEY;
22
23 int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len);
24 void tds_des_encrypt(DES_KEY * key, des_cblock block);
25 #endif
26
27 void tds_des_set_odd_parity(des_cblock key);
28 int tds_des_ecb_encrypt(const void *plaintext, int len, DES_KEY * akey, unsigned char *output);
29
30 #include <freetds/popvis.h>
31
32 #ifdef HAVE_NETTLE
33 static inline void tds_des_encrypt(DES_KEY * key, des_cblock block)
34 {
35 nettle_des_encrypt(key, sizeof(des_cblock), block, block);
36 }
37
38 static inline int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key, int len)
39 {
40 return nettle_des_set_key(dkey, user_key);
41 }
42 #endif
43
44 #endif /* !DES_H */
des_key
Definition: des.h:15