by CiPHPerCoder · 9y ago · 0 comments
GCM = CTR + GMAC
If you're, elsewhere, using GMAC for some reason and getting a different result when you combine it with CTR mode: Well, that's weird. I'd have to have two implementations to compare to analyze further. But otherwise, this conversation is moot.
So if you use GMAC, you'll have len(A) >= 0, and len(C) == 0.
If you use GCM with encrypted data, you'll end up with len(C) > 0, which will give you different results from GMAC.
GMAC is a special case of GCM, and GCM is not simply GMAC + CTR. This is supported by the NIST publication which defines them:
> If the GCM input is restricted to data that is not to be encrypted, the resulting specialization of GCM, called GMAC, is simply an authentication mode on the input data.
Again, GCM != CTR + GMAC, if you make this assumption you will fail to interoperate with correct implementations of GCM.