#ifdef NOSPOOKS #include "lib9.h" #include void b3CBCEncrypt(uchar in[8], uchar icv[8], uchar int_key[3][128], int count) { int j; if (count == 8) { for (j=0; j < 8; j++) in[j] ^= icv[j]; triple_block_cipher(int_key, in, 0); for (j=0; j < 8; j++) icv[j] = in[j]; } else { triple_block_cipher(int_key, icv, 0); for (j = 0; j < count; j++) in[j] ^= icv[j]; } } void b3CBCDecrypt(uchar in[8], uchar icv[8], uchar int_key[3][128], int count) { uchar tmp[8]; int j; if (count == 8) { for (j=0; j < 8; j++) tmp[j] = in[j]; triple_block_cipher(int_key, in, 1); for (j=0; j < 8; j++) { in[j] ^= icv[j]; icv[j] = tmp[j]; } } else { triple_block_cipher(int_key, icv, 0); for (j = 0; j < count; j++) in[j] ^= icv[j]; } } void block3CBCEncrypt(uchar block[8], uchar icv[8], uchar key[3][8], int len, DES3state *s) { if(s->setup != 0xdeadbeef) setupDES3state(s, key, icv); b3CBCEncrypt(block, s->ivec, s->expanded, len); } void block3CBCDecrypt(uchar block[8], uchar icv[8], uchar key[3][8], int len, DES3state *s) { if(s->setup != 0xdeadbeef) setupDES3state(s, key, icv); b3CBCDecrypt(block, s->ivec, s->expanded, len); } #endif NOSPOOKS