-
Notifications
You must be signed in to change notification settings - Fork 491
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
Update copy_from_pqclean / copy_from_upstream #883
Conversation
a99bb80
to
45a5aa6
Compare
Some more tweaks:
|
First impression: Looks good. I assume you also already tested this after importing the current upstreams? Could you/did you run CCI local (say, I'd further recommend ticking the checkboxes as a way to warn us that running this script will necessitate a new version id: New algs (dil5) and new naming is introduced with this. |
Thanks for the feedback. I edited the checkboxes to clarify that they apply after the script is run with the proposed configuration. CCI local ( |
Very much agreed.
Very good. Although, @dstebila : Would you (agree to) add @bhess to the access group for running CCI? |
I am still checking a few issues with the new upstreams when building liboqs as a shared library, especially if the upstream uses common code under the same namespace. It could make sense to let the upstreams define what their common code is, and to build this part separately. For common code such as AES, FIPS202, etc., I see that liboqs provides common code and shim API for pqclean, which is nice. Perhaps these shims could be extended to support other upstreams if necessary. |
Yes, ideally we'd shim all the common code on to liboqs providers (which in some cases pass through to OpenSSL). |
cb9a652
to
cdd8c35
Compare
I've pushed another commit that adds the possibility to declare common code used across implementations in an upstream location. This will avoid issues with duplicate symbols if the code is replicated for each implementation. It also reduces code duplication in the imported sources. I think that ideally, common code would be provided centrally by liboqs as shims. But I also see that can be beneficial for upstreams to define their own common code without having to change the liboqs core code (shims). So I see this as complementary to the code provided in An example for pqcrystals-dilithium: The upstream can define a .yml-file to define common code. This file is defined in a field
The
The implementation .yml can then define its dependencies:
In this case, CMake definitions for the common code will be added to
The if-guard ensures that the common code is only compiled if an implementation is selected that uses it. Note: for now the pqcrystals upstream-locations in copy_from_upstream.yml point to my fork. Running copy_from_upstream should be functional with this configuration, local circleci builds run fine with the imports. I will open a PR to pqcrystals after feedback here. |
Upstream common code does make sense. It both allows code-sharing and (e.g., CPU feature) optimization to be done across several algorithms and further can help reduce the number of runtime portability guards. Using the same .yml definition mechanism also eases understanding and further re-use. It would be ideal if the goal for such code would be to eventually be of interest to more QSC algorithms than one "family" (say pqcrystals); if you'd agree, I'd then suggest such common upstream code to follow both contributing standards: Those for new algorithms and those for OQS common code. |
I'm not sure if the "OQS common code" standards are easy to ensure with the automatic import, especially the code formatting rules. Would the following make sense? the OQS common code and new algorithms standards should apply to code contributed to |
I'm a bit confused here. Are you talking about having different implementations of AES, SHA, ... in |
The current wording for common code (requirements) explicitly refers only to stuff in |
Sorry if there was a confusion. I only refer to common code pulled into subdirectories of |
* Renames copy_from_pqclean to copy_from_upstream. * Adds 'upstreams' field to copy_from_upstream.yml, allowing to specify upstream repositories, branches and commits. * Modifies "copy" command in copy_from_upstream: sources are pulled from specified git-repositories. Implementation folders in $LIBOQS_DIR/src will be prefixed with the upstream-name. * Adds "verify" command in copy_from_upstream: Implementations in $LIBOQS_DIR/src are compared with expected upstream versions. * Prepares for copying pqclean, pqcrystals-kyber and pqcrystals-dilithium from upstream. * Updates copy_from_upstream to process common dependencies from an upstream.
cdd8c35
to
5953651
Compare
Squashed the commits. In the current state, it is ready to pull from pqclean, pqcrystals-kyber and pqcrystals-dilithium. |
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.
LGTM -- particularly considering the "test" via #891
Updates copy_from_pqclean / copy_from_upstream (#880)
Renames copy_from_pqclean to copy_from_upstream.
Adds 'upstreams' field to copy_from_upstream.yml, allowing to specify upstream repositories, branches and commits.
Modifies "copy" command in copy_from_upstream: sources are pulled from specified git-repositories. Implementation folders in $LIBOQS_DIR/src will be prefixed with the upstream-name.
Adds "verify" command in copy_from_upstream: Implementations in $LIBOQS_DIR/src are compared with expected upstream versions. Implementations that differ from upstream will be hightlighted.
Prepares for copying pqclean, pqcrystals-kyber and pqcrystals-dilithium (Round 3 versions) from upstream.
How to use copy_from_upstream:
Assumed that pqclean_saber_avx2 differs from upstream, the output will be as follows:
If any verification failed, the script returns with an exit code (1).
-> This PR doesn't tick the two boxes above, but after running ./copy_from_upstream, the two boxes will be ticked because of new Dilithium Round 3 schemes.