Add MQOM#2361
Conversation
baentsch
left a comment
There was a problem hiding this comment.
Hi @rben-dev -- thanks very much for bringing up this PR. For starters, could you please fix up the DCO error message as per CI help messages? I also triggered the other CI jobs to see how things look like before taking a deeper look into your contribution.
|
Hi @baentsch, Thank you very much for your prompt reply and help. The DCO issue should be resolved. However, from the CI failures:
The local CI on my fork was happy with the original commits, although not performing these basic checks for some unkown reason ... I am really sorry if I have missed something obvious here. Thanks in advance, |
|
For completeness regarding the supported platforms flag, I actually inspired my META
I guess the issue might lie within the fact that the MQOM META provides two generic implementations that can run on all platforms, hence an ambiguity about the default implementation? Then, how is it possible to include two such generic implementations leaving the choice of the one included in the compiled lib to the user at compilation time? |
|
Thanks for the contribution @rben-dev!
Both CI failures are related to the same, liboqs assumes that there is a single portable implementation. I've opened draft PR #2367 which adds explicit support for memory-optimized implementations, and fixes the CBOM issue. The change is that an implementation can now be declared as memory-optimized by adding Feel free to rebase on top of #2367, with |
7dff17f to
d0400cc
Compare
|
Hi @bhess, Thank you very much for this PR, adding the new I have updated the current PR with a rebase, my local tests seem to confirm that the MQOM memopt variant compiles well. Now hoping that the full CI passes. Regards, |
|
It seems that the basic-checks / Check upstream code is properly integrated fails. This might be due to the fact that I have manually reformatted the generated files Any idea on how to deal with this code formatting issue in the CI without breaking one of these two checks? Thanks in advance, |
|
Thanks for the update @rben-dev.
It seems the templating code in #2367 formats the memory‑optimized code incorrectly. I’ve updated #2367 with a fix. Feel free to sync your PR with it. |
|
Thanks @bhess for the formatting fix in the generated code! |
|
Hi @bhess, The Zephyr build seems to be the only one failing in the CI, and this is for a good reason as I forgot to add MQOM there. I made an attempt for this, but this raises a question:
Please correct me if I have missed some magical options to activate to deal with this. Another temporary solution to advance the PR would be to completely deactivate MQOM for Zephyr. Thanks in advance for your help with this, |
To me, this sounds like a reasonable default for an embedded target like Zephyr. Perhaps @Frauschi has an opinion on this, as they integrated the Zephyr build? |
Yeah, sounds reasonable to me, too. At the time I wrote the Zephyr port, |
|
Thanks for the feedback @bhess and @Frauschi :
I do not know how to deal with this last point in the most efficient way:
Thanks in advance for your advice and guidance with this, |
|
I created a PR to fix the Zephyr CI problems (#2369). As version 3.4.0 has been EOL for a long time, we can safely drop it. Instead, the latest version (4.3.0) should be added to the CI tests. This should hopefully resolve your issues, too. |
I agree.
Great, thanks for this PR! |
|
Same as in PR #2369, the Zephyr CI now passes with MQOM but for unknown reason the coverage tests are now failing ... |
|
@bhess: one point that can be of interest for the future PR (if I did not miss something). I had to comment this line in the When commented, everything else was fine (except for the compilation step of course because of the discussed |
I’ve added draft PR #2382 implementing this functionality. For usage examples, see https://github.com/bhess/MAYO-C/blob/bhe-oqscommon/META/COMMONS.yml and https://github.com/bhess/MAYO-C/blob/bhe-oqscommon/META/MAYO-1_META.yml. |
5e5753d to
d7f8302
Compare
|
@bhess : thanks for the PR, this seems to work :-) I have pushed an attempt to use this in my last commit rebased on your PR #2382, hoping that the CI still passes. By the way, beware that there is still an issue in: in verbose mode (which is why CI might not hit this error): EDIT: in order to avoid all the history with all the unwanted files, I have force pushed a "clean" import above the rebased PR. |
18b6556 to
2fcf9cc
Compare
Thanks for trying this, reducing the change from over 2000 files down to just 144 additions is a great improvement. I’ve also removed the offending line in the script. |
|
Hi, Thanks for the feedback, the reduction in the number of files is great. Regards, |
Signed-off-by: Basil Hess <bhe@zurich.ibm.com>
Add CMake option/oqsconfig define, docs, and template support so implementations tagged `memory_optimized: true` in upstream META.yml are built & preferred when the flag is ON. Copy‑from‑upstream scripts adjusted accordingly and CI matrix extended. Updates CBOM generation to avoid collisions in the bom-ref if there are multiple generic builds. [full tests] Signed-off-by: Basil Hess <bhe@zurich.ibm.com>
Signed-off-by: Basil Hess <bhe@zurich.ibm.com>
Signed-off-by: Basil Hess <bhe@zurich.ibm.com>
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
xuganyu96
left a comment
There was a problem hiding this comment.
Thank you for the file de-duplication efforts. This pull request is so much cleaner and easier to review!
I have one remaining concern: it looks like there are some stale diff's from an older pull request that got mixed into your pull request (see individual comments for some examples, though they might not be complete). I tried rebasing your branch on top of main, but these diffs persisted. Could you please check the commit history? Alternatively, you can re-run copy_from_upstream.py from a clean copy of main, then do a force-push to this branch (or raise a new pull request).
| steps: | ||
| - name: Init Zephyr workspace | ||
| run: | | ||
| mkdir -p zephyr/manifest && cd zephyr/manifest |
There was a problem hiding this comment.
This looks like a stale commit from an older pull request.
| return dup; | ||
| #else | ||
| return strdup(str); // IGNORE memory-check | ||
| size_t len = strlen(str) + 1; |
There was a problem hiding this comment.
This also looks like a stale commit from the same older pull request
|
Sorry if things got mixed with all the other PRs and rebasing ... |
This PR adds the MQOM signature scheme. MQOM is part of on-ramp Round 2 NIST candidates, In order to avoid too many variants that would overload the library, we only provide implementations for GF(16) MQOM fast and short (with 3 or 5 rounds), as this is the best choice for a speed and signature size balance.
Three implementation profiles are integrated to
liboqs:AVX2: this makes use of AVX2 and AES-NI extensions, suited for modern amd64 platforms.default: this is a portable implementation suitable for most desktop-like platforms (e.g. arm64 Mac M1, etc.)memopt: this is a portable implementation with memory optimizations that are more suitable for platforms with stringent memory constraints (e.g. embedded platforms or targets with small stacks, etc.)Here are some notable elements for this MQOM integration:
liboqsAPI for this.liboqsAPI for this. However, for security levels 3 and 5 Rijndael-256-256 is used, and hence we had to provide local implementations for this (see in the rijndael/ folder upstream).AVX2anddefaultimplementations:--max-stackframe=20480000tovalgrindas discussed in issue Maximum stack usage for valgrind "leak test" #2360 : without this the CI tests fail with false positives. The strategy for this fix can be of course discussed. The fix is part of the PR.Many elements of this PR have been produces with the
copy_from_upstream.pyautomation (thanks for this): I only had to format withastylethe produced files insrc/sig/mqom/root.Thanks in advance for considering the inclusion of MQOM in the library, as we believe this can be useful for exploring on-ramp candidates. Please do not hesitate if anything is wrong or missing!