Skip to content

Commit 767bbd6

Browse files
committed
Add Open DICE cert chains and TCB Info
- Add validation and claim extraction for Open DICE X.509 and CBOR certificate chains. - Add TCB into claim extension definition. Signed-off-by: Sergei Trofimov <[email protected]>
1 parent d86c5e6 commit 767bbd6

29 files changed

+1144
-33
lines changed

.github/workflows/ci-go-cover.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,23 @@
1414
# 1. Change workflow name from "cover 100%" to "cover ≥92.5%". Script will automatically use 92.5%.
1515
# 2. Update README.md to use the new path to badge.svg because the path includes the workflow name.
1616

17-
name: cover ≥75%
18-
on: [push]
17+
name: cover ≥80.0%
18+
on: [push, pull_request]
1919
jobs:
20-
21-
# Verify minimum coverage is reached using `go test -short -cover` on latest-ubuntu with default version of Go.
22-
# The grep expression can't be too strict, it needed to be relaxed to work with different versions of Go.
2320
cover:
2421
name: Coverage
2522
runs-on: ubuntu-latest
23+
env:
24+
GO111MODULE: on
2625
steps:
26+
- uses: actions/setup-go@v3
27+
with:
28+
go-version: "1.18"
2729
- name: Checkout code
2830
uses: actions/checkout@v2
2931
- name: Go Coverage
3032
run: |
3133
go version
32-
go test -short -cover | grep "^.*coverage:.*of statements$" | python -c "import os,re,sys; cover_rpt = sys.stdin.read(); print(cover_rpt) if len(cover_rpt) != 0 and len(cover_rpt.splitlines()) == 1 else sys.exit(1); min_cover = float(re.findall(r'\d*\.\d+|\d+', os.environ['GITHUB_WORKFLOW'])[0]); cover = float(re.findall(r'\d*\.\d+|\d+', cover_rpt)[0]); sys.exit(1) if (cover > 100) or (cover < min_cover) else sys.exit(0)"
34+
make test-cover | grep -o "coverage:.*of statements$" | python scripts/cov.py
35+
3336
shell: bash

.github/workflows/linters.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
# Go Linters - GitHub Actions
22
name: linters
3-
on: [push]
3+
on: [push, pull_request]
44
jobs:
5-
6-
# Check linters on latest-ubuntu with default version of Go.
75
lint:
86
name: Lint
97
runs-on: ubuntu-latest
8+
env:
9+
GO111MODULE: on
1010
steps:
11+
- uses: actions/setup-go@v3
12+
with:
13+
go-version: "1.18"
1114
- name: Checkout code
1215
uses: actions/checkout@v2
13-
- name: Install golangci-lint
16+
- name: Install golangci-lint
1417
run: |
1518
go version
16-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8
19+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2
1720
- name: Run required linters in .golangci.yml plus hard-coded ones here
18-
run: $(go env GOPATH)/bin/golangci-lint run --timeout=3m
19-
- name: Run optional linters (not required to pass)
20-
run: $(go env GOPATH)/bin/golangci-lint run --timeout=3m --issues-exit-code=0 -E dupl -E gocritic -E gosimple -E lll -E prealloc
21+
run: make -w GOLINT=$(go env GOPATH)/bin/golangci-lint lint

