Commit Graph

175 Commits

Author SHA1 Message Date
Matthew Garrett
3cc596e3c6 Add missing optional tags
Some fields have default values, which also means they should be treated
as optional. Fix up the tagging to handle that. The natural defaults
here will work, so no need to make them explicit.
2020-11-17 15:00:41 -08:00
Matthew Garrett
4ad1cc2bf5 Fix type for ComponentClassValue
This is an octet string (ie, an array of bytes) rather than a string.
Fix it to be []byte.
2020-11-12 16:31:41 -08:00
Matthew Garrett
cc244b36f4 Explicitly tag context-specific UTF8Strings
Context-specific fields in ASN.1 don't have explicit type tags in the
ASN.1 stream, so encoding/asn1 infers the tag from the type of the
struct field the stream is being unmarshalled to. By default string is
assumed to be PrintableString, which is only permitted to contain a
subset of possible characters. If a field is defined as UTF8String in
the spec then it may contain characters that are not permitted in
PrintableString, and in this case Unmarshal() will return an error. We
can avoid this by explicitly tagging any context-specific UTF8Strings.
2020-11-12 16:31:41 -08:00
Brandon Weeks
355135fd13
Create codeql-analysis.yml (#180) 2020-10-06 15:20:54 +02:00
Joseph Richey
8bf9473a2e
Merge pull request #179 from twitchy-jsonp/no_cgo
Disable linux TPM12 support if build without cgo
2020-09-24 12:36:46 -07:00
Tom D'Netto
5eca4dfe2a Disable linux TPM12 support if build without cgo 2020-09-24 11:35:08 -07:00
Tom D
142c9d263a
Implement parsing of PCR 13 WBCL information (#178) 2020-09-14 16:44:10 -07:00
Tom D
2453c8f39a
Update go-tpm dependency to 0.3.0 (#176) 2020-07-23 12:15:16 -07:00
Brandon Weeks
9559fc1cd4 Create oid package to centralize TCG relevant OIDs 2020-07-23 12:13:07 -07:00
Tom D
63d2595542
Update dependencies of go-attestation (#175)
* Update to latest version of go-tpm

* Update go-tpm-tools to latest
2020-07-23 11:42:24 -07:00
Tom D
6d760d44a1
windows events: Extract the ELAM driver names and their configuration (#173) 2020-06-18 13:59:51 -07:00
Matthew Garrett
fe22f29ec8 Handle StartupLocality events
Systems with TXT enabled may issue the TPM2_Startup() command from a
locality other than 0. In this case, the initial value of PCR0 will
represent the locality that the call was made from. This is exposed to
higher layers by an EV_NO_ACTION event that has data containing the
NULL-terminated string "StartupLocality" followed by a single byte
representing the state of the locality. As this event is EV_NO_ACTION,
it does not represent an extension in itself.

So:

1) Ignore events that are EV_NO_ACTION when replaying the log, except:
2) For PCR0, if an event is EV_NO_ACTION and contains the string
"StartupLocality", use the final byte of the event data as the initial
value of PCR0 for the replay.
2020-06-11 13:18:05 -07:00
Tom D
5e360d3104
Remove constraint that all reported bitlocker unlocks use the same method. (#170) 2020-06-10 17:10:15 -07:00
Eric Chiang
0fec707a00
Merge pull request #169 from alishuja/master
Fixed typo
2020-06-10 08:01:05 -07:00
Ali Shuja Siddiqui
863b7400b1
Fixed typo 2020-06-10 10:57:09 -04:00
Tom D
3b5f0a5e00
Begin implementing extraction of windows info from the event log (#167) 2020-06-01 17:35:23 -07:00
Matthew Garrett
42b1d805de
Handle platform certificates that only provide a single property (#168)
Handle platform certificates that only provide a single property

The spec states that the PlatformProperties field of the
PlatformConfiguration attribute should be a sequence of key value pairs.
However, it seems that if there's only a single property present, it's
sometimes being stored as a bare key value pair rather than a sequence
with a single entry. Work around that.
2020-05-29 17:24:06 -07:00
Matthew Garrett
fbd936aac7 Parse out platform component and properties data
This provides information about individual components within the system,
which may be useful for various policy decisions.
2020-05-08 14:32:33 -07:00
Matthew Garrett
3538e3d287 Fix broken tag statements
A number of the struct definitions had broken tag definitions, which
meant some parsing was working by accident and some parsing was entirely
broken. Fixing this uncovered some additional issues (a mixture of
incorrect definitions and platform certificates that violate the spec),
so this is all cleaned up as well.
2020-05-08 14:32:33 -07:00
Tom D
596928d20b
Fix oss-fuzz, update to latest go-tpm (#165) 2020-05-07 15:25:53 -07:00
Matthew Garrett
bddeb5217c Add tests to verify attribute certificate signatures
Use an old Intel Transparent Supply Chain certificate to verify the
signatures for the test platform certificates we have that correspond to
it.
2020-05-06 18:54:52 -07:00
Matthew Garrett
61ed2a0d17 Fix attribute certificate signature handling
Attribute certificates are generally using RSA-SHA1 or RSA-SHA256
signatures, so include those. In addition, the CA signing restrictions
imposed for general purpose certificates don't apply here - drop that
restriction from certificate signature validation.
2020-05-06 18:54:52 -07:00
Tom D
ebb0b62d80
Split linuxTPM -> {trousersTPM,wrappedTPM20}, implement CommandChannel
* Split linuxTPM -> {trousersTPM,wrappedTPM20} + prefix windows key type with windows

* Address feedback, implement CommandChannel
2020-05-05 16:56:57 -07:00
Tom D
1045ef6327
Refactor *platformTPM -> tpmBase interface (#160) 2020-05-05 14:56:40 -07:00
Tom D
ab116a02a1
Implement workaround for secureboot authority events from shim (#158) 2020-05-01 14:20:54 -07:00
Tom D
022cf8e2ae
Fix broken build from intersection of two PRs (#155) 2020-04-16 11:42:48 -07:00
Tom D
67c0b4ad07
Add workaround in validation for missing exit boot services event log messages (#153) 2020-04-16 10:20:55 -07:00
Matthew Garrett
0815f5e221
Remove length-based hash lookups
Using the length of a digest to infer the hash algorithm is somewhat
fragile - if we end up with multiple hash algorithms that share the same
digest length, things will break. Instead, pass more complete digest
information through to relevant functions and figure things out by
mapping the TPM hash algorithm to the appropriate Golang type.
2020-04-14 14:38:24 -07:00
Tom D
fe41cef1db
Return error from AttestPlatform() if the event log returned from the system is too short to be valid (#151) 2020-01-30 14:39:59 -08:00
Brandon Weeks
e9e2656545 Return an error if event data size is 0 2020-01-08 13:43:10 -08:00
Tom D
e134551bb0
Implement extractor for determining secure boot state (#148) 2019-12-19 12:28:32 -08:00
Eric Chiang
34338f547c
Merge pull request #147 from ericchiang/formatting
docs: small changes to wording in the event log disclosure
2019-12-12 09:41:08 -08:00
Eric Chiang
9ad68fc43f docs: small changes to wording in the event log disclosure 2019-12-12 09:33:10 -08:00
Eric Chiang
303958184b
Merge pull request #146 from afritzler/patch-1
Fixed typo
2019-12-11 13:58:20 -08:00
Andreas Fritzler
c0a238f2c6
Fixed typo 2019-12-11 22:02:49 +01:00
Eric Chiang
6884946fc9
Merge pull request #144 from mjg59/use_header_digest_size
Pay attention to digest size information in the headers
2019-12-10 12:33:31 -08:00
Matthew Garrett
9176b4bcb6 Pay attention to digest size information in the headers
Crypto agile logs may contain digest types that we don't currently
handle. However, we still need to know how long each digest is in order
to read over the appropriate amount of the buffer. This information is
provided to us as part of the spec header - make use of it rather than
hardcoding the set of digests and lengths we know about.
2019-12-10 12:28:28 -08:00
Eric Chiang
bb3d835294
Merge pull request #145 from ericchiang/event-log-disclosure
docs: add TCG disclosure report
2019-12-10 10:09:15 -08:00
Eric Chiang
fabec56c0e docs: add TCG disclosure report 2019-12-10 10:03:50 -08:00
Tom D
9746da2bfe
Fix uint16 overflow in ParseEKCertificate bounds check (#143) 2019-12-09 10:58:36 -08:00
Tom D
82eea759eb
Enable ParseAKPublic & ParseEKCertificate for fuzzing. (#141) 2019-12-04 15:04:06 -08:00
Tom D
814084b657
Validate signature scheme is present when decoding TPMT_PUBLIC blobs (#140) 2019-12-04 14:35:21 -08:00
Tom D
fb4487ace5
Implement self-test mode into attest-tool. (#137) 2019-11-08 09:52:59 -08:00
Eric Chiang
ecf3f3087d
Merge pull request #136 from ericchiang/readme
README.md: add more information and an example to the readme
2019-11-08 07:49:38 +01:00
Eric Chiang
6ba2320709
Merge pull request #134 from ericchiang/mod-tidy
go.sum: run go mod tidy
2019-11-07 09:33:07 +01:00
Eric Chiang
3b090f6cc8 README.md: add more information and an example to the readme 2019-11-07 09:31:40 +01:00
Eric Chiang
bd37cfce50
Merge pull request #135 from ericchiang/lint-names
attributecert: update names that golint complains about
2019-11-07 09:16:41 +01:00
Eric Chiang
6cfb57c8eb attributecert: update names that golint complains about
golint current generates complaints:

        var oidTpmIdLabel should be oidTpmIDLabel
        var oidTcgPlatformManufacturerIdV2 should be oidTcgPlatformManufacturerIDV2
        var oidTcgPlatformConfigUri should be oidTcgPlatformConfigURI

Update names to satisfy golint.

The following commands were run to generate this change:

        gopls rename -w attributecert.go:44:2 oidTpmIDLabel
        gopls rename -w attributecert.go:54:2 oidTcgPlatformManufacturerIDV2
        gopls rename -w attributecert.go:55:2 oidTcgPlatformConfigURI
        gopls rename -w attributecert.go:163:6 authKeyID
        gopls rename -w attributecert.go:164:2 ID
        gopls rename -w attributecert.go:171:2 ID
        gopls rename -w attributecert.go:178:2 ID
        gopls rename -w attributecert.go:210:2 BaseCertificateID
        gopls rename -w attributecert.go:232:2 ID
        gopls rename -w attributecert.go:304:2 ID
        gopls rename -w attributecert.go:309:2 ID
        gopls rename -w attributecert.go:390:2 ComponentManufacturerID
        sed -i 's/Uri/URI/g' attributecert.go
        git clean -f

Updates #131
2019-11-06 11:09:02 +01:00
Eric Chiang
2737628247 go.sum: run go mod tidy 2019-11-06 09:15:19 +01:00
Matthew Garrett
f5fa92f739
First attempt at adding support for attribute certificates (#117)
Platform certificates are defined as RFC5755 attribute certificates with
various additional attributes and extensions defined in the TCG Platform
Certificate Profile. Add support for parsing them, derived from
crypto/x509. Include some test certificates and verify we parse them.
2019-10-27 23:12:15 -07:00