Skip to content

Add derive on GOSTR-3410-2012#3577

Draft
AktivCoAndreyTimofeev wants to merge 1 commit intoOpenSC:masterfrom
AktivCo:gost-derive-key
Draft

Add derive on GOSTR-3410-2012#3577
AktivCoAndreyTimofeev wants to merge 1 commit intoOpenSC:masterfrom
AktivCo:gost-derive-key

Conversation

@AktivCoAndreyTimofeev
Copy link
Copy Markdown
Contributor

  • Add reading GOSTR-3410-2012 public key
Checklist
  • Documentation is added or updated
  • New files have a LGPL 2.1 license statement
  • PKCS#11 module is tested
  • Windows minidriver is tested
  • macOS token is tested

@popovec
Copy link
Copy Markdown
Member

popovec commented Feb 19, 2026

One comprehensive note, not just for this PR.

I would not like to use deprecated functions in OpenSC code anymore. Sooner or later the "openssl engine" will become unusable and everything will need to be rewritten to the provider API. Given that openssl 4.0 will no longer support "engine", I recommend not using any patches that depend on the openssl engine anymore. (Please note that openssl has already deprecated the engine API in version 3.0)

@AktivCoAndreyTimofeev
Copy link
Copy Markdown
Contributor Author

We are currently developing a provider with support for GOST algorithms.
As soon as it is ready, this code will be fixed.
The current work with engine is a temporary measure.

}
}

read_binary_file(opt_input, &file_buf, &file_len);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are already options --salt-file and --input-file for pkcs11-tool.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the note — I understand the concern about adding yet another file option when pkcs11-tool already provides --input-file and --salt-file.

Just to confirm I got your point right: you’re suggesting we should reuse the existing --input-file for the peer public key and reuse --salt-file for the UKM/salt, instead of introducing any new dedicated options for this feature.

In the current version of the patch that’s exactly what I did: GOSTR3410-12 derive reads the peer key from --input-file and requires UKM via --salt-file, and I updated the help text to reflect the dual use of --salt-file (HKDF salt / GOST UKM). If you’d prefer different semantics or naming (e.g., stricter validation or a different help wording), I’m happy to adjust.


#if defined(__clang__) || defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we want to disable the deprecation warnings just to support a temporary solution. Please have a look at sc_pkcs11_register_openssl_mechanisms() from src/libopensc/openssl.c if you can reuse the gost initialization.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll pay attention to that.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the review. Your comments have been taken into account, and the corresponding changes have been incorporated into the codebase.

@frankmorgner frankmorgner marked this pull request as draft February 20, 2026 12:00
@AktivCoAndreyTimofeev AktivCoAndreyTimofeev force-pushed the gost-derive-key branch 2 times, most recently from fbdb2d9 to 14408ce Compare March 18, 2026 12:21
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.

4 participants