9 void __des_setkey(const unsigned char *key, struct expanded_key *ekey);
10 void __do_des(uint32_t l_in, uint32_t r_in,
11 uint32_t *l_out, uint32_t *r_out,
12 uint32_t count, uint32_t saltbits, const struct expanded_key *ekey);
15 static struct expanded_key __encrypt_key;
17 void setkey(const char *key)
19 unsigned char bkey[8];
22 for (i = 0; i < 8; i++) {
24 for (j = 7; j >= 0; j--, key++)
25 bkey[i] |= (uint32_t)(*key & 1) << j;
28 __des_setkey(bkey, &__encrypt_key);
31 void encrypt(char *block, int edflag)
33 struct expanded_key decrypt_key, *key;
39 for (i = 0; i < 2; i++) {
41 for (j = 31; j >= 0; j--, p++)
42 b[i] |= (uint32_t)(*p & 1) << j;
48 for (i = 0; i < 16; i++) {
49 decrypt_key.l[i] = __encrypt_key.l[15-i];
50 decrypt_key.r[i] = __encrypt_key.r[15-i];
54 __do_des(b[0], b[1], b, b + 1, 1, 0, key);
57 for (i = 0; i < 2; i++)
58 for (j = 31; j >= 0; j--)