Sample C routine: Generating a MAC

To illustrate the practical application of CCA verb calls, this topic describes one of the sample C programming language routine included with the CCA Cryptographic Coprocessor Support Program.

There are also sample programs on the product web site. One of the sample programs can help you understand the performance of the CCA implementation.

That sample routine generates a message authentication code (MAC) on a text string and then verifies the MAC. To generate and verify the MAC, the routine:
  1. Calls the Key_Generate (CSNBKGN) verb to create a MAC and MACVER key pair.
  2. Calls the MAC_Generate (CSNBMGN) verb to generate a MAC on a text string with the MAC key.
  3. Calls the MAC_Verify (CSNBMVR) verb to verify the text string MAC with the MACVER key.
For the descriptions of the verbs and their parameters, see the IBM CCA Basic Services Reference and Guide for the IBM® 4767 PCIe Cryptographic Coprocessors manual. These verbs are listed in the following table.
Table 1. Verbs called by the sample routine
Verb Entry-point name
Key_Generate CSNBKGN
MAC_Generate CSNBMGN
MAC_Verify CSNBMVR