Skip to content

Introduce standalone gost_digest adaptor for provider#515

Merged
chipitsine merged 3 commits intogost-engine:masterfrom
Mironenko:dgst2
Mar 4, 2026
Merged

Introduce standalone gost_digest adaptor for provider#515
chipitsine merged 3 commits intogost-engine:masterfrom
Mironenko:dgst2

Conversation

@Mironenko
Copy link
Contributor

This PR addresses the digest-related part of issue #505.

It introduces a new family of gost_digest* source files implementing an adapter layer over gosthash and gosthash2012.

The adapter is used by gost_prov_digest and removes its dependency on engine-specific code.

In the future, the gost_digest* implementation may also replace gost_md / gost_md2012 in the engine backend.

This PR also fixes test_digest to correctly test the provider implementation. Prior to this change, test_digest invoked the engine-based digest implementation in both test-digest-engine and test-digest-provider, so the provider code path was not actually tested.

Ensure that test_digest validates which implementation
(engine or provider) is actually being exercised.
Before this commit, test_digest invoked the engine-based digest
implementation in both test-digest-engine and test-digest-provider,
so the provider path was not actually exercised.
Add a new family of gost_digest* source files that implement
an adaptor layer over gosthash and gosthash2012.

This adaptor is used by gost_prov_digest and removes the
dependency of gost_prov_digest on engine-specific code.

In the future, the gost_digest* implementation may also
replace gost_md/gost_md2012 in the engine backend.
@chipitsine chipitsine merged commit 1a4071e into gost-engine:master Mar 4, 2026
12 checks passed
@chipitsine
Copy link
Contributor

does not look severe, but ...

*** CID 644776:         Resource leaks  (RESOURCE_LEAK)
/test_digest.c: 896             in do_synthetic_once()
890     
891         EVP_MD *dgst;
892         T((dgst = EVP_MD_fetch(NULL, tv->algname, NULL))
893           || (dgst = (EVP_MD *)EVP_get_digestbyname(tv->algname)));
894         if (dgst && warn_md_impl_is_expected(dgst)) {
895             EVP_MD_free(dgst);
>>>     CID 644776:         Resource leaks  (RESOURCE_LEAK)
>>>     Variable "ibuf" going out of scope leaks the storage it points to.
896             return 1;
897         }
898     
899         OPENSSL_assert(EVP_MD_is_a(dgst, tv->algname));
900         EVP_MD_CTX *ctx, *ctx2;
901         T(ctx  = EVP_MD_CTX_new());

@Mironenko Mironenko deleted the dgst2 branch March 5, 2026 08:33
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.

2 participants