Home | History | Annotate | Download | only in gcm

Lines Matching full:gcm

14    GCM implementation, process message data, by Tom St Denis
21 Process plaintext/ciphertext through GCM
22 @param gcm The GCM state
29 int gcm_process(gcm_state *gcm,
38 LTC_ARGCHK(gcm != NULL);
44 if (gcm->buflen > 16 || gcm->buflen < 0) {
48 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) {
53 if (gcm->mode == GCM_MODE_AAD) {
55 if (gcm->buflen) {
56 gcm->totlen += gcm->buflen * CONST64(8);
57 gcm_mult_h(gcm, gcm->X);
62 if (++gcm->Y[y] & 255) { break; }
65 if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) {
69 gcm->buflen = 0;
70 gcm->mode = GCM_MODE_TEXT;
73 if (gcm->mode != GCM_MODE_TEXT) {
79 if (gcm->buflen == 0) {
84 *((LTC_FAST_TYPE*)(&ct[x + y])) = *((LTC_FAST_TYPE*)(&pt[x+y])) ^ *((LTC_FAST_TYPE*)(&gcm->buf[y]));
85 *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&ct[x+y]));
88 gcm->pttotlen += 128;
89 gcm_mult_h(gcm, gcm->X);
92 if (++gcm->Y[y] & 255) { break; }
94 if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) {
102 *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&ct[x+y]));
103 *((LTC_FAST_TYPE*)(&pt[x + y])) = *((LTC_FAST_TYPE*)(&ct[x+y])) ^ *((LTC_FAST_TYPE*)(&gcm->buf[y]));
106 gcm->pttotlen += 128;
107 gcm_mult_h(gcm, gcm->X);
110 if (++gcm->Y[y] & 255) { break; }
112 if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) {
122 if (gcm->buflen == 16) {
123 gcm->pttotlen += 128;
124 gcm_mult_h(gcm, gcm->X);
128 if (++gcm->Y[y] & 255) { break; }
130 if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) {
133 gcm->buflen = 0;
137 b = ct[x] = pt[x] ^ gcm->buf[gcm->buflen];
140 pt[x] = ct[x] ^ gcm->buf[gcm->buflen];
142 gcm->X[gcm->buflen++] ^= b;
150 /* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_process.c,v $ */