]> git.saurik.com Git - apple/xnu.git/blob - osfmk/corecrypto/cchmac/src/cchmac_final.c
6ac62eedf9de3b520c56774a5a4876daea70ab05
[apple/xnu.git] / osfmk / corecrypto / cchmac / src / cchmac_final.c
1 /*
2 * cchmac_final.c
3 * corecrypto
4 *
5 * Created by Michael Brouwer on 12/7/10.
6 * Copyright 2010,2011 Apple Inc. All rights reserved.
7 *
8 */
9
10 #include <corecrypto/cchmac.h>
11 #include <corecrypto/ccn.h>
12
13 void cchmac_final(const struct ccdigest_info *di, cchmac_ctx_t hc,
14 unsigned char *mac) {
15 ccdigest_final(di, cchmac_digest_ctx(di, hc), cchmac_data(di, hc));
16 /* typecast: output size will alwys fit in an unsigned int */
17 cchmac_num(di, hc) = (unsigned int)di->output_size;
18 cchmac_nbits(di, hc) = di->block_size * 8;
19 ccdigest_copy_state(di, cchmac_istate32(di, hc), cchmac_ostate32(di, hc));
20 ccdigest_final(di, cchmac_digest_ctx(di, hc), mac);
21 }