-
Notifications
You must be signed in to change notification settings - Fork 102
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
restrict libctx test to oqsprovider #620
Open
baentsch
wants to merge
3
commits into
main
Choose a base branch
from
mb-fixlibctxtest
base: main
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
3 commits
Select commit
Hold shift + click to select a range
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 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 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 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 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 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 |
---|---|---|
|
@@ -35,8 +35,8 @@ static int test_oqs_signatures(const char *sigalg_name) { | |
// provider | ||
if (OSSL_PROVIDER_available(libctx, "default")) { | ||
testresult &= | ||
(ctx = EVP_PKEY_CTX_new_from_name( | ||
libctx, sigalg_name, "provider=oqsprovider")) != NULL && | ||
(ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, | ||
OQSPROV_PROPQ)) != NULL && | ||
EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) && | ||
(mdctx = EVP_MD_CTX_new()) != NULL && | ||
EVP_DigestSignInit_ex(mdctx, NULL, "SHA512", libctx, NULL, key, | ||
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. Same here. 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. Same here :-) No, Thanks. |
||
|
@@ -66,7 +66,7 @@ static int test_oqs_signatures(const char *sigalg_name) { | |
// this test must work also with default provider inactive: | ||
testresult &= | ||
(ctx = EVP_PKEY_CTX_new_from_name(libctx, sigalg_name, | ||
"provider=oqsprovider")) != NULL && | ||
OQSPROV_PROPQ)) != NULL && | ||
EVP_PKEY_keygen_init(ctx) && EVP_PKEY_generate(ctx, &key) && | ||
(mdctx = EVP_MD_CTX_new()) != NULL && | ||
EVP_DigestSignInit_ex(mdctx, NULL, NULL, libctx, NULL, key, NULL) && | ||
|
This file contains 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 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.
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.
I guess the OQSPROV_PROPQ should also be present on the
EVP_DigestSignInit_ex/EVP_DigestVerifyInit_ex
, right?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.
No: oqsprovider does not contain SHA implementations.
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.
Yes, that was my doubt as well, because documentation clearly states that "If the provider supports fetching the digest then it may use the props argument for the properties to be used during the fetch". But then I saw that the property query is also being used in here, which is an operation where I would assume the property query
provider=oqsprovider
would be desired (as it is done in the KEM tests, for example). But, if I understand correctly,oqsprovider
will later fetch the digest to use without that property query (here), although is true thatopenssl
will at first try to use the property query to fetch the digest (here) and that could pose problematic, specially in the future. I'm sure I am missing something, so I apologize for the confusion I might be creating.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.
No confusion nor need to apologize -- I'm in fact very glad that someone else but just me checks these code paths! In this case, though, I do not see a path leading to something other than the loading of a digest. And that must be fulfilled by something other than
oqsprovider
(default or fips provider, notably -- whatever is loaded into the NULL/default libctx). If you see a path to something different, please let me know (where): Thanks in advance!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.
My point is that the property query passed to the
EVP_DigestSignInit_ex
(or analogue for Verify) is not only used for the query properties of the digest (which, of course, should not be fetched fromoqsprovider
), it is also employed in the underlyingEVP_PKEY_CTX *
of theEVP_MD_CTX *
to use (see here), and if the property queryprovider=oqsprovider
is desired on that EVP_PKEY_CTX * (like, for example, is employed in the "analogue" for Encapsulation/Decapsulation in KEMs (e.g. here), then there would indeed be a "problem". But I'm sure there is a reason why on that particularEVP_PKEY_CTX *
the requirement ofprovider=oqsprovider
is not needed.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.
Well, I'm not so sure now as your argument looks plausible. The only "reason" I see is that tests of this logic within the feature branch with standardized PQC algs passed that didn't pass before. Unfortunately, due to another problem with ML-DSA all tests are breaking now and I think it is best to wait with further work until the feature/ml-dsa branch is functionally far enough to serve as guidance for an update of
oqsprovider
with regard to theopenssl
naming.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.
I agree. I imagine is not a problem now, but it could be once the
default
provider has an implementation of the same signature algorithm as the one someone would be working with onoqsprovider
(like it will soon happen).Additionally, on a (quick) look, if you interpret the underlying OpenSSL procedure
do_sigver_init
, it seems like it does not account for the hypothetical of having different providers for thepkey
operation and the digest to employ (if different providers have both implementations of one of them), since are both being impacted from the same property query, and this could potentially be used to restrict from which to take each implementation.And I imagine there is little
oqsprovider
could do on that regard, as you cannot avoid the prop query received (since it might be any other thing likefips
, etc...). The only possibility I see would maybe be to have anOSSL_PARAM
for this fact, but even with that,do_sigver_init
is using the samepropq
for two different purposes (which now, since they are maintaining some legacy code, is not a failure (the hash will be fetch with adigestByName
approach) but it might be in the future.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.
"?provider=oqsprovider"
query could be used in this case to prefer the algorithm implementation from oqsprovider if available there.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.
In this scenario I agree that this would solve the problem: since oqsprovider does not have any digest implementation, the digest fetch would be done via the
default
provider, while thepkey
operation would be given priority tooqsprovider
.What I was pointing out is that
openssl
code would not account for the existance of two providers both of which have an implementation of the same digest andpkey
operation to be used since they are both affected from the same property queries, but (in the case that is of interest) it is not a matter ofoqsprovider
in any case.