Deepikarajani24 patch 1 (#193)

* tbs.dll to not initialize on start up
so that it's not initialized when tpm support is not required

Changed author to my google.com user

* initialize tbs.dll and proc Tbsi_GetDeviceInfo during probeSystemTPMs

initialization is done in probeSystemTPMs as it's called before openTPM which requires support of the dll
changed author to my google.com user

* tbs.dll to load once

Changed the author to my google.com email

* Tbsi_GetDeviceInfo check to happen once
changed the author of the commit
This commit is contained in:
Deepika Rajani 2020-12-02 14:09:22 -05:00 committed by GitHub
parent 9632df6f12
commit 2f809d0330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -58,8 +58,8 @@ var (
crypt32CertEnumCertificatesInStore = crypt32.MustFindProc("CertEnumCertificatesInStore")
crypt32CertCloseStore = crypt32.MustFindProc("CertCloseStore")
tbs = windows.MustLoadDLL("Tbs.dll")
tbsGetDeviceInfo = tbs.MustFindProc("Tbsi_GetDeviceInfo")
tbs *windows.DLL
tbsGetDeviceInfo *windows.Proc
)
// Error codes.

View File

@ -42,6 +42,12 @@ type windowsTPM struct {
func (*windowsTPM) isTPMBase() {}
func probeSystemTPMs() ([]probedTPM, error) {
// Initialize Tbs.dll here so that it's linked only when TPM support is required.
if tbs == nil {
tbs = windows.MustLoadDLL("Tbs.dll")
tbsGetDeviceInfo = tbs.MustFindProc("Tbsi_GetDeviceInfo")
}
// Windows systems appear to only support a single abstracted TPM.
// If we fail to initialize the Platform Crypto Provider, we assume
// a TPM is not present.