lexab / libgost15

Pure C99 implementation of GOST R 34.12 (2015) 'Kuznechik', new Russian national block cipher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lg15

Travis GitHub release

New Russian national block cipher GOST R 34.12-'15, also known as Kuznechik (as in Kuzmin, Nechaev and Kompany), was introduced in 2015. New cipher features:

  • SP-network structure,
  • block length of 128 bits,
  • 9 complete encryption rounds,
  • advanced round keys scheduling.

lg15 library provides implementation for fast block encryption, decryption, and round keys scheduling routines by employing vector-by-matrix multiplication precomutation technique described in [no link yet], similar to one in 64KB versions of AES. This optimisation provides significant speed-up, but requires 128KB of additional memory for storing precomputed tables.

Two (interchangeable) versions of implementations are provided:

  • Universal implementation, which is written in pure C, and
  • SSE2 implementation, which utilises SSE2 instructions.

Tests

Configure with WITH_TESTS to build tests executables, which evaluates implementation of encryption, decryption and keys scheduling against data from specification.

Tests can be run via CTest.

Benchmarks

Configure with WITH_BENCHMARKS to build benchmarks executable. All functions provided by lg15 are non-blocking thus measuring takes place in single thread.

Portability

I am working as hard as I can to make this code portable and test it on as many platforms as I can. Bug reports and pull requests are welcome.

About

Pure C99 implementation of GOST R 34.12 (2015) 'Kuznechik', new Russian national block cipher

License:Apache License 2.0


Languages

Language:C 98.9%Language:C++ 0.6%Language:Assembly 0.3%Language:CMake 0.2%