FreeTDS API: include/freetds/utils/des.h Source File

FreeTDS API

Loading...
Searching...
No Matches
des.h
1#ifndef _tdsguard_frXREepoqzIh7i5y4TSoh7_
2#define _tdsguard_frXREepoqzIh7i5y4TSoh7_
3
4#ifdef HAVE_NETTLE
5#include <nettle/des.h>
6
7typedef struct des_ctx DES_KEY;
8#endif
9
10#include <freetds/pushvis.h>
11
12typedef 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
23int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key);
24void tds_des_encrypt(const DES_KEY * key, des_cblock block);
25#endif
26
27void tds_des_set_odd_parity(des_cblock key);
28int 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
33static 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
38static inline int tds_des_set_key(DES_KEY * dkey, const des_cblock user_key)
39{
40 return nettle_des_set_key(dkey, user_key);
41}
42#endif
43
44#endif /* !_tdsguard_frXREepoqzIh7i5y4TSoh7_ */
des_key
Definition des.h:16