blob: 7217e8a14abb78b51b954ad4ecbc2d69f14fc3ba [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// This file was extracted from the TCG Published
2// Trusted Platform Module Library
3// Part 4: Supporting Routines
4// Family "2.0"
5// Level 00 Revision 01.16
6// October 30, 2014
7
8#ifndef _OSSL_CRYPTO_ENGINE_H
9#define _OSSL_CRYPTO_ENGINE_H
10#include <openssl/aes.h>
11#include <openssl/evp.h>
12#include <openssl/sha.h>
13#include <openssl/ec.h>
14#include <openssl/rand.h>
15#include <openssl/bn.h>
Vadim Bendebury56797522015-05-20 10:32:25 -070016#define CRYPTO_ENGINE
17#include "CryptoEngine.h"
18#include "CpriMisc_fp.h"
19#define MAX_ECC_PARAMETER_BYTES 32
20#define MAX_2B_BYTES MAX((MAX_RSA_KEY_BYTES * ALG_RSA), \
21 MAX((MAX_ECC_PARAMETER_BYTES * ALG_ECC), \
22 MAX_DIGEST_SIZE))
23#define assert2Bsize(a) pAssert((a).size <= sizeof((a).buffer))
24#ifdef TPM_ALG_RSA
25# ifdef RSA_KEY_SIEVE
26# include "RsaKeySieve.h"
27# include "RsaKeySieve_fp.h"
28# endif
29# include "CpriRSA_fp.h"
30#endif
31//
32// This is a structure to hold the parameters for the version of KDFa() used by the CryptoEngine(). This
33// structure allows the state to be passed between multiple functions that use the same pseudo-random
34// sequence.
35//
36typedef struct {
37 CPRI_HASH_STATE iPadCtx;
38 CPRI_HASH_STATE oPadCtx;
39 TPM2B *extra;
40 UINT32 *outer;
41 TPM_ALG_ID hashAlg;
42 UINT16 keySizeInBits;
43} KDFa_CONTEXT;
44#endif // _OSSL_CRYPTO_ENGINE_H