in src/gcm.c [218:246]
int GCM_add_plain(gcm *g,char *cipher,const char *plain,int len)
{
/* Add plaintext to extract ciphertext, len is length of plaintext. */
int j=0;
unsign32 counter;
uchar B[16];
if (g->status==GCM_ACCEPTING_HEADER) g->status=GCM_ACCEPTING_CIPHER;
if (g->status!=GCM_ACCEPTING_CIPHER) return 0;
while (j<len)
{
counter=pack((uchar *)&(g->a.f[12]));
counter++;
unpack(counter,(uchar *)&(g->a.f[12])); /* increment counter */
for (int i=0; i<16; i++) B[i]=g->a.f[i];
AES_ecb_encrypt(&(g->a),B); /* encrypt it */
for (int i=0; i<16 && j<len; i++,j++)
{
cipher[j]=(char)(plain[j]^B[i]);
g->stateX[i]^=cipher[j];
g->lenC[1]++;
if (g->lenC[1]==0) g->lenC[0]++;
}
gf2mul(g);
}
if (len%16!=0) g->status=GCM_NOT_ACCEPTING_MORE;
return 1;
}