Lines Matching refs:ctr
15 CTR implementation, start chain, Tom St Denis
22 Initialize a CTR context
29 @param ctr The CTR state to initialize
36 symmetric_CTR *ctr)
42 LTC_ARGCHK(ctr != NULL);
50 if ((err = cipher_descriptor[cipher].setup(key, keylen, num_rounds, &ctr->key)) != CRYPT_OK) {
54 /* copy ctr */
55 ctr->blocklen = cipher_descriptor[cipher].block_length;
56 ctr->cipher = cipher;
57 ctr->padlen = 0;
58 ctr->mode = ctr_mode & 1;
59 for (x = 0; x < ctr->blocklen; x++) {
60 ctr->ctr[x] = IV[x];
65 if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) {
67 for (x = 0; x < ctr->blocklen; x++) {
68 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255;
69 if (ctr->ctr[x] != (unsigned char)0) {
75 for (x = ctr->blocklen-1; x >= 0; x--) {
76 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255;
77 if (ctr->ctr[x] != (unsigned char)0) {
84 return cipher_descriptor[ctr->cipher].ecb_encrypt(ctr->ctr, ctr->pad, &ctr->key);
89 /* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_start.c,v $ */