Skip to content

Commit caf928d

Browse files
committed
fix check
1 parent db19908 commit caf928d

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

example/README.md

-29
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,6 @@ First install latest `tpm2_tools`
3434
## install latest tpm2-tools:
3535
#### https://github.com/salrashid123/tpm2/tree/master?tab=readme-ov-file#installing-tpm2_tools-golang
3636
#### https://tpm2-tools.readthedocs.io/en/latest/INSTALL/
37-
38-
apt-get update
39-
40-
apt -y install autoconf-archive libcmocka0 libcmocka-dev procps \
41-
iproute2 build-essential git pkg-config gcc libtool automake \
42-
libssl-dev uthash-dev autoconf doxygen libcurl4-openssl-dev dbus-x11 libglib2.0-dev libjson-c-dev acl
43-
44-
cd
45-
git clone https://github.com/tpm2-software/tpm2-tss.git
46-
cd tpm2-tss
47-
./bootstrap
48-
./configure --with-udevrulesdir=/etc/udev/rules.d
49-
make -j$(nproc)
50-
make install
51-
udevadm control --reload-rules && sudo udevadm trigger
52-
ldconfig
53-
54-
cd
55-
git clone https://github.com/tpm2-software/tpm2-tools.git
56-
cd tpm2-tools
57-
./bootstrap
58-
./configure
59-
make check
60-
make install
61-
62-
## install golang
63-
wget https://go.dev/dl/go1.22.3.linux-amd64.tar.gz
64-
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.3.linux-amd64.tar.gz
65-
export PATH=$PATH:/usr/local/go/bin
6637
```
6738

6839
```bash

tpm/tpm.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func NewTPMCrypto(conf *TPM) (TPM, error) {
8989
// if an actual device is specified, its externally managed
9090
// so the auth handle shoud've been initialzied before this
9191
if conf.TpmDevice != nil {
92-
if conf.AuthHandle == nil || conf.TpmDevice == nil {
92+
if conf.AuthHandle == nil {
9393
return TPM{}, fmt.Errorf("salrashid123/x/oauth2/google: AuthHandle and TpmDevice must be specified")
9494
}
9595
rwr = transport.FromReadWriter(conf.TpmDevice)
@@ -98,7 +98,7 @@ func NewTPMCrypto(conf *TPM) (TPM, error) {
9898
// otherwise, its a library managed call
9999
// here we'll open up the tpm and read in the
100100
// persistent handle
101-
// after enabling for if any password or pcr policies
101+
// after enabling for if any password or pcr policies, we'll read the public key..then
102102
// wer'e going to close the tpm after this function call
103103
rwc, err := OpenTPM(conf.TpmPath)
104104
if err != nil {
@@ -165,6 +165,7 @@ func NewTPMCrypto(conf *TPM) (TPM, error) {
165165

166166
}
167167

168+
// todo: we should supply the encrypted session here, if set
168169
pub, err := tpm2.ReadPublic{
169170
ObjectHandle: ah.Handle,
170171
}.Execute(rwr)

0 commit comments

Comments
 (0)