CpriHash_fp.h revision 0a05071eda743000b3936bae53374bbe07893848
1/*
2 * Copyright 2015 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#ifndef __TPM2_CPRIHASH_FP_H
8#define __TPM2_CPRIHASH_FP_H
9
10LIB_EXPORT UINT16 _cpri__CompleteHash(
11        CPRI_HASH_STATE         *hashState,             // IN: the state of hash stack
12        UINT32                   dOutSize,              // IN: size of digest buffer
13        BYTE                    *dOut                   // OUT: hash digest
14);
15LIB_EXPORT BOOL _cpri__HashStartup(void);
16LIB_EXPORT UINT16 _cpri__GetDigestSize(
17        TPM_ALG_ID           hashAlg               // IN: hash algorithm to look up
18);
19LIB_EXPORT UINT16 _cpri__KDFa(
20        TPM_ALG_ID          hashAlg,             //   IN: hash algorithm used in HMAC
21        TPM2B              *key,                 //   IN: HMAC key
22        const char         *label,               //   IN: a 0-byte terminated label used in KDF
23        TPM2B              *contextU,            //   IN: context U
24        TPM2B              *contextV,            //   IN: context V
25        UINT32              sizeInBits,          //   IN: size of generated key in bit
26        BYTE               *keyStream,           //   OUT: key buffer
27        UINT32             *counterInOut,        //   IN/OUT: caller may provide the iteration
28                                             //       counter for incremental operations to
29                                             //       avoid large intermediate buffers.
30        BOOL                once                 //   IN: TRUE if only one iteration is performed
31                                             //       FALSE if iteration count determined by
32                                             //       "sizeInBits"
33);
34LIB_EXPORT UINT16 _cpri__StartHash(
35        TPM_ALG_ID               hashAlg,              // IN: hash algorithm
36        BOOL                     sequence,             // IN: TRUE if the state should be saved
37        CPRI_HASH_STATE         *hashState             // OUT: the state of hash stack.
38);
39LIB_EXPORT void _cpri__UpdateHash(
40        CPRI_HASH_STATE           *hashState,      // IN: the hash context information
41        UINT32                     dataSize,       // IN: the size of data to be added to the
42                                              //     digest
43        BYTE                      *data            // IN: data to be hashed
44);
45
46#endif // __TPM2_CPRIHASH_FP_H
47