On Thu, Jun 14, 2012, Cassie Helms wrote:

> 
> HMAC has a nice wrapper function -- unsigned char *HMAC(lots of args) -- that 
> looks like it calls:
> 
> HMAC_CTX_init
> checks HMAC_Update for error
> checks HMAC_Final for error
> HMAC_CTX_cleanup
> 
> CMAC doesn't have a similar wrapper function at this time.  I am guessing 
> that 
> the correct order of CMAC functions (without delving deep into how the 
> algorithm 
> works) would be to call comparable CMAC functions, like so --
> 
> CMAC_Init
> check CMAC_Update for error
> check CMAC_Final for error
> CMAC_CTX_cleanup
> 
> Does this look correct? I apologize for the tedious question, but as there is 
> no 
> documentation or nice wrapper, I would have to investigate the code more to 
> be 
> sure...
> 

The main difference is that the CMAC_CTX structure is opaque so you need to
call CMS_CTX_new() to allocate it and CMAC_CTX_free() to free it up.

Check out the fuinction print_cmac_gen in the file fips/cmac/fips_cmactest.c
for an example.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to