Skip to content

Decouple gost_omac_acpkm from gost_grasshopper #519

Merged
chipitsine merged 1 commit intogost-engine:masterfrom
Mironenko:new-separate-modules
Mar 11, 2026
Merged

Decouple gost_omac_acpkm from gost_grasshopper #519
chipitsine merged 1 commit intogost-engine:masterfrom
Mironenko:new-separate-modules

Conversation

@Mironenko
Copy link
Contributor

This PR extracts the CMAC-ACPKM and grasshopper modules from the gost-core since they do not depend on it. This is part of addressing #496.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR decouples the CMAC-ACPKM implementation and Grasshopper core implementation from gost-core by moving CMAC-ACPKM into a standalone module and splitting Grasshopper into a separate static library, supporting the broader OpenSSL 4.0 migration work tracked in #496.

Changes:

  • Extracted CMAC-ACPKM logic into new gost_cmac_acpkm.[ch] and updated OMAC-ACPKM to use it.
  • Refactored Grasshopper build inputs and created a dedicated gostgrasshopper static library.
  • Updated build system to link gost_core against the new gostcmacacpkm and gostgrasshopper libraries.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
gost_omac_acpkm.c Switched to using the extracted CMAC-ACPKM module header/API.
gost_grasshopper.h Reduced header coupling by removing an internal cipher include.
gost_cmac_acpkm.h Introduced the new CMAC-ACPKM module public header/API.
gost_cmac_acpkm.c Added extracted CMAC-ACPKM implementation (now shared).
CMakeLists.txt Added gostcmacacpkm/gostgrasshopper targets and linked them into gost_core.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -0,0 +1,295 @@
#include "string.h"
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file includes the standard header as #include "string.h", while the rest of the codebase consistently uses angle brackets for standard headers. Using <string.h> avoids accidental inclusion of a local string.h and matches existing conventions.

Suggested change
#include "string.h"
#include <string.h>

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I chose not to put this sources in separate file.

After this commit:
* there is no direct access to `cipher_gost_grasshopper_ctracpkm` or
  `cipher_gost_magma_ctracpkm`
* `gost_omac_acpkm.c` no longer depends on the `gost_grasshopper*`
  sources
* the `CMAC_ACPKM_CTX_*` function family works with both the ENGINE and
  the PROVIDER implementations of the CTR-ACPKM ciphers
@Mironenko Mironenko force-pushed the new-separate-modules branch from 84635fa to 0721ccd Compare March 11, 2026 16:04
@Mironenko Mironenko changed the title Extract CMAC ACPKM and grasshopper implementation into a separate independent modules Decouple gost_omac_acpkm from gost_grasshopper Mar 11, 2026
@Mironenko
Copy link
Contributor Author

@chipitsine, I narrowed the scope of this PR. The changes are not strictly necessary, but they make it easier to track subsequent changes.

@chipitsine chipitsine merged commit e31e59e into gost-engine:master Mar 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants