30 #include <protocols/des.h>
31 #include <libc/string.h>
35 #ifdef POK_NEEDS_PROTOCOLS_DES
37 unsigned char initVector[8] = POK_PROTOCOLS_DES_INIT;
39 static unsigned char cbc_key [8]= POK_PROTOCOLS_DES_KEY;
41 int pok_protocols_des_is_init = 0;
43 void pok_protocols_des_init ()
45 if (pok_protocols_des_is_init == 1)
50 pok_protocols_des_is_init = 1;
59 DES_set_key_checked (&cbc_key, &schedule);
61 memcpy(ivec,initVector,
sizeof(initVector));
63 DES_ncbc_encrypt(uncrypted_data, crypted_data, uncrypted_size, &schedule, &ivec, DES_ENCRYPT);
73 DES_set_key_checked (&cbc_key, &schedule);
75 memcpy(ivec,initVector,
sizeof(initVector));
76 DES_ncbc_encrypt(crypted_data, uncrypted_data, crypted_size, &schedule, &ivec, DES_DECRYPT);