Drop automake-installed files

Drop files that are provided by automake. They are better to be in sync
with automake used.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Update .gitingore to ignore more files

* .gitignore: add more tests, temporary files, etc to the list of
ignored files.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Implement GOST 28147-89 "gammirovanie" mode

* cipher/Makefile.am, cipher/cipher-internal.h,
 cipher/cipher-ofbgost.c cipher/cipher.c src/gcrypt.h.in: GOST 28147-89
 declares special mode named "gammirovanie". It looks mostly like OFB
 mode, except that encrypted cipherstream is processed a little bit
 more. Implement it as a generic encryption mode (like it is done for
 AESWRAP).
* doc/gcrypt.texi: document GCRY_CIPHER_MODE_OFBGOST.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

start adding ofbgost checks

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

OFBGOST improvements

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

OFBGOST -> CNTGOST

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

cntgost

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add a simple PKCS#1 padding mode

* cipher/rsa-common.c (_gcry_rsa_pkcs1_encode_simple_for_sig):
  PKCS#1-encode data with embedded hash OID for signature verification.
* cipher/pubkey-util.c (_gcry_pk_util_data_to_mpi):
  handle s-exp like (data (flags pkcs1) (value xxxxx))
* tests/basic.c (check_pubkey_sign): fix the return value for this kind
  of s-exp.

--
Allow user to specify (flags pkcs1) to enable pkcs1 padding of raw value
(no hash algorithm is specified). It is up to the user to verify that
passed value is properly formatted and includes DER-encoded ASN OID of
the hash function.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Add an utility to calculate hashes over a set of files

* src/gchash.c: New.

--
An utility like rhash that has the ability to calculate different hashes
over a set of files it usefull. Add gchash utility to calculate hashes
supported by libgcrypt.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
gost28147: add (disabled) s-box from 34.11 CryptoPro params

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Check that secret keys are valid while running basic pubkey tests

* tests/basic.c (do_check_one_pubkey): call gcry_pk_testkey on passed
  secret keys.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Fixup tests ordering for new automake

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Truncate hash values for ECDSA signature scheme

* cipher/ecc-ecdsa.c (_gcry_ecc_ecdsa_sign, _gcry_ecc_ecdsa_verify):
  as required by ECDSA scheme, truncate hash values to bitlength of
  used curve.

* tests/pubkey.c (check_ecc_sample_key): add a testcase for hash
  truncation.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>