-
Notifications
You must be signed in to change notification settings - Fork 55
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
FIx some PQC issues. #2131
FIx some PQC issues. #2131
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2131 +/- ##
==========================================
+ Coverage 76.88% 76.89% +0.01%
==========================================
Files 193 193
Lines 36982 36976 -6
==========================================
Hits 28432 28432
+ Misses 8550 8544 -6
☔ View full report in Codecov by Sentry. |
@falko-strenzke what do you think about this solution on hiding PQC/v6 calls from the FFI API? |
First of allo sorry for the delayed relpy. |
@falko-strenzke Thanks for the reply. It's actually simpler, CMake will set those variables automatically and include into the |
@maxirmx @ribose-jeffreylau Could you please review this? Thanks! |
src/lib/rnp.cpp
Outdated
@@ -70,6 +70,13 @@ | |||
RNP_LOG_FD(fp, __VA_ARGS__); \ | |||
} while (0) | |||
|
|||
#if defined(RNP_EXPERIMENTAL_CRYPTO_REFRESH) && !defined(ENABLE_CRYPTO_REFRESH) |
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.
(This is a suggestion to consider)
IMHO it will be much easier to support a single flags
Something like this:
#include <iostream>
// Defintion of CRYPTO_REFRESH options
#define ENABLE_CRYPTO_REFRESH 0
#define ENABLE_EXPERIMENTAL_CRYPTO_REFRESH 1
#define DISABLE_CRYPTO_REFRESH 2
// Selection of CRYPTO_REFRESH option
#define RNP_CRYPTO_REFRESH RNP_CRYPTO_REFRESH
int main(int, char**)
{
#if RNP_CRYPTO_REFRESH == ENABLE_CRYPTO_REFRESH
std::cout << "ENABLE_CRYPTO_REFRESH" << std::endl;
#elif RNP_CRYPTO_REFRESH == ENABLE_EXPERIMENTAL_CRYPTO_REFRESH
std::cout << "ENABLE_EXPERIMENTAL_CRYPTO_REFRESH" << std::endl;
#else
std::cout << "DISABLE_CRYPTO_REFRESH (" << RNP_CRYPTO_REFRESH << ")" << std::endl;
#endif
return 0;
}
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.
@maxirmx Thanks for noticing this, but it's suggested to work in a bit different way: both defines are for the same purpose, and this check is to make sure that they are in sync. The problem here is that one goes to the config.h.in
, which is not installed and used only during compilation, and second is needed to be installed and used by another installed header rnp.h
. This is needed to hide some function declarations from the rnp.h
. So it's not the best solution, but I didn't find any better idea. Maybe you have some suggestion?
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.
If it is a check that both defines are in sync I guess it shall be
#if defined(RNP_EXPERIMENTAL_CRYPTO_REFRESH) != defined(ENABLE_CRYPTO_REFRESH)
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.
@maxirmx Indeed, thanks! Re-pushed.
@@ -70,6 +70,13 @@ | |||
RNP_LOG_FD(fp, __VA_ARGS__); \ | |||
} while (0) | |||
|
|||
#if defined(RNP_EXPERIMENTAL_CRYPTO_REFRESH) && !defined(ENABLE_CRYPTO_REFRESH) | |||
#error "Invalid defines combination." |
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.
(This is a suggestion to consider)
Pls refer to the note about CRYPTO_REFRESH flags
1d66cc5
to
9fa19a4
Compare
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.
Not a C expert so nothing to add...
9fa19a4
to
3824009
Compare
Merging as it has 2 approvals and green CI. |
Among other minor issues this PR adds RNP_EXPERIMENTAL_* defines to the rnp_export.h header, allowing to cut-off by default yet experimental features. Probably better solution would be to remove those function calls from the header at all, however don't see good solution for that at the moment.