4 // sets parity for a 8-byte des key
5 void des_set_odd_parity(uint8_t* key
);
7 // checks parity for a 8-byte des key
8 // returns 0 if parity is not ok
9 // returns 1 if parity is ok
10 int8_t check_parity(const uint8_t* key
);
12 // matches the given 8-byte des key against known weak keys
13 // return 0 if key is not weak
14 // return 1 if key is weak
15 int8_t des_is_weak_key(const uint8_t* key
);
17 // expands the given 8-byte des key "key"
18 // into "shedule", which must be of type "uint32_t schedule[32]"
20 int8_t des_set_key(const uint8_t* key
, uint32_t* schedule
);
22 // crypts 8 bytes of "data" with key shedule "ks"
23 // encrypt = 1 -> encrypt
24 // encrypt = 0 -> decrypt
25 void des(uint8_t* data
, const uint32_t* schedule
, int8_t do_encrypt
);
27 // these functions take a 8-byte des key and crypt data of any length ("len")
28 void des_ecb_encrypt(uint8_t* data
, const uint8_t* key
, int32_t len
);
29 void des_ecb_decrypt(uint8_t* data
, const uint8_t* key
, int32_t len
);
31 void des_cbc_encrypt(uint8_t* data
, const uint8_t* iv
, const uint8_t* key
, int32_t len
);
32 void des_cbc_decrypt(uint8_t* data
, const uint8_t* iv
, const uint8_t* key
, int32_t len
);
34 void des_ede2_cbc_encrypt(uint8_t* data
, const uint8_t* iv
, const uint8_t* key1
, const uint8_t* key2
, int32_t len
);
35 void des_ede2_cbc_decrypt(uint8_t* data
, const uint8_t* iv
, const uint8_t* key1
, const uint8_t* key2
, int32_t len
);
37 void des_ecb3_encrypt(uint8_t* data
, const uint8_t* key
);
38 void des_ecb3_decrypt(uint8_t* data
, const uint8_t* key
);