Introduce backend-agnostic provider configuration and provider manager factory - #92
Introduce backend-agnostic provider configuration and provider manager factory#92ChansAlive wants to merge 26 commits into
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
7ed0b22 to
3a2f4ac
Compare
f04bdec to
b45fefe
Compare
|
The created documentation from the pull request is available at: docu-html |
b45fefe to
24d32c3
Compare
|
I just checked whether I could integrate the NXP pkcs11-hse module using the mechanism |
24d32c3 to
ec72296
Compare
|
Hi @ChansAlive, Thank you for the great PR. I would like to revisit the decision we took today with @sunildevda and @schreibwsag regarding the merge of Cryptoki PR first https://github.com/eclipse-score/inc_security_crypto/pull/49/changes#diff-d1c061eac386f8ea2f48819d2f3a6ba46b3d17d9ac16176816beaf2fbea1c681. Sorry for the confusion, in the meeting I was thinking this is a proposal PR for the architecture improvement not a ready implementation. In this case, I think merging this PR first then adapting cryptoki PR accordingly will be more convenient and will allow me to handle the cryptoki integration the correct way based on this current implementation. So those will be two steps. otherwise, I think this PR will need to handle the cryptoki integration as well to resolve some expected conflicts. What do you think @ChansAlive, @sunildevda and @schreibwsag? |
a0cd28f to
e87c58d
Compare
0eae5bd to
ca1c914
Compare
Based on the review comments, I have modified the way to configure the backend providers. |
| ) | ||
|
|
||
| bool_flag( | ||
| name = "score_crypto_openssl_enabled", |
There was a problem hiding this comment.
| name = "score_crypto_openssl_enabled", | |
| name = "score_crypto_score_openssl_enabled", |
Please also updates description and readme accordingly
| ) | ||
|
|
||
| bool_flag( | ||
| name = "score_crypto_primula_enabled", |
There was a problem hiding this comment.
| name = "score_crypto_primula_enabled", | |
| name = "score_crypto_score_primula_enabled", |
Please also updates description and readme accordingly
|
|
||
| ## Score Provider Sub-Backends | ||
|
|
||
| Score provider sub-backends live under `score_provider/<backend>/`. Each follows |
There was a problem hiding this comment.
| Score provider sub-backends live under `score_provider/<backend>/`. Each follows | |
| Score provider sub-backends live under `score/crypto/src/daemon/provider/score_provider/<backend>/`. Each follows |
There was a problem hiding this comment.
I understand the confusion here. I will try to rephrase here with absolute paths.
I have created a section to explain the two folder view of the provider families and what each exists for. The folder mentioned here is infact backend package folder
|
|
||
| ## Adding a New Score Provider Backend | ||
|
|
||
| 1. Implement the provider under `score_provider/<backend>/`. |
There was a problem hiding this comment.
Please provide full path to score_provider as above.
There was a problem hiding this comment.
Same as the comment for above
| +Shutdown() : Result<void> | ||
| +Initialize(context : ProviderInitContext) : bool | ||
| +Shutdown() : void | ||
| +IsInitialized() : bool |
There was a problem hiding this comment.
It is expected that this method is not necessary (Initialize -> false -> provider is not initialized -> daemon terminates)
|
|
||
| interface provider::IProviderFactory { | ||
| +CreateAndRegister(manager) : bool | ||
| +CreateAndRegister(manager : ProviderManager&) : ProviderFactoryResult |
There was a problem hiding this comment.
Please change to Expected<void, error>
| +RegisterFactory(factory) | ||
| +Initialize() : bool | ||
| +RegisterProvider(name, provider, type) : bool | ||
| +IsProviderRegistered(name) : bool |
There was a problem hiding this comment.
Should not be required (RegisterProvider -> false -> Provider could not be registered -> daemon terminates)
| title __Architecture overview__ | ||
|
|
||
| set namespaceSeparator :: | ||
| top to bottom direction |
There was a problem hiding this comment.
plantuml preview in devconatiner does not longer work please check the file for errors.
May also be deffered to eclipse-score/inc_security_crypto#140
| └── BuildTypeMappings(ProviderInitConfig.typeToProviderName) | ||
| resolve registered names → runtime ProviderId | ||
|
|
||
| On a later request, ``ProviderManager::GetProvider(...)`` checks |
There was a problem hiding this comment.
We should not allow a further defferred initialization. If the provider_manager->Initialize() fails the daemon should terminate and not try a deffered initialization on user application demand.
|
I could integrate my pkcs11_dynload backend and my afalg provider using the new config method. For Primula it should also be: |
This PR decouples the crypto daemon's provider layer from any specific cryptographic backend.
Previously, daemon manually wired OpenSSL and SoftHSM factories step by step, provider names were hardcoded, and a single factory failure aborted the entire startup. There was no stable seam between which backends are compiled in and how providers are registered and routed at runtime.
Key changes:
Out of scope:
Test reuse across providers.
Build impact:
Backends selected via compile-time flags; existing OpenSSL and SoftHSM defaults are preserved.
closes #94