Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs around creating ECDAA key #285

Closed
wants to merge 4 commits into from

Conversation

akakou
Copy link
Contributor

@akakou akakou commented Jun 14, 2022

There are the following bugs around creating ECDAA key:

  • CurveBNP256 number is wrong
    • TPM expects 0x10 to TPM2_ECC_BN_P256 but this library does not set so.
  • ECDAA count (in TPMS_SCHEME_ECDAA) size is wrong
    • TPM expects 16bit but, actually 32bit in go-tpm.

So this PR fixes these bugs.

Reference

@akakou akakou requested review from alexmwu, jkl73 and a team as code owners June 14, 2022 07:16
@google-cla
Copy link

google-cla bot commented Jun 14, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@@ -426,7 +426,7 @@ const (
CurveNISTP384
CurveNISTP521

CurveBNP256 = EllipticCurve(iota + 10)
CurveBNP256 = EllipticCurve(0x10)
CurveBNP638
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind fixing this one too (0x11)? I'm fine replacing all the constants in this const block for EllipticCurve with explicit values from the spec, btw.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean the CurveBNP638?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced them on a new commit!

Copy link
Member

@chrisfenner chrisfenner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good, only a small fix for CurveBNP638.

BTW, we are doing a major refactor to the API in https://github.com/google/go-tpm/tree/tpmdirect - have you thought about how ECDAA could be exposed via the legacy command model, or do you want to build this in TPMDirect?

@akakou
Copy link
Contributor Author

akakou commented Jun 28, 2022

Umm...now I'm trying to implement some TPM commands (e.g. TPM2_Commit #287) which are needed by ECDAA, to tpmdirect.

But I don't think that I develop ECDAA API (e.g. ECDAA_JOIN) directly, because there is some process that should not be in the scope of the TPM.
(FIDO ECDAA defines the other module running on a client named ASM. There are some processes for ECDAA running on ASM, not on TPM)

https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-ecdaa-algorithm-v2.0-id-20180227.html#ecdaa-sign-split-between-tpm-and-asm

@chrisfenner
Copy link
Member

Sounds good. Do you want to send a PR to the tpmdirect branch instead of master?

@akakou
Copy link
Contributor Author

akakou commented Jun 29, 2022

You are right! I will change the destination branch to tpmdirect.

@akakou akakou changed the base branch from master to tpmdirect June 29, 2022 05:40
@akakou
Copy link
Contributor Author

akakou commented Jun 29, 2022

But I am concerned that the master branch remains wrong about BN256 and ECDAA.
Because some people using BN256 or ECDAA with master branch may be confused.

I would like to confirm just in case; the tpmdirect branch will be merged with the master branch finally, right?

@chrisfenner
Copy link
Member

That's right, in the long run we expect to merge tpmdirect to master and cut a new release where that is the default go-tpm API and the current one is deprecated. As far as timeline, depends on how long it takes to get it done and bake it - with your help on ECDAA it can be that much sooner :)

@chrisfenner
Copy link
Member

@akakou, sorry for being unclear. Thanks for working on this.

These files touched by this PR (constants.go and structures.go) are part of the "legacy" (non-direct) API. If you want to fix them for the master branch I'd be fine with it. Thus, this PR can go to go-tpm:master, however it'd be additional work to figure out how to expose ECDAA through the legacy API without breaking current users. IMHO that's not going to be worth the effort to build safely, given the number of different flavors of Sign in the legacy API.

The alternative, if you're OK with depending on the tpmdirect branch for a while, would be to cancel this PR and send a different one to go-tpm:tpmdirect with:

@akakou akakou mentioned this pull request Jul 1, 2022
2 tasks
@akakou
Copy link
Contributor Author

akakou commented Sep 5, 2022

This discussion was solved because we decided that contribute to tpmdirect.
So I close this PR.

@akakou akakou closed this Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants