Lines Matching defs:cipher
79 int rijndael_cipherInit(cipherInstance *cipher, BYTE mode, char *IV) {
81 cipher->mode = mode;
86 bcopy(IV, cipher->IV, MAX_IV_SIZE);
88 bzero(cipher->IV, MAX_IV_SIZE);
93 int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key,
98 if (cipher == NULL ||
109 switch (cipher->mode) {
120 bcopy(cipher->IV, block, 16);
127 ((word32*)block)[0] = ((word32*)cipher->IV)[0] ^ ((word32*)input)[0];
128 ((word32*)block)[1] = ((word32*)cipher->IV)[1] ^ ((word32*)input)[1];
129 ((word32*)block)[2] = ((word32*)cipher->IV)[2] ^ ((word32*)input)[2];
130 ((word32*)block)[3] = ((word32*)cipher->IV)[3] ^ ((word32*)input)[3];
156 bcopy(cipher->IV, iv, 16);
158 *((word32*)iv[0]) = *((word32*)(cipher->IV ));
159 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4));
160 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8));
161 *((word32*)iv[3]) = *((word32*)(cipher->IV+12));
207 int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key,
212 if (cipher == NULL ||
223 switch (cipher->mode) {
240 iv = cipher->IV;
270 int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key,
275 if (cipher == NULL ||
277 (cipher->mode != MODE_CFB1 && key->direction == DIR_ENCRYPT)) {
286 switch (cipher->mode) {
297 bcopy(cipher->IV, iv, 16);
299 *((word32*)iv[0]) = *((word32*)(cipher->IV ));
300 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4));
301 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8));
302 *((word32*)iv[3]) = *((word32*)(cipher->IV+12));
326 bcopy(cipher->IV, iv, 16);
328 *((word32*)iv[0]) = *((word32*)(cipher->IV));
329 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4));
330 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8));
331 *((word32*)iv[3]) = *((word32*)(cipher->IV+12));
368 int rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key,
374 if (cipher == NULL ||
388 switch (cipher->mode) {
411 bcopy(cipher->IV, iv, 16);
458 * BAD_CIPHER_STATE - cipher in bad state (e.g., not initialized)
460 int rijndael_cipherUpdateRounds(cipherInstance *cipher, keyInstance *key,
465 if (cipher == NULL || key == NULL) {