Lines Matching refs:gcm
29 int gcm_process(gcm_state *gcm, in gcm_process() argument
38 LTC_ARGCHK(gcm != NULL); in gcm_process()
44 if (gcm->buflen > 16 || gcm->buflen < 0) { in gcm_process()
48 if ((err = cipher_is_valid(gcm->cipher)) != CRYPT_OK) { in gcm_process()
53 if (gcm->mode == GCM_MODE_AAD) { in gcm_process()
55 if (gcm->buflen) { in gcm_process()
56 gcm->totlen += gcm->buflen * CONST64(8); in gcm_process()
57 gcm_mult_h(gcm, gcm->X); in gcm_process()
62 if (++gcm->Y[y] & 255) { break; } in gcm_process()
65 … if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) { in gcm_process()
69 gcm->buflen = 0; in gcm_process()
70 gcm->mode = GCM_MODE_TEXT; in gcm_process()
73 if (gcm->mode != GCM_MODE_TEXT) { in gcm_process()
79 if (gcm->buflen == 0) { in gcm_process()
84 …((LTC_FAST_TYPE*)(&ct[x + y])) = *((LTC_FAST_TYPE*)(&pt[x+y])) ^ *((LTC_FAST_TYPE*)(&gcm->buf[y])); in gcm_process()
85 *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&ct[x+y])); in gcm_process()
88 gcm->pttotlen += 128; in gcm_process()
89 gcm_mult_h(gcm, gcm->X); in gcm_process()
92 if (++gcm->Y[y] & 255) { break; } in gcm_process()
94 … if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) { in gcm_process()
102 *((LTC_FAST_TYPE*)(&gcm->X[y])) ^= *((LTC_FAST_TYPE*)(&ct[x+y])); in gcm_process()
103 …((LTC_FAST_TYPE*)(&pt[x + y])) = *((LTC_FAST_TYPE*)(&ct[x+y])) ^ *((LTC_FAST_TYPE*)(&gcm->buf[y])); in gcm_process()
106 gcm->pttotlen += 128; in gcm_process()
107 gcm_mult_h(gcm, gcm->X); in gcm_process()
110 if (++gcm->Y[y] & 255) { break; } in gcm_process()
112 … if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) { in gcm_process()
122 if (gcm->buflen == 16) { in gcm_process()
123 gcm->pttotlen += 128; in gcm_process()
124 gcm_mult_h(gcm, gcm->X); in gcm_process()
128 if (++gcm->Y[y] & 255) { break; } in gcm_process()
130 … if ((err = cipher_descriptor[gcm->cipher].ecb_encrypt(gcm->Y, gcm->buf, &gcm->K)) != CRYPT_OK) { in gcm_process()
133 gcm->buflen = 0; in gcm_process()
137 b = ct[x] = pt[x] ^ gcm->buf[gcm->buflen]; in gcm_process()
140 pt[x] = ct[x] ^ gcm->buf[gcm->buflen]; in gcm_process()
142 gcm->X[gcm->buflen++] ^= b; in gcm_process()