CCHMAC(3) | Library Functions Manual | CCHMAC(3) |
CCHmacInit
,
CCHmacUpdate
, CCHmacFinal
,
CCHmac
— Common HMAC
Algorithm Interfaces
These functions are found in libSystem.
#include
<CommonCrypto/CommonHMAC.h>
void
CCHmacInit
(CCHmacContext
*ctx, CCHmacAlgorithm
algorithm, const void
*key, size_t
keyLength);
void
CCHmacUpdate
(CCHmacContext
*ctx, const void
*data, size_t
dataLength);
void
CCHmacFinal
(CCHmacContext
*ctx, void
*macOut);
void
CCHmac
(CCHmacAlgorithm
algorithm, const void
*key, size_t
keyLength, const void
*data, size_t
dataLength, void
*macOut);
This interface provides access to a number of HMAC algorithms. The following algorithms are available:
The MAC must be verified by comparing the
computed and expected values using
timingsafe_bcmp
()
Other comparison functions (e.g.
memcmp
()
) must not be used as they may be vulnerable to practical timing attacks,
leading to MAC forgery.
The object declared in this interface,
CCHmacContext, provides a handle for use with the
CCHmacInit
()
CCHmacUpdate
()
and
CCHmacFinal
()
calls to complete the HMAC operation. In addition there is a one shot
function,
CCHmac
()
that performs a complete HMAC on a single piece of data.
These functions are available in OS X 10.5 and later.
March 22, 2007 | Mac OS X 12 |