10#include "tss2_tpm2_types.h"
11#include "tss2-sys/sysapi_util.h"
13#include "esys_crypto_ossl.h"
15#include "esys_crypto_mbed.h"
17#define _iesys_crypto_aes_decrypt NULL;
18#define _iesys_crypto_aes_encrypt NULL;
19#define _iesys_crypto_sm4_decrypt NULL;
20#define _iesys_crypto_sm4_encrypt NULL;
21#define _iesys_crypto_get_ecdh_point NULL;
22#define _iesys_crypto_hash_abort NULL;
23#define _iesys_crypto_hash_finish NULL;
24#define _iesys_crypto_hash_start NULL;
25#define _iesys_crypto_hash_update NULL;
26#define _iesys_crypto_hmac_abort NULL;
27#define _iesys_crypto_hmac_finish NULL;
28#define _iesys_crypto_hmac_start NULL;
29#define _iesys_crypto_hmac_update NULL;
30#define _iesys_crypto_init NULL;
31#define _iesys_crypto_get_random2b NULL;
32#define _iesys_crypto_rsa_pk_encrypt NULL;
39#define AES_BLOCK_SIZE_IN_BYTES 16
40#define SM4_BLOCK_SIZE_IN_BYTES 16
42TSS2_RC iesys_crypto_hash_get_digest_size(TPM2_ALG_ID hashAlg,
size_t *size);
44TSS2_RC iesys_crypto_pHash(
47 const uint8_t rcBuffer[4],
48 const uint8_t ccBuffer[4],
49 const TPM2B_NAME *name1,
50 const TPM2B_NAME *name2,
51 const TPM2B_NAME *name3,
52 const uint8_t *pBuffer,
57#define iesys_crypto_cpHash(ectx, alg, ccBuffer, name1, name2, name3, \
58 cpBuffer, cpBuffer_size, cpHash, cpHash_size) \
59 iesys_crypto_pHash(ectx, alg, NULL, ccBuffer, name1, name2, name3, cpBuffer, \
60 cpBuffer_size, cpHash, cpHash_size)
61#define iesys_crypto_rpHash(ectx, alg, rcBuffer, ccBuffer, rpBuffer, rpBuffer_size, \
62 rpHash, rpHash_size) \
63 iesys_crypto_pHash(ectx, alg, rcBuffer, ccBuffer, NULL, NULL, NULL, rpBuffer, \
64 rpBuffer_size, rpHash, rpHash_size)
66TSS2_RC iesys_crypto_hmac_finish2b(
71TSS2_RC iesys_crypto_hmac_update2b(
76TSS2_RC iesys_crypto_hash_update2b(
81TSS2_RC iesys_crypto_rsa_pk_encrypt(
83 TPM2B_PUBLIC * pub_tpm_key,
91TSS2_RC iesys_crypto_hash_start(
96TSS2_RC iesys_crypto_hash_update(
99 const uint8_t *buffer,
102TSS2_RC iesys_crypto_hash_finish(
108TSS2_RC iesys_crypto_hash_abort(
112TSS2_RC iesys_crypto_hmac_start(
119TSS2_RC iesys_crypto_hmac_update(
122 const uint8_t *buffer,
125TSS2_RC iesys_crypto_hmac_finish(
131TSS2_RC iesys_crypto_hmac_abort(
135TSS2_RC iesys_crypto_get_random2b(
140TSS2_RC iesys_crypto_get_ecdh_point(
144 TPM2B_ECC_PARAMETER *Z,
149 TSS2_RC iesys_crypto_aes_encrypt(
152 TPM2_ALG_ID tpm_sym_alg,
153 TPMI_AES_KEY_BITS key_bits,
154 TPM2_ALG_ID tpm_mode,
159TSS2_RC iesys_crypto_aes_decrypt(
162 TPM2_ALG_ID tpm_sym_alg,
163 TPMI_AES_KEY_BITS key_bits,
164 TPM2_ALG_ID tpm_mode,
169TSS2_RC iesys_crypto_sm4_encrypt(
172 TPM2_ALG_ID tpm_sym_alg,
173 TPMI_SM4_KEY_BITS key_bits,
174 TPM2_ALG_ID tpm_mode,
179TSS2_RC iesys_crypto_sm4_decrypt(
182 TPM2_ALG_ID tpm_sym_alg,
183 TPMI_SM4_KEY_BITS key_bits,
184 TPM2_ALG_ID tpm_mode,
189TSS2_RC iesys_crypto_authHmac(
194 const uint8_t *pHash,
196 const TPM2B_NONCE *nonceNewer,
197 const TPM2B_NONCE *nonceOlder,
198 const TPM2B_NONCE *nonceDecrypt,
199 const TPM2B_NONCE *nonceEncrypt,
200 TPMA_SESSION sessionAttributes,
203TSS2_RC iesys_crypto_KDFaHmac(
210 TPM2B_NONCE *contextU,
211 TPM2B_NONCE *contextV,
216TSS2_RC iesys_crypto_KDFa(
222 TPM2B_NONCE *contextU,
223 TPM2B_NONCE *contextV,
225 uint32_t *counterInOut,
227 BOOL use_digest_size);
229TSS2_RC iesys_xor_parameter_obfuscation(
231 TPM2_ALG_ID hash_alg,
234 TPM2B_NONCE * contextU,
235 TPM2B_NONCE * contextV,
239TSS2_RC iesys_crypto_KDFe(
242 TPM2B_ECC_PARAMETER *Z,
244 TPM2B_ECC_PARAMETER *partyUInfo,
245 TPM2B_ECC_PARAMETER *partyVInfo,
249TSS2_RC iesys_initialize_crypto_backend(
Definition tss2_esys.h:408
Definition esys_crypto_mbed.c:34