Comments (12)
Now I'm implementing the test code of TPM2_Commit, but not work.
Do you have any idea to solve this error?
go test -run TestCommit
--- FAIL: TestCommit (0.01s)
commit_test.go:102: could not commit: TPM_RC_AUTH_MISSING: command requires an authorization session for handle and it is not present.
FAIL
exit status 1
FAIL github.com/google/go-tpm/direct/tpm2 0.012s
https://github.com/akakou/go-tpm/blob/tpm2-commit/direct/tpm2/commit_test.go
from go-tpm.
Can you try removing the space between the comma-separated type annotations at https://github.com/akakou/go-tpm/blob/dafdbfea0c93185d68e8afe8eccf4c520fa48456/direct/tpm2/tpm2.go#L625? I.e.,
SignHandle handle `gotpm:"handle,auth"`
from go-tpm.
Thank you! It's one of the bugs and I fixed it.
But it has never worked still...and panic with the error following:
--- FAIL: TestCommit (0.00s)
commit_test.go:102: could not commit: TPM_RC_SIZE (handle 0): structure is the wrong size
FAIL
exit status 1
FAIL github.com/google/go-tpm/direct/tpm2 0.008s
Do you have any idea?
from go-tpm.
I added to create a key that is not the primary key because the basic sample program needs to run TPM2_Create
.
(But I don't know why it is needed.)
However, the program has the same error as before...
from go-tpm.
TPM_RC_SIZE (handle 0): structure is the wrong size
looks like an ill-formed error code to me. Handle indices start at 1, so "handle 0" doesn't make a lot of sense. I'm assuming the test code got back raw error code 0x95, but we should investigate whether there's a bug in the error interpretation stack. Filed #290 to follow up on our side.
Confession: I still don't understand ECDAA. Please correct me where my crypto veers astray 😅
P1: tpm2b.ECCPoint{
Point: tpms.ECCPoint{
X: tpm2b.ECCParameter{
Buffer: []byte{
0x1, 0x1,
},
},
Y: tpm2b.ECCParameter{
Buffer: []byte{0x1, 0x1},
},
},
Size: 8,
},
P1 doesn't look like a real ECC point to me. Is 0x0101,0x0101 a legitimate BNP256 point?
Second issue, looks like you added TPM2B_ECC_Point but there is some subtlety about marshalling I need to point out:
// TPM2BECCPoint represents a TPM2B_ECC_POINT.
// See definition in Part 2: Structures, section 11.2.5.3.
type TPM2BECCPoint struct {
Size uint16
Point TPMSECCPoint
}
In go-tpm tpmdirect, sized 2Bs' sizes are never passed in by the user. Instead they are computed on the fly. Can you fix this to
// TPM2BECCPoint represents a TPM2B_ECC_POINT.
// See definition in Part 2: Structures, section 11.2.5.3.
type TPM2BECCPoint struct {
Point TPMSECCPoint `gotpm:"sized"`
}
The sized
type annotation instructs the marshalling/unmarshlaling
from go-tpm.
Thank you! You are right and I fixed them.
Specifically, I fixed them as:
- Set
x=0x1
,y=0x2
to P1.- It's the generator of ECP.
- 5.2.7 BN P256 (https://trustedcomputinggroup.org/wp-content/uploads/TCG_Algorithm_Registry_Rev_1.22.pdf)
- Use annotation to express the size of TPM2B_ECC_POINT
from go-tpm.
But the program calls the same error...
from go-tpm.
I compared worked TPM2_Commit(tpm2-tools) and this library.
Mainly, I compared what binaries each library sent to TPM.
These are the binaries:
go-tpm
\x80\x02\x00\x00\x00\x40\x00\x00\x01\x91\x40\x00\x00\x01\x00\x00\x00\x09\x40\x00\x00\x09\x00\x00\x00\x00\x00\x00\x07\x00\x03\x00\x01\x03\x00\x00\x00\x1a\x00\x23\x00\x04\x00\x04\x00\x72\x00\x00\x00\x10\x00\x1a\x00\x0b\x00\x00\x00\x10\x00\x10\x00\x00\x00\x00
tpm2-tools
\x80\x02\x00\x00\x00\x65\x00\x00\x01\x8b\x80\xff\xff\xff\x00\x00\x00\x49\x02\x00\x00\x00\x00\x20\x14\xe2\x02\x60\x66\x57\x5f\x9c\xab\x50\x13\x21\x36\x37\xc3\xfd\x24\x86\xf8\xae\x9f\xa1\x0b\x62\x3e\x4a\x00\xa8\x91\x8d\xf3\x10\x01\x00\x20\x2f\xc0\x53\x68\x30\xa0\x0b\xc3\x88\x5f\x43\xed\x73\x00\xa8\x79\x87\xae\x96\x5a\x78\xa3\xe1\xda\x40\xa4\xa0\x0d\xae\x11\x4f\xca\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00
from go-tpm.
Sorry...I had added the unnecessary parameter to the request of TPM2_Commit.
Specifically, we should not add the count
to the request.
from go-tpm.
So I fixed it and it works.
Could you check the PR (#296) and merge it?
from go-tpm.
from go-tpm.
It is implemented at #296, so I closed this issue.
from go-tpm.
Related Issues (20)
- Add helper for tpmDirect ObjectAttributes
- tpmDirect Design Feedback HOT 2
- delete the struct aliases & consider merging all of structures and commands into one 'tpm2' package HOT 4
- reduce repetitive, nested structs by proving a defaults package HOT 1
- support passing []byte as TPM2B HOT 2
- Add a Compare function
- Load TSS2 Private Key generated with tpm2tss-genkey HOT 2
- Inconsistency between written and read values when accessing PCR HOT 3
- reduce unnecessary overhead of Tbsi_Get_TCG_Log HOT 1
- Missing ExtraData in Quote
- Use `crypto/ecdh` for tpmdirect HOT 5
- Darwin ? HOT 1
- EvictControl missing from new tpm2 HOT 10
- Consider an UnmarshalReader API for types
- HMAC Session not working HOT 2
- Support As(TPMRC) for format-1 errors.
- Support serialization of persistent handles HOT 1
- Support for RSAEncrypt and RSADecrypt commands HOT 1
- TPM Simulator reporting unrecognised command over socket
- Implement TPM2_HMAC_Start
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-tpm.