Simply changing the operation command from GCM to CMAC in the GCM
shared descriptor (that's what I've noticed when disassembling the
hex dump they provided) won't work.
Below are some proof of concept examples:
GCM:
<jobdesc id="gcm_aes256_tc2d">
<key class="1" s="#gcm_aes256_tc2d_key" dest="key" />
<operation enc=0 type="class1" as="initfinal" aai="gcm" alg="aes" icv=1 />
<fifostore type=msg d="#gcm_aes256_tc2d_out" />
<fifoload type=iv,flush1 class=1 s="#gcm_aes256_tc2d_iv" />
<fifoload type=aad,flush1 class=1 s=[] />
<fifoload type=msg,flush1 class=1 s="#gcm_aes256_tc2d_msg" />
<fifoload type=icv,last1 class=1 s="#gcm_aes256_tc2d_icv" />
<store s="ctx1" d="#gcm_aes256_tc2d_icv" />
</jobdesc>
CMAC:
<jobdesc id="cmac_aes128_tc3">
<key class="1" s="#cmac_aes128_tc3_key" dest="key" />
<operation enc=1 type="class1" as="initfinal" aai="cmac" alg="aes" />
<fifoload type=msg,last1 class=1 s="#cmac_aes128_tc3_msg" />
<store s="ctx1" d="#cmac_aes128_tc3_hash" />
</jobdesc>
Note, CMAC only uses MESSAGE data, whereas GCM uses IV, AAD, and
Message data. That is why simple change of the descriptor does not work.
Have a great day,
Platon
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------