Skip to content

Conversation

@sarroutbi
Copy link
Contributor

No description provided.

@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch 4 times, most recently from e238449 to 688d094 Compare June 17, 2025 15:37
@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 38.23529% with 21 lines in your changes missing coverage. Please review.

Project coverage is 62.57%. Comparing base (4f1201a) to head (6aad744).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
keylime-push-model-agent/src/main.rs 38.23% 21 Missing ⚠️
Additional details and impacted files
Flag Coverage Δ
e2e-testsuite 62.57% <38.23%> (-0.09%) ⬇️
upstream-unit-tests 62.57% <38.23%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
keylime/src/context_info.rs 47.45% <ø> (ø)
keylime/src/tpm.rs 71.34% <ø> (ø)
keylime-push-model-agent/src/main.rs 70.33% <38.23%> (-9.01%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch 3 times, most recently from 22191a4 to 6011669 Compare June 17, 2025 17:59
@sarroutbi sarroutbi changed the title Fix code to send multiple AKs per EK Send one AK per supported RSA signing scheme Jun 17, 2025
@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch 9 times, most recently from c8d06c4 to 7d9e8e4 Compare June 18, 2025 10:29
@sarroutbi
Copy link
Contributor Author

/packit retest-failed

@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch 3 times, most recently from 7ee8e83 to 4320818 Compare June 18, 2025 14:07
@sarroutbi sarroutbi marked this pull request as ready for review June 18, 2025 14:20
@sarroutbi sarroutbi requested a review from ansasaki June 18, 2025 16:09
@sarroutbi
Copy link
Contributor Author

@ansasaki : Please, do not pay attention to the coverage reports. There seems to be errors with latest change.

Comment on lines +221 to +223
tpm_encryption_alg: config.get_tpm_encryption_alg(),
tpm_hash_alg: config.get_tpm_hash_alg(),
tpm_signing_alg: config.get_tpm_signing_alg(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I was trying to understand why these are fixed in the context. I think you do not need to follow the pull agent so much, in the sense that there we had a single set of algorithms to be configured, while in the push model the agent will negotiate the parameters.

For me, it would make more sense if the context held the supported algorithms obtained from the TPM capabilities.

Then, after negotiating the algorithms with the verifier, you should use this to decide which keys to generate/load and send the requested AK.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you create an AK, you need to specify a particular one:

            let ak = self.tpm_context.create_ak(
                self.ek_handle,
                self.tpm_hash_alg,
                key_alg_for_ak,
                sign_alg,
            )?;

However, the amount of AKs that can be load is relatively small in TPM. That is the reason why I decided to follow this approach. Keeping the signing algorithm is just for BW compatibility. There is one AK generated for each RSA supported signing scheme.
So, if we change this ... how would you approach about this? A combination of all the options?

Copy link
Contributor

@ansasaki ansasaki Jun 19, 2025

Choose a reason for hiding this comment

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

OK, sorry for my last message, I think I was probably tired by the end of the day and could not understand the problem here. Now I see the problem.

I think the Agent should be configurable so that the user can decide which keys to offer, with the possibility of offering multiple keys if they want. So, in my mind, we should allow the user to configure a list of AK to offer, which can be:

  • by setting the parameters to generate the key
  • by setting the key handle, if it was persisted
  • by setting a file path to load a previously generated key (maybe this will be part of the first option as usually we want to persist the generated keys somewhere)

We also should have a default option where it will offer a single key using a default set of algorithms. I think this is the easiest way for you to move forward (basically implement the default case, which is to offer a single AK key that is loaded from a default location or generated if the file is not there, like it is today in the pull agent).

I think we have to discuss with HPE guys and agree how this should work in the final form.

We could use JSON strings to specify the keys parameters or create a specific configuration language and write the parser for it.

PS.: The default behavior could also be similar to what you are doing, which is basically generate some keys with some combination of algorithms and offer them (probably one RSA and one ECC key would be sufficient), but I don't think it should be all the possible combinations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ansasaki : Do you think it would be feasible to have a first version that sends one RSA and one ECC, then create all the possible ones from config once config is groomed? This way, we can have something with multiple AKs and deliver proposed changes (persistence and configuration based AKs creation) in other PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think we can proceed like this and make the changes on a future PR

Copy link
Contributor Author

@sarroutbi sarroutbi Jun 19, 2025

Choose a reason for hiding this comment

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

Hello Anderson. After clarifying it, I understand original PR is not required. However, let me keep this open to have the Singleton to the Context Info maintained, as this will reduce allocating Context more than once. If you prefer me to open a newer PR, please, let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, let's repurpose it to implement the singleton for the Context

@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch 2 times, most recently from 587373e to b6a4c44 Compare June 19, 2025 10:23
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
@sarroutbi sarroutbi force-pushed the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch from b6a4c44 to 6aad744 Compare June 19, 2025 15:17
@sarroutbi sarroutbi changed the title Send one AK per supported RSA signing scheme Use singleton to avoid multiple Context allocation Jun 19, 2025
Copy link
Contributor

@ansasaki ansasaki left a comment

Choose a reason for hiding this comment

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

LGTM

@ansasaki ansasaki merged commit 2bffa3c into keylime:master Jun 19, 2025
11 of 12 checks passed
@sarroutbi sarroutbi deleted the 202506171613-add-multiple-aks-one-per-supported-signing-scheme branch June 23, 2025 09:22
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.

2 participants