Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Misc HSM fixes #1471

Merged
merged 5 commits into from
Dec 5, 2019
Merged

Misc HSM fixes #1471

merged 5 commits into from
Dec 5, 2019

Conversation

lbonn
Copy link
Contributor

@lbonn lbonn commented Dec 3, 2019

Found after trying the real thing.

if(TEST_PKCS11_MODULE_PATH)
add_definitions(-DTEST_PKCS11_MODULE_PATH="${TEST_PKCS11_MODULE_PATH}"
-DTEST_PKCS11_ENGINE_PATH="${TEST_PKCS11_ENGINE_PATH}")
endif(TEST_PKCS11_MODULE_PATH)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Am I reading this right that you've basically moved these definitions to only get set in the source files that need them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's the intent.

@pattivacek
Copy link
Collaborator

I recommend running the oe-selftests on this before merging since it seems likely to affect them. Looks good in general, though!

static const std::array<boost::filesystem::path, 3> engine_system_paths = {
"/usr/lib/engines-1.1/pkcs11.so",
"/usr/lib/engines/pkcs11.so",
"/usr/lib/x86_64-linux-gnu/engines-1.1/pkcs11.so"

Choose a reason for hiding this comment

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

x86_64-linux-gnu? This is not generic across architectures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is a small sample of possible locations I've seen (in this case, Ubuntu Bionic x86-64).

The recommended way should be to define PKCS11_ENGINE_PATH, this is only a helpful fallback. But maybe this is more harmful than useful?

Choose a reason for hiding this comment

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

Problem is that if you want to cover other common locations this list will end up growing quite a bit as it depends on the distro and architecture used (e.g. bionic armhf/arm64/ppc64 would all have a different linux-gnu path).

Shouldn't necessarily be a problem, but having PKCS11_ENGINE_PATH is probably cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree, that's why the list is not intended to be exhaustive, just be helpful for the common desktop testing scenario.

I will at least add some comments or maybe even do that through CMake in a safer way.

@codecov-io
Copy link

codecov-io commented Dec 4, 2019

Codecov Report

Merging #1471 into master will decrease coverage by 0.16%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1471      +/-   ##
==========================================
- Coverage    80.6%   80.44%   -0.17%     
==========================================
  Files         184      184              
  Lines       11082    11083       +1     
==========================================
- Hits         8933     8916      -17     
- Misses       2149     2167      +18
Impacted Files Coverage Δ
src/libaktualizr/crypto/p11engine.cc 74.65% <40%> (-2.59%) ⬇️
src/libaktualizr/storage/sqlstorage_base.h 60% <0%> (-40%) ⬇️
src/libaktualizr/storage/sqlstorage_base.cc 74.32% <0%> (-4.73%) ⬇️
src/libaktualizr/storage/sqlstorage.cc 76.33% <0%> (-0.45%) ⬇️
src/libaktualizr/primary/sotauptaneclient.cc 88.79% <0%> (-0.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbb9a52...003a560. Read the comment docs.

@lbonn
Copy link
Contributor Author

lbonn commented Dec 4, 2019

I've made some changes to remove the engine detection at runtime.
It's now done at configure time, only when compiling locally.

CMakeLists.txt Outdated Show resolved Hide resolved
lbonn added 5 commits December 5, 2019 17:14
And change the name to not have "TEST" in it, as it is not test specific

Signed-off-by: Laurent Bonnans <[email protected]>
Used in one ancient test

Signed-off-by: Laurent Bonnans <[email protected]>
A configure time mechanism is kept for convenience in development
environments.

It needs to be passed explicitely in cross-compiling (yocto) situations.

Signed-off-by: Laurent Bonnans <[email protected]>
@lbonn lbonn merged commit 6b1da3e into master Dec 5, 2019
@lbonn lbonn deleted the feat/real-hsm branch December 5, 2019 17:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants