Home | History | Annotate | Download | only in cbc

Lines Matching refs:cbc

15    CBC implementation, encrypt block, Tom St Denis
22 CBC encrypt
26 @param cbc CBC state
29 int cbc_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CBC *cbc)
35 LTC_ARGCHK(cbc != NULL);
37 if ((err = cipher_is_valid(cbc->cipher)) != CRYPT_OK) {
42 if (cbc->blocklen < 1 || cbc->blocklen > (int)sizeof(cbc->IV)) {
46 if (len % cbc->blocklen) {
50 if (cbc->blocklen % sizeof(LTC_FAST_TYPE)) {
55 if (cipher_descriptor[cbc->cipher].accel_cbc_encrypt != NULL) {
56 return cipher_descriptor[cbc->cipher].accel_cbc_encrypt(pt, ct, len / cbc->blocklen, cbc->IV, &cbc->key);
61 for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) {
62 *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) ^= *((LTC_FAST_TYPE*)((unsigned char *)pt + x));
65 for (x = 0; x < cbc->blocklen; x++) {
66 cbc->IV[x] ^= pt[x];
71 if ((err = cipher_descriptor[cbc->cipher].ecb_encrypt(cbc->IV, ct, &cbc->key)) != CRYPT_OK) {
77 for (x = 0; x < cbc->blocklen; x += sizeof(LTC_FAST_TYPE)) {
78 *((LTC_FAST_TYPE*)((unsigned char *)cbc->IV + x)) = *((LTC_FAST_TYPE*)((unsigned char *)ct + x));
81 for (x = 0; x < cbc->blocklen; x++) {
82 cbc->IV[x] = ct[x];
86 ct += cbc->blocklen;
87 pt += cbc->blocklen;
88 len -= cbc->blocklen;
96 /* $Source: /cvs/libtom/libtomcrypt/src/modes/cbc/cbc_encrypt.c,v $ */