summaryrefslogtreecommitdiff
path: root/tests/Makefile.am
AgeCommit message (Collapse)AuthorFilesLines
2016-02-03tests: Add a test for Curve25519.NIIBE Yutaka1-1/+1
* tests/Makefile.am (tests_bin): Add t-cv25519. * tests/t-cv25519.c: New. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2015-08-23tests: Add missing files for the make distcheck target.Werner Koch1-1/+2
* tests/Makefile.am (EXTRA_DIST): Add sha3-x test vector files. Signed-off-by: Werner Koch <wk@gnupg.org>
2014-03-04Add an utility to calculate hashes over a set of filesDmitry Eremin-Solenikov1-1/+2
* tests/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>
2014-01-27Update gpg-error autoconf macros to fix threading problems.Werner Koch1-4/+5
* m4/gpg-error.m4: Update to version 2014-01-24. * tests/Makefile.am (t_lock_LDADD): Use MT Libs.
2014-01-24tests: Pass -no-install to libtoolDmitry Eremin-Solenikov1-0/+1
* tests/Makefile.am: add AM_LDFLAGS = -no-install -- There is little point building tests with support for installation. Passing -no-install stops libtool from building wrapper scripts, thus allowing direct gdb/valgrind invocation on programs in tests/ subdirectory. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2014-01-24tests: Add a test for the internal lockingWerner Koch1-2/+8
* src/global.c (external_lock_test): New. (_gcry_vcontrol): Call new function with formerly reserved code 61. * tests/t-common.h: New. Taken from current libgpg-error. * tests/t-lock.c: New. Based on t-lock.c from libgpg-error. * configure.ac (HAVE_PTHREAD): Set macro to 1 if defined. (AC_CHECK_FUNCS): Check for flockfile. * tests/Makefile.am (tests_bin): Add t-lock. (noinst_HEADERS): Add t-common.h (LDADD): Move value to ... (default_ldadd): new. (t_lock_LDADD): New. -- Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit fa42c61a84996b6a7574c32233dfd8d9f254d93a) Resolved conflicts: * src/ath.c: Remove as not anymore used in 1.7. * tests/Makefile.am: Merge. Changes: * src/global.c (external_lock_test): Use the gpgrt function for locking. Changed subject because here we are only adding the test case.
2014-01-20tests: Rename tsexp.cWerner Koch1-1/+1
* tests/tsexp.c: Rename to t-sexp.c Signed-off-by: Werner Koch <wk@gnupg.org>
2013-12-16Add configure option --enable-large-data-tests.Werner Koch1-5/+16
* configure.ac: Add option --enable-large-data-tests. * tests/hashtest-256g.in: New. * tests/Makefile.am (EXTRA_DIST): Add hashtest-256g.in. (TESTS): Split up into tests_bin, tests_bin_last, tests_sh, and tests_sh_last. (tests_sh_last): Add hashtest-256g (noinst_PROGRAMS): Add only tests_bin and tests_bin_last. (bench-slope.log, hashtest-256g.log): New rules to enforce serial run. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-12-09tests: Speed up benchmarks in regression test mode.Werner Koch1-1/+2
* tests/tsexp.c (check_extract_param): Fix compiler warning. * tests/Makefile.am (TESTS_ENVIRONMENT): Set GCRYPT_IN_REGRESSION_TEST. * tests/bench-slope.c (main): Speed up if in regression test mode. * tests/benchmark.c (main): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-11-14md: Fix hashing for data >= 256 GBWerner Koch1-2/+2
* cipher/hash-common.h (gcry_md_block_ctx): Add "nblocks_high". * cipher/hash-common.c (_gcry_md_block_write): Bump NBLOCKS_HIGH. * cipher/md4.c (md4_init, md4_final): Take care of NBLOCKS_HIGH. * cipher/md5.c (md5_init, md5_final): Ditto. * cipher/rmd160.c (_gcry_rmd160_init, rmd160_final): Ditto. * cipher/sha1.c (sha1_init, sha1_final): Ditto. * cipher/sha256.c (sha256_init, sha224_init, sha256_final): Ditto. * cipher/sha512.c (sha512_init, sha384_init, sha512_final): Ditto. * cipher/tiger.c (do_init, tiger_final): Ditto. * cipher/whirlpool.c (whirlpool_final): Ditto. * cipher/md.c (gcry_md_algo_info): Add GCRYCTL_SELFTEST. (_gcry_md_selftest): Return "not implemented" as required. * tests/hashtest.c: New. * tests/genhashdata.c: New. * tests/Makefile.am (TESTS): Add hashtest. (noinst_PROGRAMS): Add genhashdata -- Problem found by Denis Corbin and analyzed by Yuriy Kaminskiy. sha512 and whirlpool should not have this problem because they use 64 bit types for counting the blocks. However, a similar fix has been employed to allow for really huge sizes - despite that it will be very hard to test them. The test vectors have been produced by sha{1,224,256}sum and the genhashdata tool. A sequence of 'a' is used for them because a test using one million 'a' is commonly used for test vectors. More test vectors are required. Running the large tests needs to be done manual for now: ./hashtest --gigs 256 tests all algorithms, ./hashtest --gigs 256 sha1 sha224 sha256 only the given ones. A configure option to include these test in the standard regression suite will be useful. The tests will take looong. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-10-28Add new benchmarking utility, bench-slopeJussi Kivilinna1-2/+2
* tests/Makefile.am (TESTS): Add 'bench-slope'. * tests/bench-slope.c: New. -- Bench-slope is new benchmarking tool for libgcrypt for obtaining overheadless cycles/byte speed of cipher and hash algorithms. Tool measures the time each operation (hash/encrypt/decrypt/authentication) takes for different buffer sizes of from ~0kB to ~4kB and calculates the slope for these data points. The default output is then given as nanosecs/byte and mebibytes/sec. If user provides the speed of used CPU, tool also outputs cycles/byte result (CPU-Ghz * ns/B = c/B). Output without CPU speed (with ARM Cortex-A8): $ tests/bench-slope hash Hash: | nanosecs/byte mebibytes/sec cycles/byte MD5 | 7.35 ns/B 129.7 MiB/s - c/B SHA1 | 12.30 ns/B 77.53 MiB/s - c/B RIPEMD160 | 15.96 ns/B 59.77 MiB/s - c/B TIGER192 | 55.55 ns/B 17.17 MiB/s - c/B SHA256 | 24.38 ns/B 39.12 MiB/s - c/B SHA384 | 34.24 ns/B 27.86 MiB/s - c/B SHA512 | 34.19 ns/B 27.90 MiB/s - c/B SHA224 | 24.38 ns/B 39.12 MiB/s - c/B MD4 | 5.68 ns/B 168.0 MiB/s - c/B CRC32 | 9.26 ns/B 103.0 MiB/s - c/B CRC32RFC1510 | 9.20 ns/B 103.6 MiB/s - c/B CRC24RFC2440 | 87.31 ns/B 10.92 MiB/s - c/B WHIRLPOOL | 253.3 ns/B 3.77 MiB/s - c/B TIGER | 55.55 ns/B 17.17 MiB/s - c/B TIGER2 | 55.55 ns/B 17.17 MiB/s - c/B GOSTR3411_94 | 212.0 ns/B 4.50 MiB/s - c/B STRIBOG256 | 630.1 ns/B 1.51 MiB/s - c/B STRIBOG512 | 630.1 ns/B 1.51 MiB/s - c/B = With CPU speed (with Intel i5-4570, 3.2Ghz when turbo-boost disabled): $ tests/bench-slope --cpu-mhz 3201 cipher arcfour blowfish aes Cipher: ARCFOUR | nanosecs/byte mebibytes/sec cycles/byte STREAM enc | 2.43 ns/B 392.1 MiB/s 7.79 c/B STREAM dec | 2.44 ns/B 390.2 MiB/s 7.82 c/B = BLOWFISH | nanosecs/byte mebibytes/sec cycles/byte ECB enc | 7.62 ns/B 125.2 MiB/s 24.38 c/B ECB dec | 7.63 ns/B 125.0 MiB/s 24.43 c/B CBC enc | 9.18 ns/B 103.9 MiB/s 29.38 c/B CBC dec | 2.60 ns/B 366.2 MiB/s 8.34 c/B CFB enc | 9.17 ns/B 104.0 MiB/s 29.35 c/B CFB dec | 2.66 ns/B 358.1 MiB/s 8.53 c/B OFB enc | 8.97 ns/B 106.3 MiB/s 28.72 c/B OFB dec | 8.97 ns/B 106.3 MiB/s 28.71 c/B CTR enc | 2.60 ns/B 366.5 MiB/s 8.33 c/B CTR dec | 2.60 ns/B 367.1 MiB/s 8.32 c/B = AES | nanosecs/byte mebibytes/sec cycles/byte ECB enc | 0.439 ns/B 2173.0 MiB/s 1.40 c/B ECB dec | 0.489 ns/B 1949.5 MiB/s 1.57 c/B CBC enc | 1.64 ns/B 580.8 MiB/s 5.26 c/B CBC dec | 0.219 ns/B 4357.6 MiB/s 0.701 c/B CFB enc | 1.53 ns/B 623.6 MiB/s 4.90 c/B CFB dec | 0.219 ns/B 4350.5 MiB/s 0.702 c/B OFB enc | 1.51 ns/B 629.9 MiB/s 4.85 c/B OFB dec | 1.51 ns/B 629.9 MiB/s 4.85 c/B CTR enc | 0.288 ns/B 3308.5 MiB/s 0.923 c/B CTR dec | 0.288 ns/B 3316.9 MiB/s 0.920 c/B CCM enc | 1.93 ns/B 493.8 MiB/s 6.18 c/B CCM dec | 1.93 ns/B 494.0 MiB/s 6.18 c/B CCM auth | 1.64 ns/B 580.1 MiB/s 5.26 c/B = Note: It's highly recommented to disable turbo-boost and dynamic CPU frequency features when making these kind of measurements to reduce variance. Note: The results are maximum performance for each operation; the actual speed in application depends on various matters, such as: used buffer sizes, cache usage, etc. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
2013-09-16ecc: Implement Curve Ed25519 signing and verification.Werner Koch1-2/+3
* cipher/ecc-curves.c (domain_parms): Add curve "Ed25519". * cipher/ecc.c (reverse_buffer): New. (eddsa_encodempi): New. (eddsa_encodepoint): New. (eddsa_decodepoint): New. (sign_eddsa): Implement. (verify_eddsa): Implement. (ecc_sign): Init unused Q. Pass public key to sign_eddsa. (ecc_verify): Init pk.Q if not used. Pass public key verbatim to verify_eddsa. * cipher/pubkey.c (sexp_elements_extract): Add arg OPAQUE. Change all callers to pass 0. (sexp_to_sig): Add arg OPAQUE and pass it to sexp_elements_extract. (sexp_data_to_mpi): Allow for a zero length "value". (gcry_pk_verify): Reorder parameter processing. Pass OPAQUE flag as required. * mpi/ec.c (ec_invm): Print a warning if the inverse does not exist. (_gcry_mpi_ec_get_affine): Implement for our Twisted Edwards curve model. (dup_point_twistededwards): Implement. (add_points_twistededwards): Implement. (_gcry_mpi_ec_mul_point): Support Twisted Edwards. * mpi/mpicoder.c (do_get_buffer): Add arg FILL_LE. (_gcry_mpi_get_buffer): Ditto. Change all callers. (_gcry_mpi_get_secure_buffer): Ditto. * src/sexp.c (_gcry_sexp_nth_opaque_mpi): New. * tests/t-ed25519.c: New. * tests/t-ed25519.inp: New. * tests/t-mpi-point.c (basic_ec_math_simplified): Print some output only in debug mode. (twistededwards_math): New test. (main): Call new test. -- This is a non optimized version which takes far too long. On my X220 Thinkpad the 1024 test cases take 14 seconds (12 with --sign-with-pk). There should be a lot of room for improvements. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-04Prepare support for non-Weierstrass EC equations.Werner Koch1-3/+4
* src/mpi.h (gcry_mpi_ec_models): New. * src/ec-context.h (mpi_ec_ctx_s): Add MODEL. * cipher/ecc-common.h (elliptic_curve_t): Ditto. * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto. (domain_parms): Mark als as Weierstrass. (_gcry_ecc_fill_in_curve): Check model. (_gcry_ecc_get_curve): Set model to Weierstrass. * cipher/ecc-misc.c (_gcry_ecc_model2str): New. * cipher/ecc.c (generate_key, ecc_generate_ext): Print model in the debug output. * mpi/ec.c (_gcry_mpi_ec_dup_point): Switch depending on model. Factor code out to ... (dup_point_weierstrass): new. (dup_point_montgomery, dup_point_twistededwards): New stub functions. (_gcry_mpi_ec_add_points): Switch depending on model. Factor code out to ... (add_points_weierstrass): new. (add_points_montgomery, add_points_twistededwards): New stub functions. * tests/Makefile.am (TESTS): Reorder tests. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-08-30mpi: Make gcry_mpi_print work with negative zeroes.Werner Koch1-1/+1
* mpi/mpicoder.c (gcry_mpi_print): Take care of negative zero. (gcry_mpi_aprint): Allocate at least 1 byte. * tests/t-convert.c: New. * tests/Makefile.am (TESTS): Add t-convert. -- Reported-by: Christian Fuchs Signed-off-by: Werner Koch <wk@gnupg.org>
2013-07-26Implement deterministic DSA as specified by rfc-6979.Werner Koch1-1/+1
* cipher/dsa.c (dsa_sign): Move opaque mpi extraction to sign. (sign): Add args FLAGS and HASHALGO. Implement deterministic DSA. Add code path for R==0 to comply with the standard. (dsa_verify): Left fill opaque mpi based hash values. * cipher/dsa-common.c (int2octets, bits2octets): New. (_gcry_dsa_gen_rfc6979_k): New. * tests/dsa-rfc6979.c: New. * tests/Makefile.am (TESTS): Add dsa-rfc6979. -- This patch also fixes a recent patch (37d0a1e) which allows to pass the hash in a (hash) element. Support for deterministic ECDSA will come soon. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-03-08mpi: Add an API for EC point operations.Werner Koch1-1/+1
* mpi/ec.c (gcry_mpi_point_new, gcry_mpi_point_release): New. (gcry_mpi_point_get, gcry_mpi_point_snatch_get): New. (gcry_mpi_point_set, gcry_mpi_point_snatch_set): New. * src/visibility.h, src/visibility.c: Add corresponding macros and wrappers. * src/gcrypt.h.in (struct gcry_mpi_point, gcry_mpi_point_t): New. (gcry_mpi_point_new, gcry_mpi_point_release, gcry_mpi_point_get) (gcry_mpi_point_snatch_get, gcry_mpi_point_set) (gcry_mpi_point_snatch_set): New prototypes. (mpi_point_new, mpi_point_release, mpi_point_get, mpi_point_snatch_get) (mpi_point_set, mpi_point_snatch_set): New macros. * src/libgcrypt.vers (gcry_mpi_point_new, gcry_mpi_point_release) (gcry_mpi_point_get, gcry_mpi_point_snatch_get, gcry_mpi_point_set) (gcry_mpi_point_snatch_set): New symbols. * src/libgcrypt.def: Ditto. * tests/t-mpi-point.c: New. * tests/Makefile.am (TESTS): Add t-mpi-point
2012-12-03tests: Allow use of random.c under Windows.Werner Koch1-6/+1
* tests/Makefile.am (TESTS): Always include random.c * tests/random.c [!W32]: Include sys/wait.h. (inf): New. (check_forking, check_nonce_forking): Print a notice what will be done. (main) [W32]: Do not call signal. -- This change help to run future tests under Windows. The current two tests are not applicable to Windows.
2011-09-15Removed the module registration interfaceWerner Koch1-1/+1
The module registration interface is not widely used but complicates the internal operation of Libgcrypt a lot. It also does not allow for efficient implementation of new algorithm or cipher modes. Further the required locking of all access to internal module data or functions would make it hard to come up with a deadlock free pthread_atfork implementation. Thus we remove the entire subsystem. Note that the module system is still used internally but it is now possible to change it without breaking the ABI. In case a feature to add more algorithms demanded in the future, we may add one by dlopening modules at startup time from a dedicated directory.
2011-09-15Removed the AC interface (gcry_ac_*)Werner Koch1-1/+1
This interface has long been deprecated. It was also initially only declared as an experimental interface. It added its own kind of complexity and we found that it does not make applications easier to read. Modern features of Libgcrypt were not supported and its removal reduces the SLOC which is a Good Thing from a security POV.
2011-06-13Add a full set of pkcs#1 v2 test vectorsWerner Koch1-1/+2
For v1.5 we use somewhat unofficial test vectors we found on the rsalabs FTP server. There is a little awk script which helped us to convert them. All the test vectors are in separate files with C tables to keep the actual test program readable. We detected a few flaws in our pkcs1 implementation which will be fixed with the next commit.
2011-06-09Add OAEP regression test.Werner Koch1-1/+1
2011-03-09New function gcry_kdf_deriveWerner Koch1-1/+1
This allows us to factor the S2k code from gpg and gpg-agent out to libgcrypt. Created a bunch of test vectors using a hacked gpg 1.4. The function also implements PBKDF2; tested against the RFC-6070 test vectors.
2011-02-01Add gcry_pk_get_curve.Werner Koch1-1/+2
2011-01-04Makefile.am (LDADD): Fix typo in last change.Werner Koch1-1/+1
Reported by Andrey Jivsov.
2010-08-16Insert sys/select.h to be POSIXly correct.Werner Koch1-1/+1
Typo fixes.
2010-01-21Support WindowsCE.Werner Koch1-1/+1
2009-12-09Implemented the AES-Wrap algorithmWerner Koch1-1/+1
2009-02-11Add a new helper toolWerner Koch1-1/+1
2008-11-28Fixed the fips 186 dsa key generation.Werner Koch1-1/+1
Allow apssing of a seed value. Add a new regression test. Updated the cavs driver.
2008-10-02Add CAVS test.Werner Koch1-6/+2
Various minor fixes. Sigbus fixes for AES.
2008-09-16Another tweak for the RNG test code.Werner Koch1-0/+3
2008-09-15Use syslog to log important messages.Werner Koch1-1/+1
Add an external RNG test hook.
2008-08-29Changed the way the FIPS RNG is seeded.Werner Koch1-4/+3
FIPS cleanups. Documentation upodates.
2008-08-22Completed the RNG implementaion switching.Werner Koch1-1/+1
Added framework for running RNG tests. Added an experimental option --enable-hmac-binary-check to configure. --This line, and those below, will be ignored-- M src/fips.c M src/cipher-proto.h M src/global.c M src/hmac256.c M src/ChangeLog M src/hmac256.h M src/Makefile.am M tests/Makefile.am M configure.ac M doc/gcrypt.texi M random/random-fips.c M random/random.c M random/rand-internal.h M random/random.h M random/ChangeLog M ChangeLog M README
2007-05-03Minor fixes for W32Werner Koch1-4/+6
2007-04-30./Werner Koch1-1/+1
* README.apichanges: Move to doc/. * Makefile.am (EXTRA_DIST): Removed that file. doc/ * HACKING: New. Two items by Marcus. * README.apichanges: Move from .. to here. * Makefile.am (EXTRA_DIST): Add new files. mpi/ * config.links: Create a file mod-source-info.h. * Makefile.am (DISTCLEANFILES): Add that file. * mpiutil.c (_gcry_mpi_get_hw_config): New. src/ * global.c (gcry_control): New. * gcrypt.h.in (GCRYCTL_DUMP_CONFIG): New. tests/ * version.c: New. * Makefile.am (TESTS): Add version.
2007-04-16./Werner Koch1-2/+2
* configure.ac: Check for sysconf. * acinclude.m4 (GNUPG_CHECK_MLOCK): Try to use sysconf to get the page size and use getpagesize only then if available. cipher/ * ecc.c (_gcry_ecc_generate): Renamed DUMMY to CURVE and use it. src/ * secmem.c (init_pool): Use sysconf() if available to determine page size.
2007-03-28Rewrote the ECDSA implementation.Werner Koch1-4/+4
2007-03-13Add support for ADM64. From Werner Dittmann.Werner Koch1-1/+1
Cosmetic changes.
2007-02-23Ported last changes from 1.2.Werner Koch1-3/+7
Updated some tests. Support for passphrase generated Elgamal keys.
2007-02-22Tweaks for W32Werner Koch1-1/+8
2006-12-18* rndlinux.c (set_cloexec_flag): New.Werner Koch1-2/+5
(open_device): Set close-on-exit flags. Suggested by Max Kellermann. Fixes Debian#403613. Cleaned up last Makefile changes.
2006-11-052006-11-05 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-1/+1
* Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the new gcrypt.h is used, not the one installed in the system. 2006-11-05 Moritz Schulte <moritz@g10code.com> * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the new gcrypt.h is used, not the one installed in the system. 2006-11-05 Moritz Schulte <moritz@g10code.com> * Makefile.am (AM_CFLAGS): Added -I$(top_builddir)/src so that the new gcrypt.h is used, not the one installed in the system.
2006-11-05Undo last change, which was non-intentionally commitedMoritz Schulte1-7/+1
2006-11-052006-11-05 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-1/+7
* gcrypt.texi (General public-key related Functions): Typo.
2006-08-04Fixed gcry_mpi_set_bit and enhanced mpi_rshift.Werner Koch1-1/+1
Cleaned up andom-daemon initialization.
2005-11-02(no commit message)Moritz Schulte1-3/+2
2005-11-02src/ChangeLogMoritz Schulte1-1/+2
src/gcrypt.h TODO cipher/pubkey.c cipher/cipher.c cipher/ChangeLog
2005-09-152005-09-15 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-1/+1
* Makefile.am (TESTS): Added keygrip. * keygrip.c: New.
2005-08-18Added hmac testWerner Koch1-1/+2