Skip to content

Commit

Permalink
Add an example
Browse files Browse the repository at this point in the history
  • Loading branch information
xaionaro committed Apr 16, 2021
1 parent 7d8bf9e commit 07051dd
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 7 deletions.
26 changes: 26 additions & 0 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package main

import (
"github.com/google/go-tpm/tpm2"
"github.com/xaionaro-go/tpm2-tss/go_tpm2_tss"
)

func main() {
var ectx go_tpm2_tss.EsysContext

pcrIndex := go_tpm2_tss.EsysTr(go_tpm2_tss.EsysTrPcr0)
digests := []go_tpm2_tss.TpmlDigestValues{{
Count: 1,
Digests: [16]go_tpm2_tss.TpmtHa{
{
Hashalg: go_tpm2_tss.TpmiAlgHash(tpm2.AlgSHA1),
Digest: go_tpm2_tss.TpmuHa{1, 2, 3, 4},
},
},
}}

rc := go_tpm2_tss.EsysPcrExtend(&ectx, pcrIndex, go_tpm2_tss.EsysTrPassword, go_tpm2_tss.EsysTrNone, go_tpm2_tss.EsysTrNone, digests)
if rc != go_tpm2_tss.Tss2RcSuccess {
panic(rc)
}
}
3 changes: 3 additions & 0 deletions go-tpm2-tss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ GENERATOR:
PackageName: go_tpm2_tss
PackageDescription: "Package go_tpm2_tss provides CGo bindings for tpm2-tss. The package is automatically generated by \"c-for-go\"."
PackageLicense: "License: CC-0"
FlagGroups:
- { name: CFLAGS, flags: [ -I ../c/include ] }
PkgConfigOpts:
- tss2-tcti-mssim
- tss2-tcti-device
Expand All @@ -14,6 +16,7 @@ GENERATOR:
Includes:
- tss2/tss2_common.h
- tss2/tss2_esys.h
- tss2/tss2_fapi.h
- tss2/tss2_mu.h
- tss2/tss2_rc.h
- tss2/tss2_sys.h
Expand Down
2 changes: 1 addition & 1 deletion go_tpm2_tss/cgo_helpers.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// License: CC-0

// WARNING: This file has automatically been generated on Fri, 16 Apr 2021 23:18:11 IST.
// WARNING: This file has automatically been generated on Fri, 16 Apr 2021 23:53:50 IST.
// Code generated by https://git.io/c-for-go. DO NOT EDIT.

#include "_cgo_export.h"
Expand Down
4 changes: 3 additions & 1 deletion go_tpm2_tss/cgo_helpers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion go_tpm2_tss/cgo_helpers.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// License: CC-0

// WARNING: This file has automatically been generated on Fri, 16 Apr 2021 23:18:11 IST.
// WARNING: This file has automatically been generated on Fri, 16 Apr 2021 23:53:49 IST.
// Code generated by https://git.io/c-for-go. DO NOT EDIT.

#include "tss2/tss2_common.h"
#include "tss2/tss2_esys.h"
#include "tss2/tss2_fapi.h"
#include "tss2/tss2_mu.h"
#include "tss2/tss2_rc.h"
#include "tss2/tss2_sys.h"
Expand Down
4 changes: 3 additions & 1 deletion go_tpm2_tss/const.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go_tpm2_tss/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion go_tpm2_tss/go_tpm2_tss.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion go_tpm2_tss/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07051dd

Please sign in to comment.