Skip to content

shim: set GOST engine as default if selected#28

Merged
oleg-jukovec merged 2 commits into
tarantool:masterfrom
Col-Waltz:Col-Waltz/add-gost-engine-init
Jul 17, 2026
Merged

shim: set GOST engine as default if selected#28
oleg-jukovec merged 2 commits into
tarantool:masterfrom
Col-Waltz:Col-Waltz/add-gost-engine-init

Conversation

@Col-Waltz

@Col-Waltz Col-Waltz commented Jul 16, 2026

Copy link
Copy Markdown

In the latest release optional static linking of the GOST engine was added.
However, when openssl_gost is enabled we only call ENGINE_load_gost() and verify that the engine is present, but we never initialize it nor set it as default.

As a result, OpenSSL continues to use the built-in default methods for PKEY/ASN.1 operations, which do not support GOST key/certificate formats. This breaks PEM key/certificate loading (and other operations that rely on PKEY/ASN.1 methods).

Example failure: https://github.com/tarantool/go-openssl/actions/runs/29503272983/job/87637409141

This change initializes the GOST engine and sets it as default for PKEY/ASN.1 methods when openssl_gost is enabled, restoring correct PEM encoding/decoding and related functionality.

@Col-Waltz
Col-Waltz force-pushed the Col-Waltz/add-gost-engine-init branch from 1ecb2b0 to 864656c Compare July 16, 2026 13:41
@Col-Waltz Col-Waltz changed the title test: regression test for gost engine shim: set GOST engine as default if selected Jul 16, 2026
@Col-Waltz
Col-Waltz requested review from bigbes and oleg-jukovec July 16, 2026 14:11
@Col-Waltz
Col-Waltz force-pushed the Col-Waltz/add-gost-engine-init branch from efe3bcd to f4203be Compare July 16, 2026 14:13

@oleg-jukovec oleg-jukovec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for the patch. See above.

Please, add a CHANGELOG.md entry too.

Comment thread shim.c Outdated
Comment thread shim.c
Comment thread gost-certs/client.crt Outdated
Comment thread gost-certs/client.key Outdated
Comment thread gost_test.go Outdated
Comment thread gost_test.go Outdated
Comment thread gost_test.go Outdated
Comment thread gost-certs/client.crt Outdated

@bigbes bigbes left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's put test fixtures in its own subfolder: testdata/gost/ - it'll signalize that this files are test data.

Comment thread gost_test.go Outdated
Add openssl_gost tests that load a GOST private
key/certificate from PEM using the public Go API.
@Col-Waltz
Col-Waltz force-pushed the Col-Waltz/add-gost-engine-init branch from f4203be to 95e340d Compare July 16, 2026 21:54
@Col-Waltz
Col-Waltz requested review from bigbes and oleg-jukovec July 16, 2026 21:59
Comment thread CHANGELOG.md Outdated
If GOST engine is selected in static build it should be
initialized and set as default with flags to perform
PKEY/ASN1 methods and PEM decoding for GOST private keys.
@Col-Waltz
Col-Waltz force-pushed the Col-Waltz/add-gost-engine-init branch from 95e340d to 6b5f158 Compare July 17, 2026 07:11
@Col-Waltz
Col-Waltz requested a review from oleg-jukovec July 17, 2026 07:11
@oleg-jukovec
oleg-jukovec merged commit 81e9ae3 into tarantool:master Jul 17, 2026
10 checks passed
@oleg-jukovec oleg-jukovec mentioned this pull request Jul 17, 2026
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