.golangci.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Do not delete linter settings. Linters like gocritic can be enabled on the command line.
2+
3+
linters-settings:
4+
dupl:
5+
threshold: 100
6+
funlen:
7+
lines: 100
8+
statements: 50
9+
goconst:
10+
min-len: 2
11+
min-occurrences: 3
12+
gocritic:
13+
enabled-tags:
14+
- diagnostic
15+
- experimental
16+
- opinionated
17+
- style
18+
disabled-checks:
19+
- dupImport # https://github.com/go-critic/go-critic/issues/845
20+
- ifElseChain
21+
- octalLiteral
22+
- paramTypeCombine
23+
- whyNoLint
24+
- wrapperFunc
25+
gofmt:
26+
simplify: false
27+
goimports:
28+
golint:
29+
min-confidence: 0
30+
govet:
31+
check-shadowing: true
32+
lll:
33+
line-length: 140
34+
maligned:
35+
suggest-new: true
36+
misspell:
37+
locale: US
38+
39+
linters:
40+
disable-all: true
41+
enable:
42+
- deadcode
43+
- errcheck
44+
- goconst
45+
- gocyclo
46+
- gofmt
47+
- goimports
48+
- golint
49+
- gosec
50+
- govet
51+
- ineffassign
52+
- maligned
53+
- misspell
54+
- staticcheck
55+
- structcheck
56+
- typecheck
57+
- unconvert
58+
- unused
59+
- varcheck
60+
61+
62+
issues:
63+
# max-issues-per-linter default is 50. Set to 0 to disable limit.
64+
max-issues-per-linter: 0
65+
# max-same-issues default is 3. Set to 0 to disable limit.
66+
max-same-issues: 0
67+
# Excluding configuration per-path, per-linter, per-text and per-source
68+
exclude-rules:
69+
- path: _test\.go
70+
linters:
71+
- goconst
72+
- dupl
73+
- gomnd
74+
- lll
75+
- path: doc\.go
76+
linters:
77+
- goimports
78+
- gomnd
79+
- lll
80+
- path: pretty_test_vectors.go
81+
linters:
82+
- lll
83+
84+
# golangci.com configuration
85+
# https://github.com/golangci/golangci/wiki/Configuration
86+
service:
87+
golangci-lint-version: 1.23.x # use the fixed version to not introduce new linters unexpectedly

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2023 Contributors to the Veraison Project
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
export GO111MODULE := on
44
export SHELL := /bin/bash
55

6-
GOPKG := github.com/veraison/dice/tcg
6+
GOPKG := github.com/veraison/dice/open
7+
GOPKG += github.com/veraison/dice/tcg
78

89
GOLINT ?= golangci-lint
910

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Features
22

3-
Implementation of the attestation extension defined in [TCG DICE Attestation Architecture](https://trustedcomputinggroup.org/wp-content/uploads/TCG_DICE_Attestation_Architecture_r22_02dec2020.pdf).
3+
- Implementation of the attestation extension defined in [TCG DICE Attestation Architecture](https://trustedcomputinggroup.org/wp-content/uploads/TCG_DICE_Attestation_Architecture_r22_02dec2020.pdf).
4+
- Implementation of TCG DICE TCB Info evidence extension.
5+
- Implementation of [Open
6+
DICE](https://pigweed.googlesource.com/open-dice/+/refs/heads/master/docs/specification.md) certificate (CBOR and X.509) chain validation and claim extraction.
47

58

69
# Make targets

go.mod

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
module github.com/veraison/dice
22

3-
go 1.15
3+
go 1.18
44

5-
require github.com/stretchr/testify v1.6.1
5+
require (
6+
github.com/fxamacker/cbor/v2 v2.4.0
7+
github.com/stretchr/testify v1.8.3
8+
github.com/veraison/go-cose v1.2.0
9+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
10+
)
11+
12+
require (
13+
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/pmezard/go-difflib v1.0.0 // indirect
15+
github.com/x448/float16 v0.8.4 // indirect
16+
gopkg.in/yaml.v3 v3.0.1 // indirect
17+
)

go.sum

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88=
4+
github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
35
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
46
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
7-
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
7+
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
8+
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
9+
github.com/veraison/go-cose v1.2.0 h1:Ok0Hr3GMAf8K/1NB4sV65QGgCiukG1w1QD+H5tmt0Ow=
10+
github.com/veraison/go-cose v1.2.0/go.mod h1:7ziE85vSq4ScFTg6wyoMXjucIGOf4JkFEZi/an96Ct4=
11+
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
12+
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
13+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
14+
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
15+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
816
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
10-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
17+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
18+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)