summaryrefslogtreecommitdiff
path: root/tests/t-convert.c
Commit message (Collapse)AuthorAgeFilesLines
* mpi: optimizations for MPI scanning and printingJussi Kivilinna2021-07-011-180/+358
| | | | | | | | | | | | | | | | | | | | | | | * mpi/mpicoder.c (mpi_read_from_buffer): Add word-size buffer reading loop using 'buf_get_be(32|64)'. (mpi_fromstr): Use look-up tables for HEX conversion; Add fast-path loop for converting 8 hex-characters at once; Add string length parameter. (do_get_buffer): Use 'buf_put_be(32|64)' instead of byte writes; Add fast-path for reversing buffer with 'buf_get_(be64|be32|le64|le32)'. (_gcry_mpi_set_buffer): Use 'buf_get_be(32|64)' instead of byte reads. (twocompl): Use _gcry_ctz instead of open-coded if-clauses to get first bit set; Add fast-path for inverting buffer with 'buf_get_(he64|he32)'. (_gcry_mpi_scan): Use 'buf_get_be32' where possible; Provide string length to 'mpi_fromstr'. (_gcry_mpi_print): Use 'buf_put_be32' where possible; Use look-up table for HEX conversion; Add fast-path loop for converting to 8 hex-characters at once. * tests/t-convert.c (check_formats): Add new tests for larger values. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* tests: do not use GCC variadic macro extension for xgcry_controlJussi Kivilinna2019-05-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/t-common.h (xgcry_control): Use doubly nested parenthesis for passing arguments for gcry_control instead of GCC specific variadic macro extension. * tests/aeswrap.c: Change xgcry_control to use doubly nested parenthesis. * tests/basic.c: Ditto. * tests/bench-slope.c: Ditto. * tests/benchmark.c: Ditto. * tests/curves.c: Ditto. * tests/dsa-rfc6979.c: Ditto. * tests/fips186-dsa: Ditto. * tests/fipsdrv.c: Ditto. * tests/fipsrngdrv.c: Ditto. * tests/gchash.c: Ditto. * tests/hashtest.c: Ditto. * tests/hmac.c: Ditto. * tests/keygen.c: Ditto. * tests/keygrip.c: Ditto. * tests/mpitests.c: Ditto. * tests/pkbench.c: Ditto. * tests/pkcs1v2.c: Ditto. * tests/prime.c: Ditto. * tests/pubkey.c: Ditto. * tests/random.c: Ditto. * tests/rsacvt.c: Ditto. * tests/t-convert.c: Ditto. * tests/t-cv25519.c: Ditto. * tests/t-ed25519.c: Ditto. * tests/t-kdf.c: Ditto. * tests/t-lock.c: Ditto. * tests/t-mpi-bit.c: Ditto. * tests/t-mpi-point.c: Ditto. * tests/t-secmem.c: Ditto. * tests/t-sexp.c: Ditto. * tests/version.c: Ditto. -- GnuPG-bug-id: 4499 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* tests: Fix a printf glitch for a Windows test.Werner Koch2017-08-021-4/+8
| | | | | | | | * tests/t-convert.c (check_formats): Fix print format glitch on Windows. * tests/t-ed25519.c: Typo fix. Signed-off-by: Werner Koch <wk@gnupg.org>
* tests: Check the result of all gcry_control operations.Justus Winter2016-12-131-4/+4
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Use common code for all tests.Justus Winter2016-12-131-63/+5
| | | | | | | -- Also fix minor fallout from the format string warnings. Signed-off-by: Justus Winter <justus@g10code.com>
* tests: Rename 'show' to 'info'.Justus Winter2016-12-131-7/+7
| | | | | -- Signed-off-by: Justus Winter <justus@g10code.com>
* mpi: Fix scanning of negative SSH formats and add more tests.Werner Koch2013-10-231-34/+98
| | | | | | | | | | | | | * mpi/mpicoder.c (gcry_mpi_scan): Fix sign setting for SSH format. * tests/t-convert.c (negative_zero): Test all formats. (check_formats): Add tests for PGP and scan tests for SSH and USG. * src/gcrypt.h.in (mpi_is_neg): Fix macro. * mpi/mpi-scan.c (_gcry_mpi_getbyte, _gcry_mpi_putbyte): Comment out these unused functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Support printing of negative numbers.Werner Koch2013-09-171-5/+369
| | | | | | | | | | | | | * mpi/mpicoder.c (twocompl, onecompl): New. (gcry_mpi_print): Use it for STD and SSH. (gcry_mpi_scan): Use it for STD and SSH. Always set NSCANNED. (gcry_mpi_aprint): Clear the extra allocated byte. * tests/t-convert.c (showhex, showmpi): New. (mpi2bitstr_nlz): New. (check_formats): New. (main): Call new test. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Make gcry_mpi_print work with negative zeroes.Werner Koch2013-08-301-0/+160
* 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>