static int GCM_ghash()

in src/gcm.c [135:153]


static int GCM_ghash(gcm *g,const char *plain,int len)
{
    int j=0;
    if (g->status==GCM_ACCEPTING_HEADER) g->status=GCM_ACCEPTING_CIPHER;
    if (g->status!=GCM_ACCEPTING_CIPHER) return 0;

    while (j<len)
    {
        for (int i=0; i<16 && j<len; i++,j++)
        {
            g->stateX[i]^=plain[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;
}