AES GCM/GMAC

Chris Rogers <[email protected]>
Newsgroups gmane.os.dragonfly-bsd.kernel
Message-ID <CAC4YoripkJ2SN1bC5=i0JorTjaZqu2dmu89hAMNx14Fs8eR-5Q@mail.gmail.com>
All,

In your AES GCM implementation, you have the following lines of code in
cryptosoft.c, in fucntion swcr_combined():

*******
  for (crd = crp->crp_desc; crd; crd = crd->crd_next) {
for (sw = swcr_sessions[crp->crp_sid & 0xffffffff];
     sw && sw->sw_alg != crd->crd_alg;
     sw = sw->sw_next)
;
if (sw == NULL)
return (EINVAL);

switch (sw->sw_alg) {
case CRYPTO_AES_GCM_16:
case CRYPTO_AES_GMAC:
swe = sw;
crde = crd;
exf = swe->sw_exf;
ivlen = exf->blocksize;
break;
case CRYPTO_AES_128_GMAC:
case CRYPTO_AES_192_GMAC:
case CRYPTO_AES_256_GMAC:
swa = sw;
crda = crd;
axf = swa->sw_axf;
if (swa->sw_ictx == 0)
return (EINVAL);
bcopy(swa->sw_ictx, &ctx, axf->ctxsize);
blksz = axf->blocksize;
break;
default:
return (EINVAL);
}
}


if (crde == NULL || crda == NULL)
return (EINVAL);

*******

My understanding of GCM and GMAC was that GMAC was an authentication only
variant of GCM, and thus they were mutually exclusive.  But, it looks like
the rest of the function will never execute if GMAC isn't chosen as the
mode of encryption.  Does this mean that GCM uses GMAC as part of its
standard encryption process, or is the encryption for GCM only implemented
somewhere else?  Any help on this matter would be greatly appreciated.

Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.