FreeTDS API

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 uint8_t des_cblock[8];
13
14 #ifndef HAVE_NETTLE
15 typedef struct des_key
16 {
17 uint8_t kn[16][8];
18 uint32_t sp[8][64];
19 uint8_t iperm[16][16][8];
20 uint8_t 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(const 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, uint8_t *output);
29
30 #include <freetds/popvis.h>
31
32 #ifdef HAVE_NETTLE
33 static inline void tds_des_encrypt(const 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:16