33 #include "netif/ppp/ppp_opts.h" 34 #if PPP_SUPPORT && MSCHAP_SUPPORT 36 #include "netif/ppp/ppp_impl.h" 38 #include "netif/ppp/pppcrypt.h" 41 static u_char pppcrypt_get_7bits(u_char *input,
int startBit) {
44 word = (unsigned)input[startBit / 8] << 8;
45 word |= (unsigned)input[startBit / 8 + 1];
47 word >>= 15 - (startBit % 8 + 7);
55 void pppcrypt_56_to_64_bit_key(u_char *key, u_char * des_key) {
56 des_key[0] = pppcrypt_get_7bits(key, 0);
57 des_key[1] = pppcrypt_get_7bits(key, 7);
58 des_key[2] = pppcrypt_get_7bits(key, 14);
59 des_key[3] = pppcrypt_get_7bits(key, 21);
60 des_key[4] = pppcrypt_get_7bits(key, 28);
61 des_key[5] = pppcrypt_get_7bits(key, 35);
62 des_key[6] = pppcrypt_get_7bits(key, 42);
63 des_key[7] = pppcrypt_get_7bits(key, 49);