Richard Levitte [Tue, 31 Aug 2021 18:32:55 +0000 (20:32 +0200)]
Add CI builds on MacOS 11 (BigSur)
Richard Levitte [Sun, 29 Aug 2021 07:41:32 +0000 (09:41 +0200)]
Update openssl-3.0.0-alpha17 -> openssl-3.0.0-beta2 for codeql as well
Dmitry Belyavskiy [Thu, 19 Aug 2021 13:34:06 +0000 (15:34 +0200)]
Increase cmake version to 3.18
Dmitry Belyavskiy [Thu, 19 Aug 2021 12:55:19 +0000 (14:55 +0200)]
Stop overriding OPENSSL_LIBRARIES
Fix #346
Richard Levitte [Wed, 18 Aug 2021 07:12:40 +0000 (09:12 +0200)]
Switch to using OpenSSL target names in CMakeLists.txt
Cmake 3.0 was a switch to using targets and properties rather than
variables when linking different components together.
We follow that philosophy by dropping ${OPENSSL_CRYPTO_LIBRARIES} and
${OPENSSL_SSL_LIBRARIES} in favor of OpenSSL::Crypto and OpenSSL::SSL.
Richard Levitte [Tue, 17 Aug 2021 20:35:09 +0000 (22:35 +0200)]
Reduce the repeated library dependence information
Cmake is generally good at tracking specified dependencies between
libraries. All that we need to do is to establish a dependency on
OpenSSL's libcrypto for 'gost_core', and then we can reduce the amount
of repeated dependencies for everything that links against 'gost_core'.
Richard Levitte [Tue, 17 Aug 2021 20:31:39 +0000 (22:31 +0200)]
Make CMakeLists.txt work better with static OpenSSL libraries
The static OpenSSL libraries have some dependencies that need to be
recorded fofr everything that's linked against it. To achieve this,
we use ${OPENSSL_CRYPTO_LIBRARIES} and ${OPENSSL_SSL_LIBRARIES}
instead of ${OPENSSL_CRYPTO_LIBRARY} and ${OPENSSL_SSL_LIBRARY}.
Billy Brumley [Mon, 9 Aug 2021 19:57:47 +0000 (22:57 +0300)]
push VKO cofactor clearing into ECCKiila
Billy Brumley [Mon, 9 Aug 2021 19:57:15 +0000 (22:57 +0300)]
[test] VKO unit tests for curves with cofactors: extreme ranges
Dmitry Belyavskiy [Wed, 11 Aug 2021 13:10:00 +0000 (15:10 +0200)]
Explicitly set libdir to lib
OpenSSL commit https://github.com/openssl/openssl/commit/
74b7f339aa58af57c0e71b7efca66e6f2db5ae2e
changed the default installation path on 64-bit systems.
The recommended workaround is appending --libdir=lib
Dmitry Belyavskiy [Tue, 10 Aug 2021 16:18:45 +0000 (18:18 +0200)]
Stable: alpha16 => beta2
Dmitry Belyavskiy [Wed, 2 Jun 2021 15:16:12 +0000 (17:16 +0200)]
CMake 3.18 recommended
More earlier versions don't properly detect OpenSSL 3.0.
BTW, workarounds still exist
Dmitry Belyavskiy [Fri, 28 May 2021 11:10:12 +0000 (13:10 +0200)]
Merge branch 'levitte-update-codeql-analysis'
Dmitry Belyavskiy [Fri, 28 May 2021 11:09:07 +0000 (13:09 +0200)]
Merge branch 'update-codeql-analysis' of https://github.com/levitte/engine into levitte-update-codeql-analysis
Richard Levitte [Wed, 12 May 2021 12:09:49 +0000 (14:09 +0200)]
Set OPENSSL_ROOT_DIR if it isn't set.
These days, the OpenSSL cmake package finder is capable of finding
a custom OpenSSL installation with no OPENSSL_ROOT_DIR defined, but
CMAKE_PREFIX_PATH defined.
However, gost-engine's CMakeLists.txt does use OPENSSL_ROOT_DIR, so
it needs it to be defined unconditionally. That's arranged fairly
easily by assigning it the parent directory of OPENSSL_INCLUDE_DIR.
Dmitry Belyavskiy [Fri, 28 May 2021 11:02:16 +0000 (14:02 +0300)]
Merge branch 'master' into update-codeql-analysis
Richard Levitte [Fri, 28 May 2021 10:23:14 +0000 (12:23 +0200)]
Update the OpenSSL 3.0 tag to openssl-3.0.0-alpha17
Most of all, at least openssl-3.0.0-alpha16 is needed, because there
are API changes made in that release that affects gost-engine builds
Dmitry Belyavskiy [Sun, 23 May 2021 09:05:01 +0000 (11:05 +0200)]
Increase openssl version
Richard Levitte [Tue, 11 May 2021 08:27:37 +0000 (10:27 +0200)]
Adapt C flags for the cmake build type
The C flags were set to be highly optimized regardless of the cmake
build type. This may make debugging difficult. To resolve that, we
adapt the C flags to the cmake build type in a supported manner.
Dmitry Belyavskiy [Tue, 11 May 2021 10:58:29 +0000 (12:58 +0200)]
Alpha version bump
Dmitry Belyavskiy [Fri, 30 Apr 2021 16:38:48 +0000 (18:38 +0200)]
Update to be compatible with openssl#15100
(cherry picked from commit
1b684f3f906bc81154ca1d5af7d6bc60199f1f9c)
Richard Levitte [Sat, 1 May 2021 06:42:31 +0000 (08:42 +0200)]
Mark test_keyexpimp and gost89 as internal tests
Richard Levitte [Sat, 1 May 2021 06:41:42 +0000 (08:41 +0200)]
Don't load the gost engine in test_curves.c
This test is so internal that it doesn't even need the engine.
Richard Levitte [Sat, 1 May 2021 06:36:55 +0000 (08:36 +0200)]
Make test programs less hard-coded
The following programs had a hard coded load of the gost engine.
This changes them to rely more on the testing environment, and to
load engines through configuration files.
This affects: test_ciphers.c, test_context.c, test_derive.c,
test_digest.c, test_params.c, test_sign.c, test_tls.c
se-prok [Fri, 2 Apr 2021 07:51:28 +0000 (10:51 +0300)]
Update gost_ec_keyx.c
It's not right to have segmentation faults.
Richard Levitte [Tue, 30 Mar 2021 18:40:37 +0000 (20:40 +0200)]
Don't put test results or intermediary files in the source tree
When building in a directory that's separate from the source
directory, test results should end up in the build directory, not the
source directory.
Essentially, unless you do build in the source directory, it should be
regarded as read-only when building.
Richard Levitte [Tue, 30 Mar 2021 18:47:16 +0000 (20:47 +0200)]
Install manuals in the correct location
Cmake doesn't support the variable CMAKE_INSTALL_DIR. However, with
the GNUInstallDirs module, there is the variable CMAKE_INSTALL_MANDIR.
Richard Levitte [Tue, 30 Mar 2021 19:53:38 +0000 (21:53 +0200)]
.github/workflows/codeql-analysis.yml: Bump the OpenSSL version
From 3.0.0-alpha6 to 3.0.0-alpha13, mostly for Analysis to avoid
getting failures when compiling, considering that the GOST source has
adapted for the latter version.
Sergei Lemeshkin [Wed, 17 Mar 2021 12:28:30 +0000 (15:28 +0300)]
Make it compatible with cmake versions lower than 3.14, specify explicitly destination paths
Dmitry Belyavskiy [Wed, 17 Mar 2021 13:41:20 +0000 (14:41 +0100)]
OpenSSL version bump
Dmitry Belyavskiy [Wed, 3 Mar 2021 15:04:49 +0000 (16:04 +0100)]
EVP_MAC_init API changed
Richard Levitte [Mon, 22 Feb 2021 05:08:55 +0000 (06:08 +0100)]
Always cNORM before "\n"
Using cNORM after "\n" may or may not work, probably because of the
line buffered nature of standard output.
If an error is displayed immediately after a printf that has cNORM
after "\n", the error output sometimes "overrides" the cNORM, and you
may end up with a surprisingly colorful error message, not to mention
that this may also affect your prompt in the same manner.
The lesson is to always output cNORM before the ending "\n".
Richard Levitte [Sun, 21 Feb 2021 16:32:47 +0000 (17:32 +0100)]
Modify installation instructions for gost-engine library and module
- Simplify the installation of libraries and programs to simply use
defaults.
- Install only the gost engine in module form into the OpenSSL engine
directory.
- Install the gostsum and gost12sum manuals in the normal man1 directory,
as there's really no reason to install them among OpenSSL stuff
specifically.
- Install the cmake configuration file.
Richard Levitte [Wed, 17 Feb 2021 18:01:19 +0000 (19:01 +0100)]
Also build gost-engine in library form
In this form, the GOST engine isn't loadable through OpenSSL's dynamic
ENGINE loader, but directly as its own function, ENGINE_load_gost().
After making that call, the engine functionality can be used as usual.
This includes a public header file called gost-engine.h, which declares
that functions.
This also rearranges the code in gost_eng.c, as the binding
functionality was spread around in the file. Now, it's all nicely
tucked at the end.
Dmitry Belyavskiy [Sat, 20 Feb 2021 17:49:30 +0000 (18:49 +0100)]
All tests are passing
Dmitry Belyavskiy [Sat, 20 Feb 2021 12:41:59 +0000 (15:41 +0300)]
Avoid some buffer overflows
Dmitry Belyavskiy [Wed, 17 Feb 2021 18:37:42 +0000 (19:37 +0100)]
OpenSSL version bump: alpha8 => alpha11
Richard Levitte [Wed, 17 Feb 2021 06:38:17 +0000 (07:38 +0100)]
Build gcc-asan-openssl-master on MacOS X as well
Richard Levitte [Wed, 17 Feb 2021 05:07:20 +0000 (06:07 +0100)]
Fix gost engine suffix (for MacOS X)
On MacOS X, OpenSSL and cmake have different ideas on what suffix a
dynamically loadable module should have. OpenSSL expects .dylib,
while cmake uses .so by default.
Fixed by explicitly telling cmake to use the same suffix as for shared
libraries.
Richard Levitte [Sun, 14 Feb 2021 20:53:02 +0000 (21:53 +0100)]
Remove the use of test/run_tests in favor of 'prove'
'prove' is a well developed TAP harness program, there's no real need
to write one's own.
We do need to set certain paths properly for the appropriate 'openssl'
program to be run. We do that with a 'prove' plugin (WrapOpenSSL.pm)
that simply amends the appropriate system environment variables, given
a number of cmake generated environment variables that indicate where
OpenSSL files reside.
Richard Levitte [Sat, 13 Feb 2021 12:53:46 +0000 (13:53 +0100)]
Move gost_cmds[] from gost_ctl.c to gost_eng.c
This make that array uniquely belonging to the engine proper, while
leaving the more generic gost parameters functionality in the
gost_core library.
Richard Levitte [Sat, 13 Feb 2021 10:38:43 +0000 (11:38 +0100)]
Cleanup source organisation, and make 'gost' an actual module
GOST_CORE_SOURCE_FILES and GOST_ENGINE_SOURCE_FILES were a bit
disorganised, they are now re-arranged so GOST_ENGINE_SOURCE_FILES
contains ENGINE specific source only, and what was less ENGINE
specific was moved to GOST_CORE_SOURCE_FILES. Furthermore,
GOST_LIB_SOURCE_FILES now includes GOST_CORE_SOURCE_FILES, so the
gost_core library is complete with all implementations.
As a consequence, 'gost' is now explicitly made into a dlopenable
module. On some operating systems, that makes a difference.
This paves the way for alternative implementations based on the same
base code, such as a provider implementation.
It's quite possible that the re-arrangement done here isn't "pure"
enough. Future development will tell.
Dmitry Belyavskiy [Sat, 6 Feb 2021 18:19:03 +0000 (19:19 +0100)]
Dmitry Belyavskiy [Sat, 6 Feb 2021 16:34:18 +0000 (17:34 +0100)]
Adjust printing options as we print pubkey only
Dmitry Belyavskiy [Sat, 6 Feb 2021 16:33:19 +0000 (17:33 +0100)]
Update build instructions to make perl tests happy
Dmitry Belyavskiy [Wed, 20 Jan 2021 18:15:34 +0000 (19:15 +0100)]
Fixed tests to match the current messages
Vitaly Chikunov [Thu, 7 Jan 2021 19:05:16 +0000 (22:05 +0300)]
CI: Covert some Travis-CI to GitHub Actions
All, excluding ppc64le/s390x/ar64 architectures, macOS,
and Coverity run.
Alexei A. Smekalkine [Mon, 30 Nov 2020 21:20:59 +0000 (00:20 +0300)]
gost_crypt: process full available block in CFB and CNT mode
If at the input of the encryption function in the CFB mode we have
an integer number of blocks, then in the main loop all blocks will be
processed, except for the last one due to an incorrect border check.
The last block will be fully processed as a "partial" remainder, but
the initialization vector will not be updated. And, thus, the value
of IV will always be incorrect in this case.
This breaks stateless protocols due to an invalid initialization vector:
all messages except the first cannot be decrypted. (Naturally, we are
talking about a case with disabled key meshing, which does not allow
context recovery due to an erroneous implementation.)
It is worth noting here that the code for processing partial blocks
(both at the input of the encryption functions and at the output) is
a historically unnecessary artifact, since we do not set the
EVP_CIPH_FLAG_CUSTOM_CIPHER flag and, as a result, OpenSSL processes
partial blocks for us.
This patch corrects the checking of the main loop boundary.
A similar error is present in the code for the CNT mode, but there it
does not manifest itself in any way, because the restoration of the
state in this mode is impossible: even after disabling key meshing, we
still have the state-dependent transformation of the IV.
As an extra result of this fix, the code for processing partial blocks
can be completely removed now.
(cherry picked from commit
cf402dd4d89271d5b1ca4ea938ce7a2f13a44d58)
Igor Kirillov [Thu, 26 Nov 2020 15:26:03 +0000 (18:26 +0300)]
update magma cipher ctr_acpkm mode encrypting
Fixed bug when acpkm key meshing didn't apply at appropriate time
during TLS secure exchange.
Unify usage of 'num' variable of EVP_CIPHER_CTX for kuznetchik and
magma.
Dmitry Belyavskiy [Sat, 28 Nov 2020 16:53:40 +0000 (19:53 +0300)]
Tests updated to support GOST2001DH
Dmitry Timoshkov [Fri, 27 Nov 2020 14:19:59 +0000 (17:19 +0300)]
Add explicit support for NID_id_GostR3410_2001DH (GOST R 34.10-2001 DH)
Dmitry Belyavskiy [Thu, 19 Nov 2020 19:47:39 +0000 (22:47 +0300)]
Try to fix osx build
Dmitry Belyavskiy [Thu, 19 Nov 2020 19:46:52 +0000 (22:46 +0300)]
Increase OpenSSL alpha version
Igor Kirillov [Fri, 30 Oct 2020 06:29:20 +0000 (09:29 +0300)]
modernize ctrl function for magma & kuznechik TLS usage
modernize magma & kuznechik ctrl functions for EVP_CTRL_TLSTREE mode.
add some minor updates to store master key for using in magma TLSTREE mode.
Richard Levitte [Wed, 4 Nov 2020 16:44:21 +0000 (17:44 +0100)]
Modernize OpenSSL error reporting
OpenSSL 3.0 deprecates function codes and ERR_PUT_error() in favor
of ERR_raise() and ERR_set_debug().
Vitaly Chikunov [Wed, 28 Oct 2020 21:58:56 +0000 (00:58 +0300)]
CMakeLists.txt: Fix warning on gcc-9
/root/rpmbuild/BUILD/openssl-gost-engine-1.1.1/CMakeFiles/CMakeTmp/src.c:4:14: warning: initialization of 'int *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
4 | int *p = buf + 1;
| ^~~
/root/rpmbuild/BUILD/openssl-gost-engine-1.1.1/CMakeFiles/CMakeTmp/src.c:5:14: warning: initialization of 'int *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
5 | int *q = buf + 2;
| ^~~
Reported-by: Ilya Shipitsin <https://github.com/chipitsine>
Fixes: #288
Wolfgang Beck [Fri, 9 Oct 2020 06:57:03 +0000 (16:57 +1000)]
fix_cbc_281
Dmitry Belyavskiy [Fri, 2 Oct 2020 15:02:58 +0000 (18:02 +0300)]
Setup CodeQL for gost-engine
Dmitry Belyavskiy [Sun, 27 Sep 2020 08:11:51 +0000 (11:11 +0300)]
Fix Coverity #305799
Arseniy Ankudinov [Wed, 23 Sep 2020 15:54:58 +0000 (18:54 +0300)]
disable gost key mask on gost94 digest steps due to performance issues
Vitaly Chikunov [Sun, 20 Sep 2020 18:21:22 +0000 (21:21 +0300)]
Compatibility with Solaris 10 (gcc 3.4.3)
Note, you will need to pass `-lsocket -lnsl` to the gcc for
socketpair(3SOCKET) to link `test_tls'.
Dmitry Belyavskiy [Fri, 18 Sep 2020 13:52:47 +0000 (16:52 +0300)]
KDF Tree fix for BIG_ENDIAN
Dmitry Belyavskiy [Fri, 18 Sep 2020 13:28:05 +0000 (16:28 +0300)]
Merge branch 'master' of https://github.com/gost-engine/engine
Dmitry Belyavskiy [Fri, 18 Sep 2020 13:27:41 +0000 (16:27 +0300)]
Strict alignment Kuznyechik bugfix
Vitaly Chikunov [Thu, 17 Sep 2020 22:47:27 +0000 (01:47 +0300)]
Provide cmake test if alignment requirement is strict
This is based on AX_CHECK_ALIGNED_ACCESS_REQUIRED from autoconf-archive.
Note, that on some arches unaligned access behavior could be changed at
runtime via prctl(1). Also, unaligned memory access is still slower (and
very slow on some arches) even if it's not strictly required.
Dmitry Belyavskiy [Fri, 18 Sep 2020 08:18:10 +0000 (11:18 +0300)]
Endianess bugfix
Dmitry Belyavskiy [Wed, 2 Sep 2020 15:05:02 +0000 (18:05 +0300)]
Adjust README.md
Dmitry Belyavskiy [Fri, 28 Aug 2020 13:36:34 +0000 (16:36 +0300)]
Tests adjustment
Dmitry Belyavskiy [Sat, 22 Aug 2020 15:49:57 +0000 (18:49 +0300)]
Fix Coverity #305798
Dmitry Belyavskiy [Sat, 22 Aug 2020 15:47:17 +0000 (18:47 +0300)]
Fix coverity #305799
Dmitry Belyavskiy [Sat, 22 Aug 2020 15:42:56 +0000 (18:42 +0300)]
Fix Coverity #305800
Plus some minor style fix
Luis Rivera Zamarripa [Thu, 20 Aug 2020 09:56:31 +0000 (12:56 +0300)]
[ecp] validation with coverity
Dmitry Belyavskiy [Thu, 20 Aug 2020 07:37:44 +0000 (10:37 +0300)]
Update test to match current openssl messages
Dmitry Belyavskiy [Thu, 13 Aug 2020 11:26:12 +0000 (14:26 +0300)]
SSL tests fix
Dmitry Belyavskiy [Tue, 11 Aug 2020 12:36:01 +0000 (15:36 +0300)]
Use alpha6 openssl
Dmitry Belyavskiy [Thu, 6 Aug 2020 15:05:07 +0000 (18:05 +0300)]
Bugfix - arguments order
Dmitry Belyavskiy [Thu, 6 Aug 2020 15:04:27 +0000 (18:04 +0300)]
API renaming
Dmitry Belyavskiy [Thu, 6 Aug 2020 15:03:59 +0000 (18:03 +0300)]
Clang build fix
Billy Brumley [Thu, 23 Jul 2020 16:47:03 +0000 (19:47 +0300)]
Edwards map fix
ECCKiila Changes from
https://gitlab.com/nisec/ecckiila/-/issues/2
https://gitlab.com/nisec/ecckiila/-/commit/
7445ecabef77965743e0ae8d39d7433b07820be6
* X3 -> X1
* eliminate a temp variable
X3 = X1 as pointers is the reason this was still passing unit tests.
But that might not hold in future versions of ECCKiila, so fix it now.
Dmitry Belyavskiy [Wed, 22 Jul 2020 09:39:08 +0000 (12:39 +0300)]
Create codeql-analysis.yml
Billy Brumley [Fri, 10 Jul 2020 16:55:32 +0000 (19:55 +0300)]
GOST EC armv7 aarch64 fixes
char defaults to signed on x86/x64, but unsigned on ARM.
Vitaly Chikunov [Thu, 4 Jun 2020 00:37:39 +0000 (03:37 +0300)]
test_derive: Test all modes of EVP_PKEY_derive
Test all VKOs and KEGs to work and produce same keys for both parties.
Vitaly Chikunov [Wed, 3 Jun 2020 02:45:13 +0000 (05:45 +0300)]
Add string option 'vko' for EVP_PKEY_CTRL_SET_VKO
Format: vko:<bit length>
Such as:
vko:256 for VKO_256
vko:512 for VKO_512
vko:0 disable strict VKO mode, switch to other derive methods.
Vitaly Chikunov [Fri, 29 May 2020 18:13:20 +0000 (21:13 +0300)]
test_derive: Add VKO tests from R 50.1.113-2016
Vitaly Chikunov [Tue, 2 Jun 2020 00:29:13 +0000 (03:29 +0300)]
Allow to use raw VKO in EVP_PKEY_derive
Suitable for tests. Use EVP_PKEY_CTRL_SET_VKO ctrl with appropriate
digest nid to enable VKO mode.
Billy Brumley [Fri, 3 Jul 2020 15:27:23 +0000 (18:27 +0300)]
GOST ECC optimizations (#263)
Standalone EC implementations from ECCKiila.
https://gitlab.com/nisec/ecckiila
Dmitry Belyavskiy [Sat, 13 Jun 2020 13:35:56 +0000 (16:35 +0300)]
Avoid some warnings
Dmitry Belyavskiy [Sat, 13 Jun 2020 13:21:08 +0000 (16:21 +0300)]
Clarify that OPENSSL_ROOT_DIR is absolute path
Pauli [Fri, 12 Jun 2020 06:13:40 +0000 (16:13 +1000)]
EVP_MAC: APIs were renamed so they need to be fixed in here too. (#267)
Vitalio [Wed, 10 Jun 2020 07:46:36 +0000 (10:46 +0300)]
gost_ec_keyx: Update header plate with copyrights and description (#266)
Billy Brumley [Mon, 8 Jun 2020 14:36:10 +0000 (17:36 +0300)]
GOST key agreement cofactor fix (#265)
* GOST key agreement cofactor fix
Vitaly Chikunov [Wed, 27 May 2020 14:19:31 +0000 (17:19 +0300)]
benchmark/sign: Fix crash on incorrect options
Bug found by Clang scan-build.
Fixes #258.
Dmitry Belyavskiy [Wed, 27 May 2020 09:56:07 +0000 (12:56 +0300)]
API changes
Dmitry Belyavskiy [Fri, 22 May 2020 16:00:03 +0000 (19:00 +0300)]
Missing copyright plates
Fixes #257
Dmitry Belyavskiy [Thu, 21 May 2020 17:42:18 +0000 (20:42 +0300)]
Reenable RSA TLS test
openssl/openssl#11720 provided the necessary fix.
Vitaly Chikunov [Tue, 19 May 2020 10:31:39 +0000 (13:31 +0300)]
test_sign: Test conversion of private keys to PEM and DER and back
Vitaly Chikunov [Tue, 19 May 2020 10:30:12 +0000 (13:30 +0300)]
test_params: Test conversion of cert to PEM and back
Test for conversion errors.
Vitaly Chikunov [Wed, 20 May 2020 05:20:52 +0000 (08:20 +0300)]
.travis.yml: Make Travis script fail early
Such as, no need to run tests if build failed.
Vitaly Chikunov [Tue, 19 May 2020 17:49:19 +0000 (20:49 +0300)]
test_tls: Force LEGACY-GOST2012-GOST8912-GOST8912 cipher list
Also, allow verbose connect setting VERBOSE=1 env var.
Dmitry Belyavskiy [Tue, 19 May 2020 14:55:17 +0000 (17:55 +0300)]
Merge branch 'master' of https://github.com/gost-engine/engine