comparison src/modes/ctr/ctr_encrypt.c @ 209:39d5d58461d6 libtomcrypt-orig LTC_1.05

Import of libtomcrypt 1.05
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 03:53:40 +0000
parents 1c15b283127b
children
comparison
equal deleted inserted replaced
191:1c15b283127b 209:39d5d58461d6
58 58
59 while (len) { 59 while (len) {
60 /* is the pad empty? */ 60 /* is the pad empty? */
61 if (ctr->padlen == ctr->blocklen) { 61 if (ctr->padlen == ctr->blocklen) {
62 /* increment counter */ 62 /* increment counter */
63 if (ctr->mode == 0) { 63 if (ctr->mode == CTR_COUNTER_LITTLE_ENDIAN) {
64 /* little-endian */ 64 /* little-endian */
65 for (x = 0; x < ctr->blocklen; x++) { 65 for (x = 0; x < ctr->blocklen; x++) {
66 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255; 66 ctr->ctr[x] = (ctr->ctr[x] + (unsigned char)1) & (unsigned char)255;
67 if (ctr->ctr[x] != (unsigned char)0) { 67 if (ctr->ctr[x] != (unsigned char)0) {
68 break; 68 break;
100 } 100 }
101 return CRYPT_OK; 101 return CRYPT_OK;
102 } 102 }
103 103
104 #endif 104 #endif
105
106 /* $Source: /cvs/libtom/libtomcrypt/src/modes/ctr/ctr_encrypt.c,v $ */
107 /* $Revision: 1.13 $ */
108 /* $Date: 2005/05/05 14:35:59 $ */