summaryrefslogtreecommitdiff
path: root/cipher/gost.h
Commit message (Collapse)AuthorAgeFilesLines
* gost28147: add support for CryptoPro key meshing per RFC 4357Dmitry Baryshkov2020-03-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * cipher/gost28147.c (gost_do_set_sbox, cryptopro_key_meshing, CryptoProMeshingKey, gost_encrypt_block_mesh): New. (_gcry_cipher_spec_gost28147_mesh): New cipher with keymeshing, (_gcry_cipher_spec_gost28147): Remove OIDs for this cipher should not be selected using these OIDs (they are for CFB with keymeshing). * cipher/cipher.c (cipher_list, cipher_list_algo301): add _gcry_cipher_spec_gost28147_mesh. * src/gcrypt.h.in (GCRY_CIPHER_GOST28147_MESH): New cipher with keymeshing. * doc/gcrypt.texi (GCRY_CIPHER_GOST28147_MESH): Add definition. * tests/basic.c (check_gost28147_cipher, check_gost28147_cipher_basic): Run basic tests on GCRY_CIPHER_GOST28147_MESH. -- Add actual cipher implementing CryptoPro KeyMeshing. This has been requested by AltLinux team to properly support CFB-encrypted CMS files. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
* gost28147: do not use GOST28147_CONTEXT outside of GOST 28147 calculationDmitry Eremin-Solenikov2019-11-211-1/+1
| | | | | | | | | * cipher/gost28147.c (_gcry_gost_enc_data): remove unused context argument * cipher/gostr3411-94.c (GOSTR3411_CONTEXT, gostr3411_init, do_hash_step): remove unused GOST 28147-89 context. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* gostr3411_94: rewrite to use u32 mathematicDmitry Eremin-Solenikov2014-06-281-2/+2
| | | | | | | | | | | | | | | | | | * cipher/gost28147.c (_gcry_gost_enc_data): New. * cipher/gostr3411-94.c: Rewrite implementation to use u32 mathematic internally. * cipher/gost28147.c (_gcry_gost_enc_one): Remove. -- On my box (Core2 Duo, i386) this highly improves GOST R 34.11-94 speed. Before: GOSTR3411_94 | 55.04 ns/B 17.33 MiB/s - c/B After: GOSTR3411_94 | 36.70 ns/B 25.99 MiB/s - c/B Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Add GOST R 34.11-94 variant using id-GostR3411-94-CryptoProParamSetDmitry Eremin-Solenikov2014-06-281-1/+1
| | | | | | | | | | | | | | | | | | | * src/gcrypt.h.in (GCRY_MD_GOSTR3411_CP): New. * src/cipher.h (_gcry_digest_spec_gost3411_cp): New. * cipher/gost28147.c (_gcry_gost_enc_one): Differentiate between CryptoPro and Test S-Boxes. * cipher/gostr3411-94.c (_gcry_digest_spec_gost3411_cp, gost3411_cp_init): New. * cipher/md.c (md_open): GCRY_MD_GOSTR3411_CP also uses B=32. -- RFC4357 defines only two S-Boxes that should be used together with GOST R 34.11-94 - a testing one (from standard itself, for testing only) and CryptoPro one. Instead of adding a separate gcry_md_ctrl() function just to switch s-boxes, add a separate MD algorithm using CryptoPro S-box. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* cipher/gost28147: generate optimized s-boxes from compact onesDmitry Eremin-Solenikov2014-06-281-0/+1
| | | | | | | | | | | | * cipher/gost-s-box.c: New. Outputs optimized expanded representation of s-boxes (4x256) from compact 16x8 representation. * cipher/Makefile.am: Add gost-sb.h dependency to gost28147.lo * cipher/gost.h: Add sbox to the GOST28147_context structure. * cipher/gost28147.c (gost_setkey): Set default s-box to test s-box from GOST R 34.11 (this was the only one S-box before). * cipher/gost28147.c (gost_val): Use sbox from the context. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* cipher/gost28147: optimization: use precomputed S-box tablesSergey V2013-11-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cipher/gost.h (GOST28147_context): Remove unneeded subst and subst_set members. * cipher/gost28147.c (max): Remove unneeded macro. (test_sbox): Replace with new precomputed tables. (gost_set_subst): Remove function. (gost_val): Use new S-box tables. (gost_encrypt_block, gost_decrypt_block): Tweak to use new ctx and S-box tables. -- Use generated 8->8 S-boxes with precomputed bitwise shifts and bitwise rotations. So in the round function gost_val() we no need to do this operations. Before this patch: GOST28147 | nanosecs/byte mebibytes/sec cycles/byte ECB enc | 24.00 ns/B 39.74 MiB/s - c/B ECB dec | 26.41 ns/B 36.11 MiB/s - c/B CBC enc | 24.57 ns/B 38.81 MiB/s - c/B CBC dec | 26.58 ns/B 35.88 MiB/s - c/B CFB enc | 24.79 ns/B 38.46 MiB/s - c/B CFB dec | 24.72 ns/B 38.57 MiB/s - c/B OFB enc | 24.38 ns/B 39.12 MiB/s - c/B OFB dec | 24.35 ns/B 39.16 MiB/s - c/B CTR enc | 24.83 ns/B 38.41 MiB/s - c/B CTR dec | 25.27 ns/B 37.73 MiB/s - c/B After: GOST28147 | nanosecs/byte mebibytes/sec cycles/byte ECB enc | 16.29 ns/B 58.55 MiB/s - c/B ECB dec | 16.30 ns/B 58.50 MiB/s - c/B CBC enc | 16.94 ns/B 56.29 MiB/s - c/B CBC dec | 16.81 ns/B 56.72 MiB/s - c/B CFB enc | 17.13 ns/B 55.66 MiB/s - c/B CFB dec | 16.84 ns/B 56.63 MiB/s - c/B OFB enc | 16.69 ns/B 57.13 MiB/s - c/B OFB dec | 16.71 ns/B 57.08 MiB/s - c/B CTR enc | 17.01 ns/B 56.06 MiB/s - c/B CTR dec | 17.05 ns/B 55.93 MiB/s - c/B Signed-off-by: Sergey V <sftp.mtuci@gmail.com>
* Fix encryption/decryption return type for GOST28147Jussi Kivilinna2013-09-181-1/+1
| | | | | | | | | | | | | | | * cipher/gost.h (_gcry_gost_enc_one): Change return type to 'unsigned int'. * cipher/gost28147.c (max): New macro. (gost_encrypt_block, gost_decrypt_block): Return burn stack depth. (_gcry_gost_enc_one): Return burn stack depth from gost_encrypt_block. -- Return type for block cipher functions was lately changed from 'void' to 'unsigned int' to pass burn stack depth to cipher mode code. Patch fixes gost28147 to return stack burn value. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* Add limited implementation of GOST 28147-89 cipherDmitry Eremin-Solenikov2013-09-181-0/+33
| | | | | | | | | | | | | | | | | | * src/gcrypt.h.in (GCRY_CIPHER_GOST28147): New. * cipher/gost.h, cipher/gost28147.c: New. * configure.ac (available_ciphers): Add gost28147. * src/cipher.h: Add gost28147 definitions. * cipher/cipher.c: Register gost28147. * tests/basic.c (check_ciphers): Enable simple test for gost28147. * doc/gcrypt.texi: document GCRY_CIPHER_GOST28147. -- Add a very basic implementation of GOST 28147-89 cipher: from modes defined in standard only ECB and CFB are supported, sbox is limited to the "test variant" as provided in GOST 34.11-94. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Removed becuase we never implemented it.Werner Koch2002-05-141-46/+0
|
* Changed program name in all filesWerner Koch2000-12-211-3/+3
|
* See ChangeLog: Wed Dec 23 13:34:22 CET 1998 Werner KochWerner Koch1998-12-231-3/+3
|
* Renamed to GNUPGV-0-2-8Werner Koch1998-02-241-4/+4
|
* initially checkinWerner Koch1997-11-181-0/+46