Cryptoki etas integration - #49
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
80k lines. Sorry, but I'm not able to review that. Is it possible to create smaller, readable PR's? |
|
Kindly check the PR again and resolve the merge conflicts. |
4d92606 to
cc51b96
Compare
|
test_pkcs11_provider fails when compiled with USE_RUST_PKCS11 ("C_InitToken failed: 160"). ./bazel-bin/tests/provider_test/test_pkcs11_provider [----------] Global test environment tear-down |
4e95a25 to
0f08964
Compare
|
The created documentation from the pull request is available at: docu-html |
ab068a8 to
09800f7
Compare
ChansAlive
left a comment
There was a problem hiding this comment.
Review done on the daemon changes as part of integrating the rust pkcs11 provider
There was a problem hiding this comment.
Are these patch files really required to be merged?
There was a problem hiding this comment.
Hi @ChansAlive, Yes, these patches are required to compile successfully:
- openssl_sys patch: Bypasses host filesystem scanning (which is blocked by Bazel's secure sandbox) to link directly to our built-in //third_party/openssl library.
- Other patches: Fix outdated Rust syntax and Cargo workspace README paths so S-CORE compiles cleanly on modern stable toolchains
There was a problem hiding this comment.
Hi @ShoroukRamzy ,
Thanks for the response.
- Currently, if I understand correctly, the patch hardcodes the version to 3.4 and we already are using 3.6.1, shouldn't we check which version of openssl we are using and adapt the patch to maintain consistency?
- Regarding the score_logging.patch, if this is some change that should ideally be present in the respective module, we should not be patching it here right? Probably if we are using a third_party exclusively used sources, it may be fine. But from the middleware perspective, considering the modules could be shared by multiple modules, how do we expect this patching to work?
Ideally we should try to reduce patches as this might cause issues in the reference integration.
cc: @OliverHeilwagen
There was a problem hiding this comment.
Hi @ChansAlive,
Thank you for your feedback. Regarding the first point, Let me clarify some points:
-
OpenSSL (C++) vs openssl-sys (Rust): S-CORE compiles OpenSSL 3.6.1 (the actual C++ binary), but our Rust bindings crate openssl-sys has no 3.6.x or ossl360 flags in its source code; its highest defined 3.x flag is ossl350.
-
Why we patch (Bazel Sandbox): The unpatched crate’s script scans host paths (like /usr/include), which is blocked inside Bazel's secure sandbox. Our patch simply bypasses this scan to prevent a compile-time crash.
-
Backward Compatibility: If the unpatched script could scan our 3.6.1 dynamically, it would automatically fall back to ossl350. OpenSSL strictly guarantees ABI backward compatibility, making this 3.5.0 compiled subset 100% compatible and safe to run against S-CORE's compiled 3.6.1 binary at runtime.
To maintain perfect consistency, we have updated the patch to output ossl350 and version number 30500000 (3.5.0 fallback).
There was a problem hiding this comment.
@ShoroukRamzy,
I agree with the reason for patching the openssl-sys crate. Please check if all other patches are necessary.
The open point I have is on how to maintain consistency with openssl-sys crate patch and the openssl what we are building automatically. Else we might change (upgrade or downgrade) the openssl version without upgrading the patch.
It would be great if we have a possibility to patch with the maximum supported version of openssl (either of what is supported by crate or what we build) and throw necessary error in case of incompatibility.
Thanks.
There was a problem hiding this comment.
@ChansAlive,
I removed all other patches, I tested without them and they are not needed
There was a problem hiding this comment.
@ChansAlive, Regarding the openssl point, I fully agree with it and I updated the patch to maintain this consistency. Thanks!
There was a problem hiding this comment.
@ChansAlive, Regarding the openssl point, I fully agree with it and I updated the patch to maintain this consistency. Thanks!
@ChansAlive, Done
09800f7 to
2811e99
Compare
|
@ChansAlive , is this to be merged now? |
|
Hi @ChansAlive and @OliverHeilwagen, I addressed all the review comments. next step, I will create the sub-issues that will need to be handled in other dedicated PRs. Thanks for all the review comments and your efforts! |
Yes. We can target to merge this next. |
OliverHeilwagen
left a comment
There was a problem hiding this comment.
Approved with suggestions.
| with: | ||
| # the bazel-target depends on your repo specific docs_targets configuration (e.g. "suffix") | ||
| bazel-target: "--lockfile_mode=error //:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}" | ||
| bazel-target: "--lockfile_mode=update //:docs -- --github_user=${{ github.repository_owner }} --github_repo=${{ github.event.repository.name }}" |
There was a problem hiding this comment.
Please revert to error.
Update should hide a wrong MODULE.bazel.lock which should not be done.
This also applies to license_check.yml
We can make the lockfile update part of the pre-commit so it is less annoying when doing dependency updates.
There was a problem hiding this comment.
fixed please resolve comment.
| build:x86_64-linux --config=shared | ||
| build:x86_64-linux --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix | ||
| build:x86_64-linux --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0 | ||
| build:x86_64-linux --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_unknown_linux_gnu |
There was a problem hiding this comment.
Why is this not longer required?
There was a problem hiding this comment.
@OliverHeilwagen, yes not needed because this Rust toolchain registration is automatically handled by the Bzlmod module system through our dependency on@score_toolchains_rust in MODULE.bazel, making manual registeration in bazel.rc redundant
| build --output_groups=+rules_lint_human | ||
| build:lint --@aspect_rules_lint//lint:fail_on_violation=true | ||
| build:lint --config=per-x86_64-linux | ||
| test --test_output=errors |
There was a problem hiding this comment.
Nitpick, please separate it from the Clippy linting settings as it is a generic setting affecting all bazel test invocations.
There was a problem hiding this comment.
fixed please resolve comment.
There was a problem hiding this comment.
It should not be necessary to upload this file to the repository.
There was a problem hiding this comment.
This file got removed in earlier PRs no need to bring it back
OliverHeilwagen
left a comment
There was a problem hiding this comment.
No blockers from testing and bazel point of view.
Remove of patches and crate_universe are planned as follow-up topics.
|
Hi @ChansAlive and @OliverHeilwagen, Thank you for all your feedbacks. I addressed all the review comments and I created the sub-issues that to be handled in dedicated follow-up PRs. Any other feedbacks? |
Hi @OliverHeilwagen , I created these issues #185 #184 #183 to be implemented in dedicated PRs in next step |
Key Changes:
Integrated the cryptoki module natively into the score_crypto.
Moved the cryptoki provider to score/crypto/daemon/provider/pkcs11/cryptoki.
Updated all Bazel build configurations, Cargo dependencies, and lockfiles to correctly map to the new path.
Verified that the daemon, integration tests, and multi-provider demos build and pass successfully with the new provider location.
Use a single source for openssl (ETAS provided version) found under third_party/openssl
Integrate SCORE Logger into Cryptoki code
closes Integrate PKCS11 (Cryptoki) to SCORE #29 (children tasks PKCS11 (Cryptoki) Integration with SCORE #31 and Integration of PKCS11 (Cryptoki) With ETAS Architecture #32)
closes Have only one version of OpenSSL on target #30 (child task Selecting One OpenSSL Version for the Security Code #33)
Your Reviews will be appreciated @ChansAlive @PandaeDo @masc2023 @schreibwsag @OliverHeilwagen