Lines Matching refs:cbc
29 int cbc_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CBC *cbc) in cbc_decrypt() argument
41 LTC_ARGCHK(cbc != NULL); in cbc_decrypt()
43 if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) { in cbc_decrypt()
48 if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) { in cbc_decrypt()
52 if (len % cbc->blocklen) { in cbc_decrypt()
56 if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) { in cbc_decrypt()
61 if (cipher_descriptor[cbc->cipher].accel_cbc_decrypt != NULL) { in cbc_decrypt()
62 …return cipher_descriptor[cbc->cipher].accel_cbc_decrypt(ct, pt, len / cbc->blocklen, cbc->IV, &cbc… in cbc_decrypt()
66 if ((err = cipher_descriptor[cbc->cipher].ecb_decrypt(ct, tmp, &cbc->key)) != CRYPT_OK) { in cbc_decrypt()
72 for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) { in cbc_decrypt()
73 …tmpy = *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) ^ *((LTC_FAST_TYPE*)((unsigned char *)tmp… in cbc_decrypt()
74 … *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) = *((LTC_FAST_TYPE*)((unsigned char *)ct + x)); in cbc_decrypt()
78 for (x = 0; x < cbc->blocklen; x++) { in cbc_decrypt()
79 tmpy = tmp[x] ^ cbc->IV[x]; in cbc_decrypt()
80 cbc->IV[x] = ct[x]; in cbc_decrypt()
85 ct += cbc->blocklen; in cbc_decrypt()
86 pt += cbc->blocklen; in cbc_decrypt()
87 len -= cbc->blocklen; in cbc_decrypt()