Lines Matching refs:cipher

83 int cipherInit(cipherInstance *cipher, BYTE mode, char *IV) {  in cipherInit()  argument
85 cipher->mode = mode; in cipherInit()
107 cipher->IV[i] = (word8)j; in cipherInit()
110 memcpy(cipher->IV, IV, MAX_IV_SIZE); in cipherInit()
113 memset(cipher->IV, 0, MAX_IV_SIZE); in cipherInit()
118 int blockEncrypt(cipherInstance *cipher, keyInstance *key, in blockEncrypt() argument
123 if (cipher == NULL || in blockEncrypt()
134 switch (cipher->mode) { in blockEncrypt()
144 ((word32*)block)[0] = ((word32*)cipher->IV)[0] ^ ((word32*)input)[0]; in blockEncrypt()
145 ((word32*)block)[1] = ((word32*)cipher->IV)[1] ^ ((word32*)input)[1]; in blockEncrypt()
146 ((word32*)block)[2] = ((word32*)cipher->IV)[2] ^ ((word32*)input)[2]; in blockEncrypt()
147 ((word32*)block)[3] = ((word32*)cipher->IV)[3] ^ ((word32*)input)[3]; in blockEncrypt()
163 memcpy(iv, cipher->IV, 16); in blockEncrypt()
165 *((word32*)iv[0]) = *((word32*)(cipher->IV )); in blockEncrypt()
166 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4)); in blockEncrypt()
167 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8)); in blockEncrypt()
168 *((word32*)iv[3]) = *((word32*)(cipher->IV+12)); in blockEncrypt()
214 int padEncrypt(cipherInstance *cipher, keyInstance *key, in padEncrypt() argument
219 if (cipher == NULL || in padEncrypt()
230 switch (cipher->mode) { in padEncrypt()
245 iv = cipher->IV; in padEncrypt()
274 int blockDecrypt(cipherInstance *cipher, keyInstance *key, in blockDecrypt() argument
279 if (cipher == NULL || in blockDecrypt()
281 cipher->mode != MODE_CFB1 && key->direction == DIR_ENCRYPT) { in blockDecrypt()
290 switch (cipher->mode) { in blockDecrypt()
301 memcpy(iv, cipher->IV, 16); in blockDecrypt()
303 *((word32*)iv[0]) = *((word32*)(cipher->IV )); in blockDecrypt()
304 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4)); in blockDecrypt()
305 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8)); in blockDecrypt()
306 *((word32*)iv[3]) = *((word32*)(cipher->IV+12)); in blockDecrypt()
330 memcpy(iv, cipher->IV, 16); in blockDecrypt()
332 *((word32*)iv[0]) = *((word32*)(cipher->IV)); in blockDecrypt()
333 *((word32*)iv[1]) = *((word32*)(cipher->IV+ 4)); in blockDecrypt()
334 *((word32*)iv[2]) = *((word32*)(cipher->IV+ 8)); in blockDecrypt()
335 *((word32*)iv[3]) = *((word32*)(cipher->IV+12)); in blockDecrypt()
372 int padDecrypt(cipherInstance *cipher, keyInstance *key, in padDecrypt() argument
378 if (cipher == NULL || in padDecrypt()
392 switch (cipher->mode) { in padDecrypt()
415 memcpy(iv, cipher->IV, 16); in padDecrypt()
464 int cipherUpdateRounds(cipherInstance *cipher, keyInstance *key, in cipherUpdateRounds() argument
469 if (cipher == NULL || key == NULL) { in cipherUpdateRounds()