• Home
  • Raw
  • Download

Lines Matching refs:ctr

29 int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr)  in ctr_encrypt()  argument
35 LTC_ARGCHK(ctr != NULL); in ctr_encrypt()
37 if ((err = cipher_is_valid(ctr->cipher)) != CRYPT_OK) { in ctr_encrypt()
42 if (ctr->blocklen < 1 || ctr->blocklen > (int)sizeof(ctr->ctr) || in ctr_encrypt()
43 ctr->padlen < 0 || ctr->padlen > (int)sizeof(ctr->pad)) { in ctr_encrypt()
48 if (ctr->blocklen % sizeof(LTC_FAST_TYPE)) { in ctr_encrypt()
54 …if ((ctr->padlen == ctr->blocklen) && cipher_descriptor[ctr->cipher].accel_ctr_encrypt != NULL && … in ctr_encrypt()
55 …if ((err = cipher_descriptor[ctr->cipher].accel_ctr_encrypt(pt, ct, len/ctr->blocklen, ctr->ctr, c… in ctr_encrypt()
58 len %= ctr->blocklen; in ctr_encrypt()
63 if (ctr->padlen == ctr->blocklen) { in ctr_encrypt()
65 if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) { in ctr_encrypt()
67 for (x = 0; x < ctr->blocklen; x++) { in ctr_encrypt()
68 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; in ctr_encrypt()
69 if (ctr->ctr[x] != (unsigned char)0) { in ctr_encrypt()
75 for (x = ctr->blocklen-1; x >= 0; x--) { in ctr_encrypt()
76 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; in ctr_encrypt()
77 if (ctr->ctr[x] != (unsigned char)0) { in ctr_encrypt()
84 …if ((err = cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key)) != CRYPT_OK)… in ctr_encrypt()
87 ctr->padlen = 0; in ctr_encrypt()
90 if (ctr->padlen == 0 && len >= (unsigned long)ctr->blocklen) { in ctr_encrypt()
91 for (x = 0; x < ctr->blocklen; x += sizeof(LTC_FAST_TYPE)) { in ctr_encrypt()
93 … *((LTC_FAST_TYPE*)((unsigned char *)ctr->pad + x)); in ctr_encrypt()
95 pt += ctr->blocklen; in ctr_encrypt()
96 ct += ctr->blocklen; in ctr_encrypt()
97 len -= ctr->blocklen; in ctr_encrypt()
98 ctr->padlen = ctr->blocklen; in ctr_encrypt()
102 *ct++ = *pt++ ^ ctr->pad[ctr->padlen++]; in ctr_encrypt()