-
Notifications
You must be signed in to change notification settings - Fork 5
[WIP] MP unit tests crash fix #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mykola-kobets-epam
wants to merge
5
commits into
aosedge:develop
Choose a base branch
from
mykola-kobets-epam:mp-unit-tests-crash-fix
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d345444
mp: make desctructor of CommChannelItf virtual
mykola-kobets-epam 97e2b6f
mp: lock LoadPrivateKey
mykola-kobets-epam edc78d9
mp: fix crash in SSL_Read/Write after channel closed
mykola-kobets-epam 503852f
mp: wip: disable TestCertChange
mykola-kobets-epam 582365c
conan: add softhsm2 conan file
mykola-kobets-epam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| from conan import ConanFile | ||
| from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps | ||
| from conan.tools.layout import basic_layout | ||
| from conan.tools.env import VirtualBuildEnv | ||
| from conan.tools.scm import Git | ||
| from conan.tools.files import copy | ||
|
|
||
| import os | ||
|
|
||
| class SoftHSMConan(ConanFile): | ||
| name = "softhsm2" | ||
| version = "2.6.1" | ||
| license = "BSD-2-Clause & ISC" | ||
| url = "https://www.opendnssec.org/softhsm/" | ||
| description = "PKCS#11 HSM/Token Emulator" | ||
| settings = "os", "compiler", "build_type", "arch" | ||
|
|
||
| def requirements(self): | ||
| self.requires("openssl/3.2.1") | ||
| self.requires("sqlite3/3.45.0") | ||
|
|
||
| def configure(self): | ||
| self.options["openssl"].no_dso = False | ||
| self.options["openssl"].shared = True | ||
|
|
||
| def build_requirements(self): | ||
| self.build_requires("autoconf/2.71") | ||
| self.build_requires("automake/1.16.5") | ||
| self.build_requires("libtool/2.4.7") | ||
| self.build_requires("pkgconf/1.9.5") | ||
|
|
||
| def layout(self): | ||
| basic_layout(self) | ||
|
|
||
| def source(self): | ||
| git = Git(self) | ||
| git.clone("https://github.com/softhsm/SoftHSMv2.git", target=self.source_folder) | ||
| git.checkout(self.version) # no 'v' prefix | ||
|
|
||
| def generate(self): | ||
| env = VirtualBuildEnv(self) | ||
| env.generate() | ||
|
|
||
| deps = PkgConfigDeps(self) | ||
| deps.generate() | ||
|
|
||
| tc = AutotoolsToolchain(self) | ||
| tc.generate() | ||
|
|
||
| def build(self): | ||
| autotools = Autotools(self) | ||
| autotools.autoreconf() | ||
| autotools.configure() | ||
| autotools.make() | ||
|
|
||
| def package(self): | ||
| autotools = Autotools(self) | ||
| autotools.install() | ||
|
|
||
| copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), | ||
| src=self.source_folder) | ||
|
|
||
| def package_info(self): | ||
| self.cpp_info.libs = ["softhsm2"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,12 +88,10 @@ class SecureChannel : public CommChannelItf { | |
| static int CustomBIORead(BIO* bio, char* buf, int len); | ||
| static long CustomBIOCtrl(BIO* bio, int cmd, long num, void* ptr); | ||
|
|
||
| void InitOpenssl(); | ||
| void CleanupOpenssl(); | ||
| SSL_CTX* CreateSSLContext(const SSL_METHOD* method); | ||
| Error ConfigureSSLContext(SSL_CTX* ctx); | ||
| std::string GetOpensslErrorString(); | ||
| RetWithError<EVP_PKEY*> LoadPrivateKey(const std::string& keyURL); | ||
| void InitOpenssl(); | ||
| void CleanupOpenssl(); | ||
| SSL_CTX* CreateSSLContext(const SSL_METHOD* method); | ||
| Error ConfigureSSLContext(SSL_CTX* ctx); | ||
|
|
||
| CommChannelItf* mChannel {}; | ||
| common::iamclient::TLSCredentialsItf* mCertProvider {}; | ||
|
|
@@ -107,8 +105,18 @@ class SecureChannel : public CommChannelItf { | |
| SSL* mSSL {}; | ||
| std::unique_ptr<BIO_METHOD, decltype(&BIO_meth_free)> mBioMethod {nullptr, BIO_meth_free}; | ||
| std::atomic<bool> mConnected {}; | ||
| std::recursive_mutex mReadMutex; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess one normal mutex should be enough. No? |
||
| std::recursive_mutex mWriteMutex; | ||
| }; | ||
|
|
||
| /** | ||
| * Loads private key from AOS URL and returns EVP_PKEY pointer. | ||
| * | ||
| * @param keyURL key URL. | ||
| * @return RetWithError<EVP_PKEY*>. | ||
| */ | ||
| RetWithError<EVP_PKEY*> LoadPrivateKey(const std::string& keyURL); | ||
|
|
||
| } // namespace aos::mp::communication | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line after comment header