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