Skip to content

NewSignatureData works with generic crypto signer.#420

Merged
rminnich merged 2 commits intolinuxboot:mainfrom
werwurm:generic_signer
Sep 15, 2024
Merged

NewSignatureData works with generic crypto signer.#420
rminnich merged 2 commits intolinuxboot:mainfrom
werwurm:generic_signer

Conversation

@werwurm
Copy link
Copy Markdown
Contributor

@werwurm werwurm commented Sep 6, 2024

Casting the crypto.Signer into concrete crypto.PrivateKey
implementations unnecessarily limits the use of the library to software
implementations provided by the golang crypto libraries.

This patch makes the detection of the algorithm based on the public key
which is exposed through crypto.Signer.Public() and then uses the
interface function Sign to perform the actual signing.

This allows for hiding the implementation behind the crypto.Signer
interface, e.g., for signing with an HSM backed key.

Caveat: This patch does not add support for generic SM2 implementations.
But this is not a regression.

Signed-of-by: Janis Danisevskis jdanisevskis@aurora.tech

Casting the crypto.Signer into concrete crypto.PrivateKey
implementations unnecessarily limits the use of the library to software
implementations provided by the golang crypto libraries.

This patch makes the detection of the algorithm based on the public key
which is exposed through crypto.Signer.Public() and then uses the
interface function Sign to perform the actual signing.

This allow for hiding the implementation behind the crypto.Signer
interface, e.g., for signing with an HSM backed key.

Caveat: This patch does not add support for generic SM2 implementations.
But this is not a regression.

Signed-off-by: Janis Danisevskis <jdanisevskis@aurora.tech>
@werwurm
Copy link
Copy Markdown
Contributor Author

werwurm commented Sep 9, 2024

The clean-code error does not seam to be related to my PR. There seems to be an error while installing one of the checks?

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.63%. Comparing base (ef43a2a) to head (dd81760).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #420   +/-   ##
=======================================
  Coverage   41.63%   41.63%           
=======================================
  Files         142      142           
  Lines       10729    10729           
=======================================
  Hits         4467     4467           
  Misses       5394     5394           
  Partials      868      868           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rminnich rminnich merged commit 923daa8 into linuxboot:main Sep 15, 2024
@orangecms
Copy link
Copy Markdown
Collaborator

The clean-code error does not seam to be related to my PR. There seems to be an error while installing one of the checks?

Yes, #423 fixed part of the CI issues. Thank you!

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.

4 participants