-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtpm20.h
More file actions
63 lines (58 loc) · 1.88 KB
/
tpm20.h
File metadata and controls
63 lines (58 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef TPM20_H
#define TPM20_H
#include "types.h"
#include <tss2/tss2_sys.h>
#include <tss2/tss2_mu.h>
typedef struct TPM20 {
void* libTcti;
void* libTss2;
int legacy;
TSS2_TCTI_CONTEXT* tcti;
TSS2_SYS_CONTEXT* context;
} TPM20;
typedef struct CertifiedKey20 {
struct {
int size;
unsigned char* buffer;
} publicKey;
struct {
int size;
unsigned char* buffer;
} privateBlob;
struct {
int size;
unsigned char* buffer;
} keySignature;
struct {
int size;
unsigned char* buffer;
} keyAttestation;
struct {
int size;
unsigned char* buffer;
} keyName;
} CertifiedKey20;
typedef enum TCTI {
SOCKET_LEGACY,
ABRMD_LEGACY,
SOCKET,
ABRMD,
} TCTI;
int TpmOpen20(TPM20 *tpm, TCTI tctiType);
void TpmClose20(TPM20 *tpm);
int TpmCreateCertifiedKey20(TPM20* tpm, CertifiedKey20* keyOut, Usage usage, unsigned int keyAuthSize, unsigned char keyAuth[], unsigned int parentAuthSize, const unsigned char parentAuth[]);
int TpmUnbind20(TPM20* tpm, unsigned int* unboundLenOut, unsigned char** unboundDataOut,
unsigned int keyAuthLen, const unsigned char* keyAuth,
unsigned int privateKeyLen , const unsigned char* inPrivateKey,
unsigned int publicKeyLen, const unsigned char* inPublicKey,
unsigned int dataLen, const unsigned char* data);
int TpmSign20(TPM20* tpm, unsigned int* signatureSizeOut, unsigned char** signatureOut,
const unsigned int keyAuthLen, const unsigned char* keyAuth,
const unsigned int privateKeyLen, const unsigned char* privateKey,
const unsigned int publicKeyLen, const unsigned char* publicKey,
const unsigned int hashSize, const unsigned char* hash, int algId);
#endif