summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog20
-rw-r--r--tests/ac-data.c6
-rw-r--r--tests/ac-schemes.c14
-rw-r--r--tests/ac.c4
-rw-r--r--tests/aeswrap.c14
-rw-r--r--tests/basic.c102
-rw-r--r--tests/benchmark.c29
-rwxr-xr-xtests/cavs_driver.pl44
-rwxr-xr-xtests/cavs_tests.sh10
-rw-r--r--tests/fips186-dsa.c14
-rw-r--r--tests/fipsdrv.c173
-rw-r--r--tests/fipsrngdrv.c19
-rw-r--r--tests/keygen.c19
-rw-r--r--tests/keygrip.c16
-rw-r--r--tests/mpitests.c31
-rw-r--r--tests/pkbench.c18
-rw-r--r--tests/prime.c2
-rw-r--r--tests/pubkey.c64
-rw-r--r--tests/random.c18
-rw-r--r--tests/register.c4
-rw-r--r--tests/rsacvt.c31
-rw-r--r--tests/t-mpi-bit.c14
-rw-r--r--tests/tsexp.c40
-rw-r--r--tests/version.c11
24 files changed, 355 insertions, 362 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 1836d0e0..ac79a28b 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -196,7 +196,7 @@
(run_rsa_gen, run_rsa_sign): New.
(main): Add modes rsa-gen, rsa-sign and rsa-verify.
-
+
2008-09-29 Werner Koch <wk@g10code.com>
* fipsdrv.c: Merge code from fipsrngdrv.c
@@ -205,7 +205,7 @@
2008-09-26 Werner Koch <wk@g10code.com>
* Makefile.am: Distribute cavs_driver.pl.
- * cavs_tests.sh: New.
+ * cavs_tests.sh: New.
* fipsdrv.c: New.
2008-09-18 Werner Koch <wk@g10code.com>
@@ -250,7 +250,7 @@
2008-08-26 Werner Koch <wk@g10code.com>
- * basic.c (get_keys_new): Use transient-key flag.
+ * basic.c (get_keys_new): Use transient-key flag.
* benchmark.c (main): First check options then do the libgcrypt
initialization.
(rsa_bench): Use transient-key flag if not in fips mode.
@@ -343,7 +343,7 @@
2007-04-12 Marcus Brinkmann <marcus@g10code.de>
* ac-schemes.c (scheme_spec): Revert last change.
-
+
* ac-schemes.c (scheme_spec): Remove const qualifier from member M.
(es_check): Remove const qualifier from C and M2.
@@ -375,7 +375,7 @@
2007-02-23 Werner Koch <wk@g10code.com>
- * Makefile.am (TEST): Run benchmark as last.
+ * Makefile.am (TEST): Run benchmark as last.
* ac-data.c (check_sexp_conversion): Print label only in verbose
mode.
@@ -456,7 +456,7 @@
2006-01-18 Brad Hards <bradh@frogmouth.net> (wk 2006-03-07)
* basic.c: Added test cases for OFB and CFB modes. Fixed some
- compiler warnings for signedness.
+ compiler warnings for signedness.
2005-11-12 Moritz Schulte <moritz@g10code.com>
@@ -545,7 +545,7 @@
2003-11-11 Werner Koch <wk@gnupg.org>
* tsexp.c (basic): Add pass structure and a test for the %b
- format.
+ format.
2003-11-04 Werner Koch <wk@gnupg.org>
@@ -685,7 +685,7 @@
* basic.c, keygen.c, pubkey.c, register.c, tsexp.c: Changed to use
new API.
-
+
2003-06-01 Moritz Schulte <moritz@g10code.com>
* tsexp.c (canon_len): Adjust for new gcry_sexp_canon_len API.
@@ -754,7 +754,7 @@
2003-01-23 Werner Koch <wk@gnupg.org>
- * keygen.c: New.
+ * keygen.c: New.
2003-01-20 Simon Josefsson <jas@extundo.com>
@@ -817,7 +817,7 @@
* tsexp.c: New.
-
+
Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
diff --git a/tests/ac-data.c b/tests/ac-data.c
index 65b66ec9..56fedbc6 100644
--- a/tests/ac-data.c
+++ b/tests/ac-data.c
@@ -177,9 +177,9 @@ check_run (void)
if (verbose)
printf ("data-set-test-2 succeeded\n");
-
+
gcry_ac_data_destroy (data);
-
+
}
@@ -203,6 +203,6 @@ main (int argc, char **argv)
for (; i > 0; i--)
check_run ();
-
+
return 0;
}
diff --git a/tests/ac-schemes.c b/tests/ac-schemes.c
index dcef0bf7..58180c07 100644
--- a/tests/ac-schemes.c
+++ b/tests/ac-schemes.c
@@ -81,7 +81,7 @@ scheme_get_opts (scheme_spec_t specs, void **opts)
case GCRY_AC_SSA_PKCS_V1_5:
{
gcry_ac_ssa_pkcs_v1_5_t *opts_pkcs_v1_5 = NULL;
-
+
opts_new = gcry_malloc (sizeof (gcry_ac_ssa_pkcs_v1_5_t));
if (! opts_new)
err = gpg_err_code_from_errno (ENOMEM);
@@ -123,7 +123,7 @@ es_check (gcry_ac_handle_t handle, scheme_spec_t spec,
gcry_ac_io_t io_m;
gcry_ac_io_t io_c;
gcry_ac_io_t io_m2;
-
+
if (spec.flags & SCHEME_SPEC_FLAG_GET_OPTS)
err = scheme_get_opts (spec, &opts);
if (! err)
@@ -173,7 +173,7 @@ ssa_check (gcry_ac_handle_t handle, scheme_spec_t spec,
void *opts = NULL;
gcry_ac_io_t io_m;
gcry_ac_io_t io_s;
-
+
if (spec.flags & SCHEME_SPEC_FLAG_GET_OPTS)
err = scheme_get_opts (spec, &opts);
if (! err)
@@ -295,7 +295,7 @@ key_init (gcry_ac_key_type_t type, gcry_ac_key_t *key)
if (key_data)
gcry_ac_data_destroy (key_data);
-
+
if (! err)
*key = key_new;
@@ -312,7 +312,7 @@ check_run (void)
err = key_init (GCRY_AC_KEY_PUBLIC, &key_public);
if (! err)
err = key_init (GCRY_AC_KEY_SECRET, &key_secret);
-
+
if (! err)
err = gcry_ac_open (&handle, GCRY_AC_RSA, 0);
if (! err)
@@ -320,7 +320,7 @@ check_run (void)
es_checks (handle, key_public, key_secret);
ssa_checks (handle, key_public, key_secret);
}
-
+
assert (! err);
}
@@ -342,6 +342,6 @@ main (int argc, char **argv)
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
check_run ();
-
+
return 0;
}
diff --git a/tests/ac.c b/tests/ac.c
index d734360a..8b2d252e 100644
--- a/tests/ac.c
+++ b/tests/ac.c
@@ -114,7 +114,7 @@ check_one (gcry_mpi_t x)
err = gcry_ac_data_get_index (data, 0, 0, &label, &y);
assert (! err);
gcry_mpi_add_ui (y, y, 1);
-
+
err = gcry_ac_data_verify (handle, key_pub, x, data);
assert (gcry_err_code (err) == GPG_ERR_BAD_SIGNATURE);
}
@@ -157,6 +157,6 @@ main (int argc, char **argv)
for (; i > 0; i--)
check_run ();
-
+
return 0;
}
diff --git a/tests/aeswrap.c b/tests/aeswrap.c
index 39ef1e72..bb52fc90 100644
--- a/tests/aeswrap.c
+++ b/tests/aeswrap.c
@@ -174,7 +174,7 @@ check_all (void)
{
if (verbose)
fprintf (stderr, "4.1 Wrap 128 bits of Key Data with a 128-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES128,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F", 16,
"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF", 16,
@@ -183,7 +183,7 @@ check_all (void)
if (verbose)
fprintf (stderr, "4.2 Wrap 128 bits of Key Data with a 192-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES192,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
"\x10\x11\x12\x13\x14\x15\x16\x17", 24,
@@ -193,7 +193,7 @@ check_all (void)
if (verbose)
fprintf (stderr, "4.3 Wrap 128 bits of Key Data with a 256-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES256,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", 32,
@@ -203,7 +203,7 @@ check_all (void)
if (verbose)
fprintf (stderr, "4.4 Wrap 192 bits of Key Data with a 192-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES192,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
"\x10\x11\x12\x13\x14\x15\x16\x17", 24,
@@ -211,10 +211,10 @@ check_all (void)
"\x00\x01\x02\x03\x04\x05\x06\x07", 24,
"\x03\x1D\x33\x26\x4E\x15\xD3\x32\x68\xF2\x4E\xC2\x60\x74\x3E\xDC"
"\xE1\xC6\xC7\xDD\xEE\x72\x5A\x93\x6B\xA8\x14\x91\x5C\x67\x62\xD2", 32);
-
+
if (verbose)
fprintf (stderr, "4.5 Wrap 192 bits of Key Data with a 256-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES256,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", 32,
@@ -225,7 +225,7 @@ check_all (void)
if (verbose)
fprintf (stderr, "4.6 Wrap 256 bits of Key Data with a 256-bit KEK\n");
- check
+ check
(GCRY_CIPHER_AES,
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F", 32,
diff --git a/tests/basic.c b/tests/basic.c
index a6186540..066ae41c 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -84,7 +84,7 @@ progress_handler (void *cb_data, const char *what, int printchar,
(void)what;
(void)current;
(void)total;
-
+
if (printchar == '\n')
fputs ( "<LF>", stdout);
else
@@ -182,7 +182,7 @@ check_cbc_mac_cipher (void)
}
if (verbose)
- fprintf (stderr, " checking CBC MAC for %s [%i]\n",
+ fprintf (stderr, " checking CBC MAC for %s [%i]\n",
gcry_cipher_algo_name (tv[i].algo),
tv[i].algo);
err = gcry_cipher_encrypt (hd,
@@ -460,7 +460,7 @@ check_ctr_cipher (void)
}
if (verbose)
- fprintf (stderr, " checking CTR mode for %s [%i]\n",
+ fprintf (stderr, " checking CTR mode for %s [%i]\n",
gcry_cipher_algo_name (tv[i].algo),
tv[i].algo);
for (j = 0; tv[i].data[j].inlen; j++)
@@ -496,38 +496,38 @@ check_ctr_cipher (void)
fail ("aes-ctr, decrypt mismatch entry %d:%d\n", i, j);
}
-
+
/* Now check that we get valid return codes back for good and
bad inputs. */
err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
"1234567890123456", 16);
if (err)
fail ("aes-ctr, encryption failed for valid input");
-
+
err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
"1234567890123456", 15);
if (gpg_err_code (err) != GPG_ERR_INV_LENGTH)
fail ("aes-ctr, too short input returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
"12345678901234567", 17);
if (gpg_err_code (err) != GPG_ERR_INV_LENGTH)
fail ("aes-ctr, too long input returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_encrypt (hde, out, 15,
"1234567890123456", 16);
if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
fail ("aes-ctr, too short output buffer returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_encrypt (hde, out, 0,
"1234567890123456", 16);
if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
fail ("aes-ctr, 0 length output buffer returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_encrypt (hde, out, 16,
"1234567890123456", 16);
if (err)
@@ -539,37 +539,37 @@ check_ctr_cipher (void)
"1234567890123456", 16);
if (err)
fail ("aes-ctr, decryption failed for valid input");
-
+
err = gcry_cipher_decrypt (hde, out, MAX_DATA_LEN,
"1234567890123456", 15);
if (gpg_err_code (err) != GPG_ERR_INV_LENGTH)
fail ("aes-ctr, too short input returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_decrypt (hde, out, MAX_DATA_LEN,
"12345678901234567", 17);
if (gpg_err_code (err) != GPG_ERR_INV_LENGTH)
fail ("aes-ctr, too long input returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_decrypt (hde, out, 15,
"1234567890123456", 16);
if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
fail ("aes-ctr, too short output buffer returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_decrypt (hde, out, 0,
"1234567890123456", 16);
if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
fail ("aes-ctr, 0 length output buffer returned wrong error: %s\n",
gpg_strerror (err));
-
+
err = gcry_cipher_decrypt (hde, out, 16,
"1234567890123456", 16);
if (err)
fail ("aes-ctr, correct length output buffer returned error: %s\n",
gpg_strerror (err));
-
+
gcry_cipher_close (hde);
gcry_cipher_close (hdd);
}
@@ -656,11 +656,11 @@ check_cfb_cipher (void)
if (verbose)
fprintf (stderr, " Starting CFB checks.\n");
-
+
for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
{
if (verbose)
- fprintf (stderr, " checking CFB mode for %s [%i]\n",
+ fprintf (stderr, " checking CFB mode for %s [%i]\n",
gcry_cipher_algo_name (tv[i].algo),
tv[i].algo);
err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_CFB, 0);
@@ -827,11 +827,11 @@ check_ofb_cipher (void)
if (verbose)
fprintf (stderr, " Starting OFB checks.\n");
-
+
for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
{
if (verbose)
- fprintf (stderr, " checking OFB mode for %s [%i]\n",
+ fprintf (stderr, " checking OFB mode for %s [%i]\n",
gcry_cipher_algo_name (tv[i].algo),
tv[i].algo);
err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_OFB, 0);
@@ -941,7 +941,7 @@ check_ofb_cipher (void)
for (j = 0; tv[i].data[j].inlen; j++)
{
int byteNum;
- for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
+ for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
{
err = gcry_cipher_encrypt (hde, out+byteNum, 1,
(tv[i].data[j].plaintext) + byteNum,
@@ -959,7 +959,7 @@ check_ofb_cipher (void)
if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
fail ("aes-ofb, encrypt mismatch entry %d:%d\n", i, j);
- for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
+ for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
{
err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
if (err)
@@ -1181,16 +1181,16 @@ check_ciphers (void)
static void
check_cipher_modes(void)
-{
+{
if (verbose)
fprintf (stderr, "Starting Cipher Mode checks.\n");
-
+
check_aes128_cbc_cts_cipher ();
check_cbc_mac_cipher ();
check_ctr_cipher ();
check_cfb_cipher ();
check_ofb_cipher ();
-
+
if (verbose)
fprintf (stderr, "Completed Cipher Mode checks.\n");
}
@@ -1405,16 +1405,16 @@ check_digests (void)
{ GCRY_MD_TIGER1, "abcdefghijklmnopqrstuvwxyz",
"\x17\x14\xA4\x72\xEE\xE5\x7D\x30\x04\x04\x12\xBF"
"\xCC\x55\x03\x2A\x0B\x11\x60\x2F\xF3\x7B\xEE\xE9" },
- { GCRY_MD_TIGER1,
+ { GCRY_MD_TIGER1,
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"\x0F\x7B\xF9\xA1\x9B\x9C\x58\xF2\xB7\x61\x0D\xF7"
"\xE8\x4F\x0A\xC3\xA7\x1C\x63\x1E\x7B\x53\xF7\x8E" },
- { GCRY_MD_TIGER1,
+ { GCRY_MD_TIGER1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz" "0123456789",
"\x8D\xCE\xA6\x80\xA1\x75\x83\xEE\x50\x2B\xA3\x8A"
"\x3C\x36\x86\x51\x89\x0F\xFB\xCC\xDC\x49\xA8\xCC" },
- { GCRY_MD_TIGER1,
+ { GCRY_MD_TIGER1,
"1234567890" "1234567890" "1234567890" "1234567890"
"1234567890" "1234567890" "1234567890" "1234567890",
"\x1C\x14\x79\x55\x29\xFD\x9F\x20\x7A\x95\x8F\x84"
@@ -1438,16 +1438,16 @@ check_digests (void)
{ GCRY_MD_TIGER2, "abcdefghijklmnopqrstuvwxyz",
"\xF5\xB6\xB6\xA7\x8C\x40\x5C\x85\x47\xE9\x1C\xD8"
"\x62\x4C\xB8\xBE\x83\xFC\x80\x4A\x47\x44\x88\xFD" },
- { GCRY_MD_TIGER2,
+ { GCRY_MD_TIGER2,
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
"\xA6\x73\x7F\x39\x97\xE8\xFB\xB6\x3D\x20\xD2\xDF"
"\x88\xF8\x63\x76\xB5\xFE\x2D\x5C\xE3\x66\x46\xA9" },
- { GCRY_MD_TIGER2,
+ { GCRY_MD_TIGER2,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz" "0123456789",
"\xEA\x9A\xB6\x22\x8C\xEE\x7B\x51\xB7\x75\x44\xFC"
"\xA6\x06\x6C\x8C\xBB\x5B\xBA\xE6\x31\x95\x05\xCD" },
- { GCRY_MD_TIGER2,
+ { GCRY_MD_TIGER2,
"1234567890" "1234567890" "1234567890" "1234567890"
"1234567890" "1234567890" "1234567890" "1234567890",
"\xD8\x52\x78\x11\x53\x29\xEB\xAA\x0E\xEC\x85\xEC"
@@ -1501,10 +1501,10 @@ check_digests (void)
continue;
}
if (verbose)
- fprintf (stderr, " checking %s [%i] for length %zi\n",
+ fprintf (stderr, " checking %s [%i] for length %zi\n",
gcry_md_algo_name (algos[i].md),
algos[i].md,
- !strcmp (algos[i].data, "!")?
+ !strcmp (algos[i].data, "!")?
1000000 : strlen(algos[i].data));
check_one_md (algos[i].md, algos[i].data, strlen (algos[i].data),
@@ -1516,7 +1516,7 @@ check_digests (void)
}
static void
-check_one_hmac (int algo, const char *data, int datalen,
+check_one_hmac (int algo, const char *data, int datalen,
const char *key, int keylen, const char *expect)
{
gcry_md_hd_t hd, hd2;
@@ -1650,7 +1650,7 @@ check_hmac (void)
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
"\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99\xf2\x08"
"\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e\x3f\xf4\x67\x29\x66\x5b" },
- { GCRY_MD_SHA256,
+ { GCRY_MD_SHA256,
"Test Using Larger Than Block-Size Key - Hash Key First",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1663,7 +1663,7 @@ check_hmac (void)
"\xaa\xaa\xaa",
"\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f"
"\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54" },
- { GCRY_MD_SHA256,
+ { GCRY_MD_SHA256,
"This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1703,7 +1703,7 @@ check_hmac (void)
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
"\x6c\x11\x50\x68\x74\x01\x3c\xac\x6a\x2a\xbc\x1b\xb3\x82\x62"
"\x7c\xec\x6a\x90\xd8\x6e\xfc\x01\x2d\xe7\xaf\xec\x5a" },
- { GCRY_MD_SHA224,
+ { GCRY_MD_SHA224,
"Test Using Larger Than Block-Size Key - Hash Key First",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1716,7 +1716,7 @@ check_hmac (void)
"\xaa\xaa\xaa",
"\x95\xe9\xa0\xdb\x96\x20\x95\xad\xae\xbe\x9b\x2d\x6f\x0d\xbc\xe2"
"\xd4\x99\xf1\x12\xf2\xd2\xb7\x27\x3f\xa6\x87\x0e" },
- { GCRY_MD_SHA224,
+ { GCRY_MD_SHA224,
"This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1760,7 +1760,7 @@ check_hmac (void)
"\x3e\x8a\x69\xb7\x78\x3c\x25\x85\x19\x33\xab\x62\x90\xaf\x6c\xa7"
"\x7a\x99\x81\x48\x08\x50\x00\x9c\xc5\x57\x7c\x6e\x1f\x57\x3b\x4e"
"\x68\x01\xdd\x23\xc4\xa7\xd6\x79\xcc\xf8\xa3\x86\xc6\x74\xcf\xfb" },
- { GCRY_MD_SHA384,
+ { GCRY_MD_SHA384,
"Test Using Larger Than Block-Size Key - Hash Key First",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1774,7 +1774,7 @@ check_hmac (void)
"\x4e\xce\x08\x44\x85\x81\x3e\x90\x88\xd2\xc6\x3a\x04\x1b\xc5\xb4"
"\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f\x3c\xd1\x1f\x05\x03\x3a\xc4\xc6"
"\x0c\x2e\xf6\xab\x40\x30\xfe\x82\x96\x24\x8d\xf1\x63\xf4\x49\x52" },
- { GCRY_MD_SHA384,
+ { GCRY_MD_SHA384,
"This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1823,7 +1823,7 @@ check_hmac (void)
"\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f\x80\x50\x36\x1e\xe3\xdb"
"\xa9\x1c\xa5\xc1\x1a\xa2\x5e\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63"
"\xa5\xf1\x97\x41\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd" },
- { GCRY_MD_SHA512,
+ { GCRY_MD_SHA512,
"Test Using Larger Than Block-Size Key - Hash Key First",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1838,7 +1838,7 @@ check_hmac (void)
"\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b\x01\x37\x83\xf8\xf3\x52"
"\x6b\x56\xd0\x37\xe0\x5f\x25\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
"\x95\xe6\x4f\x73\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98" },
- { GCRY_MD_SHA512,
+ { GCRY_MD_SHA512,
"This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
@@ -1871,8 +1871,8 @@ check_hmac (void)
continue;
}
if (verbose)
- fprintf (stderr,
- " checking %s [%i] for %zi byte key and %zi byte data\n",
+ fprintf (stderr,
+ " checking %s [%i] for %zi byte key and %zi byte data\n",
gcry_md_algo_name (algos[i].md),
algos[i].md,
strlen(algos[i].key), strlen(algos[i].data));
@@ -2026,7 +2026,7 @@ check_one_pubkey (int n, test_spec_pubkey_t spec)
do_check_one_pubkey (n, skey, pkey,
(const unsigned char*)spec.key.grip, spec.flags);
-
+
gcry_sexp_release (skey);
gcry_sexp_release (pkey);
}
@@ -2037,10 +2037,10 @@ get_keys_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
if (verbose)
- fprintf (stderr, " generating RSA key:");
+ fprintf (stderr, " generating RSA key:");
rc = gcry_sexp_new (&key_spec,
in_fips_mode ? "(genkey (rsa (nbits 4:1024)))"
- : "(genkey (rsa (nbits 4:1024)(transient-key)))",
+ : "(genkey (rsa (nbits 4:1024)(transient-key)))",
0, 1);
if (rc)
die ("error creating S-expression: %s\n", gpg_strerror (rc));
@@ -2048,7 +2048,7 @@ get_keys_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating RSA key: %s\n", gpg_strerror (rc));
-
+
pub_key = gcry_sexp_find_token (key, "public-key", 0);
if (! pub_key)
die ("public part missing in key\n");
@@ -2219,7 +2219,7 @@ check_pubkey (void)
int
main (int argc, char **argv)
-{
+{
gpg_error_t err;
int last_argc = -1;
int debug = 0;
@@ -2258,7 +2258,7 @@ main (int argc, char **argv)
verbose += 2;
argc--; argv++;
}
- }
+ }
gcry_control (GCRYCTL_SET_VERBOSITY, (int)verbose);
@@ -2302,7 +2302,7 @@ main (int argc, char **argv)
gcry_control (GCRYCTL_FORCE_FIPS_MODE, 0);
if (!gcry_control (GCRYCTL_OPERATIONAL_P, 0))
fail ("not in operational state after self-test\n");
-
+
/* Get us into the error state. */
err = gcry_md_open (&md, GCRY_MD_SHA1, 0);
if (err)
@@ -2335,7 +2335,7 @@ main (int argc, char **argv)
}
}
}
-
+
}
else
{
diff --git a/tests/benchmark.c b/tests/benchmark.c
index ab2aeb29..76dcd485 100644
--- a/tests/benchmark.c
+++ b/tests/benchmark.c
@@ -360,7 +360,7 @@ progress_cb (void *cb_data, const char *what, int printchar,
int current, int total)
{
(void)cb_data;
-
+
fprintf (stderr, PGM ": progress (%s %c %d %d)\n",
what, printchar, current, total);
fflush (stderr);
@@ -606,10 +606,10 @@ cipher_bench ( const char *algoname )
fprintf (stderr, PGM ": error opening cipher `%s'\n", algoname);
exit (1);
}
-
+
err = gcry_cipher_setkey (hd, key, keylen);
if (err)
- {
+ {
fprintf (stderr, "gcry_cipher_setkey failed: %s\n",
gpg_strerror (err));
gcry_cipher_close (hd);
@@ -619,7 +619,7 @@ cipher_bench ( const char *algoname )
buflen = allocated_buflen;
if (modes[modeidx].blocked)
buflen = (buflen / blklen) * blklen;
-
+
start_timer ();
for (i=err=0; !err && i < repetitions; i++)
err = gcry_cipher_encrypt ( hd, outbuf, buflen, buf, buflen);
@@ -629,7 +629,7 @@ cipher_bench ( const char *algoname )
fflush (stdout);
gcry_cipher_close (hd);
if (err)
- {
+ {
fprintf (stderr, "gcry_cipher_encrypt failed: %s\n",
gpg_strerror (err) );
exit (1);
@@ -641,10 +641,10 @@ cipher_bench ( const char *algoname )
fprintf (stderr, PGM ": error opening cipher `%s'/n", algoname);
exit (1);
}
-
+
err = gcry_cipher_setkey (hd, key, keylen);
if (err)
- {
+ {
fprintf (stderr, "gcry_cipher_setkey failed: %s\n",
gpg_strerror (err));
gcry_cipher_close (hd);
@@ -659,7 +659,7 @@ cipher_bench ( const char *algoname )
fflush (stdout);
gcry_cipher_close (hd);
if (err)
- {
+ {
fprintf (stderr, "gcry_cipher_decrypt failed: %s\n",
gpg_strerror (err) );
exit (1);
@@ -1032,17 +1032,17 @@ mpi_bench (void)
do_powm (
"20A94417D4D5EF2B2DA99165C7DC87DADB3979B72961AF90D09D59BA24CB9A10166FDCCC9C659F2B9626EC23F3FA425F564A072BA941B03FA81767CC289E4",
- "29",
+ "29",
"B870187A323F1ECD5B8A0B4249507335A1C4CE8394F38FD76B08C78A42C58F6EA136ACF90DFE8603697B1694A3D81114D6117AC1811979C51C4DD013D52F8"
);
do_powm (
"20A94417D4D5EF2B2DA99165C7DC87DADB3979B72961AF90D09D59BA24CB9A10166FDCCC9C659F2B9626EC23F3FA425F564A072BA941B03FA81767CC289E41071F0246879A442658FBD18C1771571E7073EEEB2160BA0CBFB3404D627069A6CFBD53867AD2D9D40231648000787B5C84176B4336144644AE71A403CA40716",
- "29",
+ "29",
"B870187A323F1ECD5B8A0B4249507335A1C4CE8394F38FD76B08C78A42C58F6EA136ACF90DFE8603697B1694A3D81114D6117AC1811979C51C4DD013D52F8FC4EE4BB446B83E48ABED7DB81CBF5E81DE4759E8D68AC985846D999F96B0D8A80E5C69D272C766AB8A23B40D50A4FA889FBC2BD2624222D8EB297F4BAEF8593847"
);
do_powm (
"20A94417D4D5EF2B2DA99165C7DC87DADB3979B72961AF90D09D59BA24CB9A10166FDCCC9C659F2B9626EC23F3FA425F564A072BA941B03FA81767CC289E41071F0246879A442658FBD18C1771571E7073EEEB2160BA0CBFB3404D627069A6CFBD53867AD2D9D40231648000787B5C84176B4336144644AE71A403CA4071620A94417D4D5EF2B2DA99165C7DC87DADB3979B72961AF90D09D59BA24CB9A10166FDCCC9C659F2B9626EC23F3FA425F564A072BA941B03FA81767CC289E41071F0246879A442658FBD18C1771571E7073EEEB2160BA0CBFB3404D627069A6CFBD53867AD2D9D40231648000787B5C84176B4336144644AE71A403CA40716",
- "29",
+ "29",
"B870187A323F1ECD5B8A0B4249507335A1C4CE8394F38FD76B08C78A42C58F6EA136ACF90DFE8603697B1694A3D81114D6117AC1811979C51C4DD013D52F8FC4EE4BB446B83E48ABED7DB81CBF5E81DE4759E8D68AC985846D999F96B0D8A80E5C69D272C766AB8A23B40D50A4FA889FBC2BD2624222D8EB297F4BAEF8593847B870187A323F1ECD5B8A0B4249507335A1C4CE8394F38FD76B08C78A42C58F6EA136ACF90DFE8603697B1694A3D81114D6117AC1811979C51C4DD013D52F8FC4EE4BB446B83E48ABED7DB81CBF5E81DE4759E8D68AC985846D999F96B0D8A80E5C69D272C766AB8A23B40D50A4FA889FBC2BD2624222D8EB297F4BAEF8593847"
);
@@ -1127,7 +1127,7 @@ main( int argc, char **argv )
argc--; argv++;
with_progress = 1;
}
- }
+ }
gcry_control (GCRYCTL_SET_VERBOSITY, (int)verbose);
@@ -1154,7 +1154,7 @@ main( int argc, char **argv )
cipher_repetitions = 1;
if (hash_repetitions < 1)
hash_repetitions = 1;
-
+
if ( !argc )
{
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
@@ -1227,7 +1227,6 @@ main( int argc, char **argv )
if (in_fips_mode && !gcry_fips_mode_active ())
fprintf (stderr, PGM ": FIPS mode is not anymore active\n");
-
+
return 0;
}
-
diff --git a/tests/cavs_driver.pl b/tests/cavs_driver.pl
index 7111f0f4..b95e9b14 100755
--- a/tests/cavs_driver.pl
+++ b/tests/cavs_driver.pl
@@ -11,7 +11,7 @@
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
+# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
@@ -255,7 +255,7 @@ my $dsa_verify;
# generate a new DSA key with the following properties:
# PEM format
-# $1 keyfile name
+# $1 keyfile name
# return: file created, hash with keys of P, Q, G in hex format
my $gen_dsakey;
@@ -497,7 +497,7 @@ sub libgcrypt_hmac($$$$) {
my $hashtype = shift;
my $program = "fipsdrv --key $key --algo $hashtype hmac-sha";
- return pipe_through_program($msg, $program);
+ return pipe_through_program($msg, $program);
}
sub libgcrypt_dsa_pqggen($) {
@@ -623,7 +623,7 @@ sub pipe_through_program($@) {
my ($CO, $CI);
my $pid = open2($CO, $CI, @args);
-
+
my $out = "";
my $len = length($in);
my $first = 1;
@@ -659,7 +659,7 @@ sub pipe_through_program($@) {
}
close $CO or die "broken pipe: $!";
waitpid $pid, 0;
-
+
return $out;
}
@@ -881,7 +881,7 @@ sub der_pos_bigint($) {
# returns number as signed DER integer encoding
sub der_int($) {
my $n = shift;
-
+
return der_bigint(int_base256_signed($n));
}
@@ -958,11 +958,11 @@ sub der_unit_test {
# OpenSSL missing functionality workarounds
## Format of an RSA public key:
-# 0:d=0 hl=3 l= 159 cons: SEQUENCE
-# 3:d=1 hl=2 l= 13 cons: SEQUENCE
+# 0:d=0 hl=3 l= 159 cons: SEQUENCE
+# 3:d=1 hl=2 l= 13 cons: SEQUENCE
# 5:d=2 hl=2 l= 9 prim: OBJECT :rsaEncryption
-# 16:d=2 hl=2 l= 0 prim: NULL
-# 18:d=1 hl=3 l= 141 prim: BIT STRING
+# 16:d=2 hl=2 l= 0 prim: NULL
+# 18:d=1 hl=3 l= 141 prim: BIT STRING
# [ sequence: INTEGER (n), INTEGER (e) ]
# generate RSA pub key in PEM format
@@ -1073,7 +1073,7 @@ sub kat($$$$$$$$) {
$out .= "KEY3 = $key3\n";
$key1= $key1 . $key3;
}
-
+
$out .= "IV = $iv\n" if (defined($iv) && $iv ne "");
if ($enc) {
$out .= "PLAINTEXT = $pt\n";
@@ -1250,7 +1250,7 @@ sub crypto_mct($$$$$$$$) {
#print STDERR "calc_data=", bin2hex($calc_data), "\n";
if ( (!$enc && $ciph =~ /des/) ||
- $ciph =~ /rc4/ ||
+ $ciph =~ /rc4/ ||
$cipher =~ /ecb/ ) {
#TDES in decryption mode, RC4 and ECB mode
#have a special rule
@@ -1269,7 +1269,7 @@ sub crypto_mct($$$$$$$$) {
} else {
$out .= "PLAINTEXT = ". bin2hex($calc_data). "\n\n";
}
-
+
if ( $ciph =~ /aes/ ) {
$key1 ^= substr($old_calc_data . $calc_data, -$keylen);
#print STDERR bin2hex($key1)."\n";
@@ -1445,20 +1445,20 @@ sub rsa_keygen($$$$$$$$) {
my ($P, $Q, $N, $D) = split(/\n/, $ret);
- $out .= "e = $e\n";
- $out .= "xp1 = $xp1\n";
- $out .= "xp2 = $xp2\n";
- $out .= "Xp = $Xp\n";
+ $out .= "e = $e\n";
+ $out .= "xp1 = $xp1\n";
+ $out .= "xp2 = $xp2\n";
+ $out .= "Xp = $Xp\n";
$out .= "p = $P\n";
- $out .= "xq1 = $xq1\n";
- $out .= "xq2 = $xq2\n";
- $out .= "Xq = $Xq\n";
+ $out .= "xq1 = $xq1\n";
+ $out .= "xq2 = $xq2\n";
+ $out .= "Xq = $Xq\n";
$out .= "q = $Q\n";
$out .= "n = $N\n";
$out .= "d = $D\n\n";
return $out;
-
+
}
# X9.31 RNG test
@@ -1693,7 +1693,7 @@ sub parse($$) {
# '# "SigVer PKCS#1 Ver 1.5" information for "IBMRHEL5"'
# '# "SigGen PKCS#1 Ver 1.5" information for "IBMRHEL5"'
# '#RC4VS MCT test data'
-
+
# avoid false positives from user specified 'for "PRODUCT"' strings
my $tmpline = $line;
$tmpline =~ s/ for ".*"//;
diff --git a/tests/cavs_tests.sh b/tests/cavs_tests.sh
index b9aa6216..7d8499bd 100755
--- a/tests/cavs_tests.sh
+++ b/tests/cavs_tests.sh
@@ -14,7 +14,7 @@
#
# 1. Cd to the libgcrypt/tests directory
#
-# 2. Unpack the test vector tarball into subdirectory named "cavs".
+# 2. Unpack the test vector tarball into subdirectory named "cavs".
# An example directory layout after unpacking might be:
# libgcrypt/tests/cavs/AES/req/CBCGFSbox128.req
# libgcrypt/tests/cavs/AES/req/CFB128MCT128.req
@@ -39,7 +39,7 @@ continue_mode=no
[ "$1" = "--continue" ] && continue_mode=yes
-# Function to run one test.
+# Function to run one test.
# The argument is the request file name.
function run_one_test () {
local reqfile="$1"
@@ -57,12 +57,12 @@ function run_one_test () {
if echo "$reqfile" | grep '/DSA/req/' >/dev/null 2>/dev/null; then
dflag="-D"
- fi
-
+ fi
+
if ./cavs_driver.pl -I libgcrypt $dflag "$reqfile"; then
if [ -f "$tmprspfile" ]; then
mv "$tmprspfile" "$rspfile"
- else
+ else
echo "failed test: $reqfile" >&2
: >"$errors_seen_file"
fi
diff --git a/tests/fips186-dsa.c b/tests/fips186-dsa.c
index cdb507b6..401acff0 100644
--- a/tests/fips186-dsa.c
+++ b/tests/fips186-dsa.c
@@ -140,7 +140,7 @@ extract_cmp_mpi (gcry_sexp_t sexp, const char *name, const char *expected)
l1 = gcry_sexp_find_token (sexp, name, 0);
a = gcry_sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG);
b = mpi_from_string (expected);
- if (!a)
+ if (!a)
fail ("parameter \"%s\" missing in key\n", name);
else if ( gcry_mpi_cmp (a, b) )
fail ("parameter \"%s\" does not match expected value\n", name);
@@ -162,7 +162,7 @@ extract_cmp_data (gcry_sexp_t sexp, const char *name, const char *expected)
l1 = gcry_sexp_find_token (sexp, name, 0);
a = gcry_sexp_nth_data (l1, 1, &alen);
b = data_from_hex (expected, &blen);
- if (!a)
+ if (!a)
fail ("parameter \"%s\" missing in key\n", name);
else if ( alen != blen || memcmp (a, b, alen) )
fail ("parameter \"%s\" does not match expected value\n", name);
@@ -178,7 +178,7 @@ extract_cmp_int (gcry_sexp_t sexp, const char *name, int expected)
l1 = gcry_sexp_find_token (sexp, name, 0);
a = gcry_sexp_nth_string (l1, 1);
- if (!a)
+ if (!a)
fail ("parameter \"%s\" missing in key\n", name);
else if ( strtoul (a, NULL, 10) != expected )
fail ("parameter \"%s\" does not match expected value\n", name);
@@ -290,7 +290,7 @@ check_dsa_gen_186_2 (void)
},
/* These tests are generated by the OpenSSL FIPS version. */
- {
+ {
1024,
"A404363903FDCE86839BCFD953AAD2DA2B0E70CAED3B5FF5D68F15A1C4BB0A793C"
"A9D58FC956804C5901DE0AF99F345ED1A8617C687864BAC044B7C3C3E732A2B255"
@@ -351,7 +351,7 @@ check_dsa_gen_186_2 (void)
397,
"02"
},
- {
+ {
1024,
"D40E4F6461E145859CCF60FD57962840BD75FFF12C22F76626F566842252AD068"
"29745F0147056354F6C016CF12762B0E331787925B8128CF5AF81F9B176A51934"
@@ -398,7 +398,7 @@ check_dsa_gen_186_2 (void)
fail ("error generating key %d: %s\n", tno, gpg_strerror (err));
continue;
}
-
+
if (verbose > 1)
show_sexp ("generated key:\n", key);
@@ -444,7 +444,7 @@ main (int argc, char **argv)
verbose = 1;
else if (argc > 1 && !strcmp (argv[1], "--debug"))
{
- verbose = 2;
+ verbose = 2;
debug = 1;
}
diff --git a/tests/fipsdrv.c b/tests/fipsdrv.c
index 29ceedde..2d4c3624 100644
--- a/tests/fipsdrv.c
+++ b/tests/fipsdrv.c
@@ -2,17 +2,17 @@
Copyright (C) 2008 Free Software Foundation, Inc.
This file is part of Libgcrypt.
-
+
Libgcrypt is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
Libgcrypt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -129,14 +129,14 @@ enum
};
/* ASN.1 Parser object. */
-struct tag_info
+struct tag_info
{
int class; /* Object class. */
unsigned long tag; /* The tag of the object. */
unsigned long length; /* Length of the values. */
int nhdr; /* Length of the header (TL). */
unsigned int ndef:1; /* The object has an indefinite length. */
- unsigned int cons:1; /* This is a constructed object. */
+ unsigned int cons:1; /* This is a constructed object. */
};
@@ -249,7 +249,7 @@ read_textline (FILE *fp)
/* Read line but skip over initial empty lines. */
do
{
- do
+ do
{
if (!fgets (line, sizeof line, fp))
{
@@ -330,14 +330,14 @@ read_file (FILE *fp, int decode, size_t *r_length)
#endif
buffer = NULL;
buflen = 0;
- do
+ do
{
bufsize += NCHUNK;
if (!buffer)
buffer = gcry_xmalloc (bufsize);
else
buffer = gcry_xrealloc (buffer, bufsize);
-
+
nread = fread (buffer + buflen, 1, NCHUNK, fp);
if (nread < NCHUNK && ferror (fp))
{
@@ -379,7 +379,7 @@ read_file (FILE *fp, int decode, size_t *r_length)
static size_t
base64_decode (char *buffer, size_t length)
{
- static unsigned char const asctobin[128] =
+ static unsigned char const asctobin[128] =
{
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -391,7 +391,7 @@ base64_decode (char *buffer, size_t length)
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
- 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff
+ 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff
};
int idx = 0;
@@ -408,7 +408,7 @@ base64_decode (char *buffer, size_t length)
for (; length && *s != '\n'; length--, s++)
;
break;
- }
+ }
lfseen = (*s == '\n');
}
@@ -463,7 +463,7 @@ base64_decode (char *buffer, size_t length)
from the TLV triplet. Update BUFFER and BUFLEN on success. Checks
that the encoded length does not exhaust the length of the provided
buffer. */
-static int
+static int
parse_tag (unsigned char const **buffer, size_t *buflen, struct tag_info *ti)
{
int c;
@@ -529,13 +529,13 @@ parse_tag (unsigned char const **buffer, size_t *buflen, struct tag_info *ti)
}
ti->length = len;
}
-
+
if (ti->class == UNIVERSAL && !ti->tag)
ti->length = 0;
if (ti->length > length)
return -1; /* Data larger than buffer. */
-
+
*buffer = buf;
*buflen = length;
return 0;
@@ -569,7 +569,7 @@ read_private_key_file (const char *fname, int show)
fclose (fp);
buflen = base64_decode (buffer, buflen);
-
+
/* Parse the ASN.1 structure. */
der = (const unsigned char*)buffer;
derlen = buflen;
@@ -607,13 +607,13 @@ read_private_key_file (const char *fname, int show)
gcry_free (buffer);
/* Convert from OpenSSL parameter ordering to the OpenPGP order. */
- /* First check that p < q; if not swap p and q and recompute u. */
+ /* First check that p < q; if not swap p and q and recompute u. */
if (gcry_mpi_cmp (keyparms[3], keyparms[4]) > 0)
{
gcry_mpi_swap (keyparms[3], keyparms[4]);
gcry_mpi_invm (keyparms[7], keyparms[3], keyparms[4]);
}
-
+
/* Build the S-expression. */
err = gcry_sexp_build (&s_key, NULL,
"(private-key(rsa(n%m)(e%m)"
@@ -622,12 +622,12 @@ read_private_key_file (const char *fname, int show)
keyparms[3], keyparms[4], keyparms[7] );
if (err)
die ("error building S-expression: %s\n", gpg_strerror (err));
-
+
for (idx=0; idx < n_keyparms; idx++)
gcry_mpi_release (keyparms[idx]);
-
+
return s_key;
-
+
bad_asn1:
die ("invalid ASN.1 structure in `%s'\n", fname);
return NULL; /*NOTREACHED*/
@@ -661,7 +661,7 @@ read_public_key_file (const char *fname, int show)
fclose (fp);
buflen = base64_decode (buffer, buflen);
-
+
/* Parse the ASN.1 structure. */
der = (const unsigned char*)buffer;
derlen = buflen;
@@ -673,7 +673,7 @@ read_public_key_file (const char *fname, int show)
goto bad_asn1;
/* We skip the description of the key parameters and assume it is RSA. */
der += ti.length; derlen -= ti.length;
-
+
if ( parse_tag (&der, &derlen, &ti)
|| ti.tag != TAG_BIT_STRING || ti.class || ti.cons || ti.ndef)
goto bad_asn1;
@@ -715,12 +715,12 @@ read_public_key_file (const char *fname, int show)
keyparms[0], keyparms[1] );
if (err)
die ("error building S-expression: %s\n", gpg_strerror (err));
-
+
for (idx=0; idx < n_keyparms; idx++)
gcry_mpi_release (keyparms[idx]);
-
+
return s_key;
-
+
bad_asn1:
die ("invalid ASN.1 structure in `%s'\n", fname);
return NULL; /*NOTREACHED*/
@@ -796,10 +796,10 @@ print_buffer (const void *buffer, size_t length)
if (base64_output)
{
- static const unsigned char bintoasc[64+1] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "0123456789+/";
+ static const unsigned char bintoasc[64+1] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
const unsigned char *p;
unsigned char inbuf[4];
char outbuf[4];
@@ -820,7 +820,7 @@ print_buffer (const void *buffer, size_t length)
if (fwrite (outbuf, 4, 1, stdout) != 1)
writerr = 1;
idx = 0;
- if (++quads >= (64/4))
+ if (++quads >= (64/4))
{
if (fwrite ("\n", 1, 1, stdout) != 1)
writerr = 1;
@@ -836,8 +836,8 @@ print_buffer (const void *buffer, size_t length)
outbuf[1] = bintoasc[((*inbuf<<4)&060)&077];
outbuf[2] = outbuf[3] = '=';
}
- else
- {
+ else
+ {
outbuf[1] = bintoasc[(((*inbuf<<4)&060)
|((inbuf[1]>>4)&017))&077];
outbuf[2] = bintoasc[((inbuf[1]<<2)&074)&077];
@@ -858,7 +858,7 @@ print_buffer (const void *buffer, size_t length)
else
{
const unsigned char *p = buffer;
-
+
if (verbose > 1)
showhex ("sent line", buffer, length);
while (length-- && !ferror (stdout) )
@@ -895,7 +895,7 @@ print_mpi_line (gcry_mpi_t a, int no_lz)
p = buf;
if (no_lz && p[0] == '0' && p[1] == '0' && p[2])
p += 2;
-
+
printf ("%s\n", p);
if (ferror (stdout))
writerr++;
@@ -913,7 +913,7 @@ print_data_line (const void *data, size_t datalen)
{
const unsigned char *p = data;
int writerr = 0;
-
+
while (data && datalen-- && !ferror (stdout) )
printf ("%02X", *p++);
putchar ('\n');
@@ -944,13 +944,13 @@ print_sexp (gcry_sexp_t a, FILE *fp)
static gcry_error_t
-init_external_rng_test (void **r_context,
+init_external_rng_test (void **r_context,
unsigned int flags,
const void *key, size_t keylen,
const void *seed, size_t seedlen,
const void *dt, size_t dtlen)
{
- return gcry_control (PRIV_CTL_INIT_EXTRNG_TEST,
+ return gcry_control (PRIV_CTL_INIT_EXTRNG_TEST,
r_context, flags,
key, keylen,
seed, seedlen,
@@ -973,14 +973,14 @@ deinit_external_rng_test (void *context)
/* Given an OpenSSL cipher name NAME, return the Libgcrypt algirithm
identified and store the libgcrypt mode at R_MODE. Returns 0 on
error. */
-static int
+static int
map_openssl_cipher_name (const char *name, int *r_mode)
{
static struct {
const char *name;
int algo;
int mode;
- } table[] =
+ } table[] =
{
{ "bf-cbc", GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CBC },
{ "bf", GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CBC },
@@ -1020,7 +1020,7 @@ map_openssl_cipher_name (const char *name, int *r_mode)
{ "aes-192-cfb", GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CFB },
{ "aes-192-ecb", GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_ECB },
{ "aes-192-ofb", GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_OFB },
-
+
{ "aes-256-cbc", GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC },
{ "aes-256", GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC },
{ "aes-256-cfb", GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CFB },
@@ -1048,7 +1048,7 @@ map_openssl_cipher_name (const char *name, int *r_mode)
processes it and writes it out until EOF. */
static void
run_encrypt_decrypt (int encrypt_mode,
- int cipher_algo, int cipher_mode,
+ int cipher_algo, int cipher_mode,
const void *iv_buffer, size_t iv_buflen,
const void *key_buffer, size_t key_buflen,
const void *data, size_t datalen, FILE *fp)
@@ -1063,7 +1063,7 @@ run_encrypt_decrypt (int encrypt_mode,
err = gcry_cipher_open (&hd, cipher_algo, cipher_mode, 0);
if (err)
- die ("gcry_cipher_open failed for algo %d, mode %d: %s\n",
+ die ("gcry_cipher_open failed for algo %d, mode %d: %s\n",
cipher_algo, cipher_mode, gpg_strerror (err));
blocklen = gcry_cipher_get_algo_blklen (cipher_algo);
@@ -1108,7 +1108,7 @@ run_encrypt_decrypt (int encrypt_mode,
if (err)
die ("gcry_cipher_%scrypt failed: %s\n",
encrypt_mode? "en":"de", gpg_strerror (err));
-
+
print_buffer (outbuf, outbuflen);
}
while (inbuf);
@@ -1133,7 +1133,7 @@ get_current_iv (gcry_cipher_hd_t hd, void *buffer, size_t buflen)
/* Run the inner loop of the CAVS monte carlo test. */
static void
-run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
+run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
const void *iv_buffer, size_t iv_buflen,
const void *key_buffer, size_t key_buflen,
const void *data, size_t datalen, int iterations)
@@ -1146,12 +1146,12 @@ run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
char output[16];
char last_output[16];
char last_last_output[16];
- char last_iv[16];
+ char last_iv[16];
err = gcry_cipher_open (&hd, cipher_algo, cipher_mode, 0);
if (err)
- die ("gcry_cipher_open failed for algo %d, mode %d: %s\n",
+ die ("gcry_cipher_open failed for algo %d, mode %d: %s\n",
cipher_algo, cipher_mode, gpg_strerror (err));
blocklen = gcry_cipher_get_algo_blklen (cipher_algo);
@@ -1175,7 +1175,7 @@ run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
}
if (datalen != blocklen)
- die ("length of input (%u) does not match block length (%u)\n",
+ die ("length of input (%u) does not match block length (%u)\n",
(unsigned int)datalen, (unsigned int)blocklen);
memcpy (input, data, datalen);
memset (output, 0, sizeof output);
@@ -1194,7 +1194,7 @@ run_cipher_mct_loop (int encrypt_mode, int cipher_algo, int cipher_mode,
die ("gcry_cipher_%scrypt failed: %s\n",
encrypt_mode? "en":"de", gpg_strerror (err));
-
+
if (encrypt_mode && (cipher_mode == GCRY_CIPHER_MODE_CFB
|| cipher_mode == GCRY_CIPHER_MODE_CBC))
memcpy (input, last_iv, blocklen);
@@ -1243,7 +1243,7 @@ run_digest (int digest_algo, const void *data, size_t datalen)
err = gcry_md_open (&hd, digest_algo, 0);
if (err)
- die ("gcry_md_open failed for algo %d: %s\n",
+ die ("gcry_md_open failed for algo %d: %s\n",
digest_algo, gpg_strerror (err));
gcry_md_write (hd, data, datalen);
@@ -1256,7 +1256,7 @@ run_digest (int digest_algo, const void *data, size_t datalen)
/* Run a HMAC operation. */
static void
-run_hmac (int digest_algo, const void *key, size_t keylen,
+run_hmac (int digest_algo, const void *key, size_t keylen,
const void *data, size_t datalen)
{
gpg_error_t err;
@@ -1266,12 +1266,12 @@ run_hmac (int digest_algo, const void *key, size_t keylen,
err = gcry_md_open (&hd, digest_algo, GCRY_MD_FLAG_HMAC);
if (err)
- die ("gcry_md_open failed for HMAC algo %d: %s\n",
+ die ("gcry_md_open failed for HMAC algo %d: %s\n",
digest_algo, gpg_strerror (err));
gcry_md_setkey (hd, key, keylen);
if (err)
- die ("gcry_md_setkey failed for HMAC algo %d: %s\n",
+ die ("gcry_md_setkey failed for HMAC algo %d: %s\n",
digest_algo, gpg_strerror (err));
gcry_md_write (hd, data, datalen);
@@ -1349,7 +1349,7 @@ run_rsa_derive (const void *data, size_t datalen)
static size_t
compute_tag_length (size_t n)
-{
+{
int needed = 0;
if (n < 128)
@@ -1366,7 +1366,7 @@ compute_tag_length (size_t n)
static unsigned char *
store_tag_length (unsigned char *p, int tag, size_t n)
-{
+{
if (tag == TAG_SEQUENCE)
tag |= 0x20; /* constructed */
@@ -1394,11 +1394,11 @@ store_tag_length (unsigned char *p, int tag, size_t n)
is:
SEQUENCE {
- INTEGER (0) -- Unknown constant.
+ INTEGER (0) -- Unknown constant.
INTEGER -- n
INTEGER -- e
INTEGER -- d
- INTEGER -- p
+ INTEGER -- p
INTEGER -- q (with p < q)
INTEGER -- dmp1 = d mod (p-1)
INTEGER -- dmq1 = d mod (q-1)
@@ -1418,7 +1418,7 @@ run_rsa_gen (int keysize, int pubexp)
size_t derlen, needed, n;
unsigned char *derbuf, *der;
- err = gcry_sexp_build (&keyspec, NULL,
+ err = gcry_sexp_build (&keyspec, NULL,
"(genkey (rsa (nbits %d)(rsa-use-e %d)))",
keysize, pubexp);
if (err)
@@ -1428,7 +1428,7 @@ run_rsa_gen (int keysize, int pubexp)
err = gcry_pk_genkey (&key, keyspec);
if (err)
die ("gcry_pk_genkey failed for RSA: %s\n", gpg_strerror (err));
-
+
gcry_sexp_release (keyspec);
l1 = gcry_sexp_find_token (key, "private-key", 0);
@@ -1445,7 +1445,7 @@ run_rsa_gen (int keysize, int pubexp)
/* Extract the parameters from the S-expression and store them in a
well defined order in KEYPARMS. */
- for (idx=0; idx < DIM(keyparms); idx++)
+ for (idx=0; idx < DIM(keyparms); idx++)
{
if (keyelems[idx] == '.')
{
@@ -1464,7 +1464,7 @@ run_rsa_gen (int keysize, int pubexp)
gcry_sexp_release (key);
- /* Check that p < q; if not swap p and q and recompute u. */
+ /* Check that p < q; if not swap p and q and recompute u. */
if (gcry_mpi_cmp (keyparms[3], keyparms[4]) > 0)
{
gcry_mpi_swap (keyparms[3], keyparms[4]);
@@ -1478,8 +1478,8 @@ run_rsa_gen (int keysize, int pubexp)
gcry_mpi_mod (keyparms[6], keyparms[2], keyparms[6]);
/* Compute the length of the DER encoding. */
- needed = compute_tag_length (1) + 1;
- for (idx=0; idx < DIM(keyparms); idx++)
+ needed = compute_tag_length (1) + 1;
+ for (idx=0; idx < DIM(keyparms); idx++)
{
err = gcry_mpi_print (GCRYMPI_FMT_STD, NULL, 0, &n, keyparms[idx]);
if (err)
@@ -1487,7 +1487,7 @@ run_rsa_gen (int keysize, int pubexp)
keyparmslen[idx] = n;
needed += compute_tag_length (n) + n;
}
-
+
/* Store the key parameters. */
derlen = compute_tag_length (needed) + needed;
der = derbuf = gcry_xmalloc (derlen);
@@ -1495,10 +1495,10 @@ run_rsa_gen (int keysize, int pubexp)
der = store_tag_length (der, TAG_SEQUENCE, needed);
der = store_tag_length (der, TAG_INTEGER, 1);
*der++ = 0;
- for (idx=0; idx < DIM(keyparms); idx++)
+ for (idx=0; idx < DIM(keyparms); idx++)
{
der = store_tag_length (der, TAG_INTEGER, keyparmslen[idx]);
- err = gcry_mpi_print (GCRYMPI_FMT_STD, der,
+ err = gcry_mpi_print (GCRYMPI_FMT_STD, der,
keyparmslen[idx], NULL, keyparms[idx]);
if (err)
die ("error formatting parameter: %s\n", gpg_strerror (err));
@@ -1506,7 +1506,7 @@ run_rsa_gen (int keysize, int pubexp)
}
/* Print the stuff. */
- for (idx=0; idx < DIM(keyparms); idx++)
+ for (idx=0; idx < DIM(keyparms); idx++)
gcry_mpi_release (keyparms[idx]);
assert (der - derbuf == derlen);
@@ -1534,7 +1534,7 @@ run_rsa_sign (const void *data, size_t datalen,
gcry_mpi_t sig_mpi = NULL;
unsigned char *outbuf;
size_t outlen;
-
+
/* showhex ("D", data, datalen); */
if (pkcs1)
{
@@ -1598,7 +1598,7 @@ run_rsa_sign (const void *data, size_t datalen,
}
}
gcry_sexp_release (s_sig);
-
+
if (!sig_mpi)
die ("no value in returned S-expression\n");
err = gcry_mpi_aprint (GCRYMPI_FMT_STD, &outbuf, &outlen, sig_mpi);
@@ -1622,7 +1622,7 @@ run_rsa_verify (const void *data, size_t datalen, int hashalgo, int pkcs1,
{
gpg_error_t err;
gcry_sexp_t s_data, s_key, s_sig;
-
+
if (pkcs1)
{
unsigned char hash[64];
@@ -1680,7 +1680,7 @@ dsa_gen (int keysize)
gpg_error_t err;
gcry_sexp_t keyspec, key;
- err = gcry_sexp_build (&keyspec, NULL,
+ err = gcry_sexp_build (&keyspec, NULL,
"(genkey (dsa (nbits %d)(use-fips186-2)))",
keysize);
if (err)
@@ -1690,7 +1690,7 @@ dsa_gen (int keysize)
err = gcry_pk_genkey (&key, keyspec);
if (err)
die ("gcry_pk_genkey failed for DSA: %s\n", gpg_strerror (err));
-
+
gcry_sexp_release (keyspec);
return key;
@@ -1705,7 +1705,7 @@ dsa_gen_with_seed (int keysize, const void *seed, size_t seedlen)
gpg_error_t err;
gcry_sexp_t keyspec, key;
- err = gcry_sexp_build (&keyspec, NULL,
+ err = gcry_sexp_build (&keyspec, NULL,
"(genkey"
" (dsa"
" (nbits %d)"
@@ -1720,7 +1720,7 @@ dsa_gen_with_seed (int keysize, const void *seed, size_t seedlen)
err = gcry_pk_genkey (&key, keyspec);
if (err)
die ("gcry_pk_genkey failed for DSA: %s\n", gpg_strerror (err));
-
+
gcry_sexp_release (keyspec);
return key;
@@ -1731,7 +1731,7 @@ dsa_gen_with_seed (int keysize, const void *seed, size_t seedlen)
is the complete key as returned by dsa_gen. We print to stdout
with one parameter per line in hex format using this order: p, q,
g, seed, counter, h. */
-static void
+static void
print_dsa_domain_parameters (gcry_sexp_t key)
{
gcry_sexp_t l1, l2;
@@ -1752,7 +1752,7 @@ print_dsa_domain_parameters (gcry_sexp_t key)
l1 = l2;
/* Extract the parameters from the S-expression and print them to stdout. */
- for (idx=0; "pqg"[idx]; idx++)
+ for (idx=0; "pqg"[idx]; idx++)
{
l2 = gcry_sexp_find_token (l1, "pqg"+idx, 1);
if (!l2)
@@ -1940,7 +1940,7 @@ run_dsa_sign (const void *data, size_t datalen, const char *keyfile)
print_mpi_line (tmpmpi, 1);
gcry_mpi_release (tmpmpi);
gcry_sexp_release (s_tmp);
-
+
s_tmp = gcry_sexp_find_token (s_sig, "s", 0);
tmpmpi = gcry_sexp_nth_mpi (s_tmp, 1, GCRYMPI_FMT_USG);
if (!tmpmpi)
@@ -2005,7 +2005,7 @@ usage (int show_help)
{
if (!show_help)
{
- fputs ("usage: " PGM
+ fputs ("usage: " PGM
" [OPTION] [FILE] (try --help for more information)\n", stderr);
exit (2);
}
@@ -2175,7 +2175,7 @@ main (int argc, char **argv)
standalone_mode = 1;
argc--; argv++;
}
- }
+ }
if (!argc || argc > 2)
usage (0);
@@ -2223,7 +2223,7 @@ main (int argc, char **argv)
if (!data)
die ("error reading%s input\n", binary_input?"":" and decoding");
if (verbose)
- fprintf (stderr, PGM ": %u bytes of input data\n",
+ fprintf (stderr, PGM ": %u bytes of input data\n",
(unsigned int)datalen);
}
else
@@ -2274,7 +2274,7 @@ main (int argc, char **argv)
if (!(data = read_hexline (input, &datalen)))
die ("no data in input\n");
skip_to_empty_line (input);
-
+
run_cipher_mct_loop ((*mode_string == 'e'),
cipher_algo, cipher_mode,
iv_buffer, iv_buflen,
@@ -2348,7 +2348,7 @@ main (int argc, char **argv)
if (err)
die ("init external RNG test failed: %s\n", gpg_strerror (err));
- do
+ do
{
err = run_external_rng_test (context, buffer, sizeof buffer);
if (err)
@@ -2357,12 +2357,12 @@ main (int argc, char **argv)
if (progress)
{
if (!(++count % 1000))
- fprintf (stderr, PGM ": %lu random bytes so far\n",
+ fprintf (stderr, PGM ": %lu random bytes so far\n",
(unsigned long int)count * sizeof buffer);
}
}
while (loop_mode);
-
+
if (progress)
fprintf (stderr, PGM ": %lu random bytes\n",
(unsigned long int)count * sizeof buffer);
@@ -2409,7 +2409,7 @@ main (int argc, char **argv)
else if (!strcmp (mode_string, "rsa-gen"))
{
int keysize;
-
+
if (!binary_output)
base64_output = 1;
@@ -2464,7 +2464,7 @@ main (int argc, char **argv)
else if (!strcmp (mode_string, "dsa-pqg-gen"))
{
int keysize;
-
+
keysize = keysize_string? atoi (keysize_string) : 0;
if (keysize < 1024 || keysize > 3072)
die ("invalid keysize specified; needs to be 1024 .. 3072\n");
@@ -2473,7 +2473,7 @@ main (int argc, char **argv)
else if (!strcmp (mode_string, "dsa-gen"))
{
int keysize;
-
+
keysize = keysize_string? atoi (keysize_string) : 0;
if (keysize < 1024 || keysize > 3072)
die ("invalid keysize specified; needs to be 1024 .. 3072\n");
@@ -2523,4 +2523,3 @@ main (int argc, char **argv)
return 0;
}
-
diff --git a/tests/fipsrngdrv.c b/tests/fipsrngdrv.c
index de2ad1ff..0fc19d56 100644
--- a/tests/fipsrngdrv.c
+++ b/tests/fipsrngdrv.c
@@ -2,17 +2,17 @@
Copyright (C) 2008 Free Software Foundation, Inc.
This file is part of Libgcrypt.
-
+
Libgcrypt is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
Libgcrypt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -89,13 +89,13 @@ hex2bin (const char *string, void *buffer, size_t length)
static gcry_error_t
-init_external_test (void **r_context,
+init_external_test (void **r_context,
unsigned int flags,
const void *key, size_t keylen,
const void *seed, size_t seedlen,
const void *dt, size_t dtlen)
{
- return gcry_control (58,
+ return gcry_control (58,
r_context, flags,
key, keylen,
seed, seedlen,
@@ -152,7 +152,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "--help"))
{
- fputs ("usage: " PGM
+ fputs ("usage: " PGM
" [--verbose] [--binary] [--loop] [--progress] KEY V DT\n",
stdout);
exit (0);
@@ -182,8 +182,8 @@ main (int argc, char **argv)
progress = 1;
argc--; argv++;
}
- }
-
+ }
+
if (!argc)
{
memcpy (key, "1234567890123456", 16);
@@ -222,7 +222,7 @@ main (int argc, char **argv)
if (err)
die ("init external test failed: %s\n", gpg_strerror (err));
- do
+ do
{
int writerr = 0;
@@ -269,4 +269,3 @@ main (int argc, char **argv)
return 0;
}
-
diff --git a/tests/keygen.c b/tests/keygen.c
index f5d5610c..3774624e 100644
--- a/tests/keygen.c
+++ b/tests/keygen.c
@@ -95,7 +95,7 @@ check_generated_rsa_key (gcry_sexp_t key, unsigned long expected_e)
if (verbose)
print_mpi ("e", e);
}
- else if ( gcry_mpi_cmp_ui (e, expected_e))
+ else if ( gcry_mpi_cmp_ui (e, expected_e))
{
print_mpi ("e", e);
fail ("public exponent is not %lu\n", expected_e);
@@ -104,7 +104,7 @@ check_generated_rsa_key (gcry_sexp_t key, unsigned long expected_e)
gcry_mpi_release (e);
gcry_sexp_release (pkey);
}
-
+
skey = gcry_sexp_find_token (key, "private-key", 0);
if (!skey)
fail ("private part missing in return value\n");
@@ -131,7 +131,7 @@ check_rsa_keys (void)
fprintf (stderr, "creating 5 1024 bit DSA keys\n");
for (i=0; i < 5; i++)
{
- rc = gcry_sexp_new (&keyparm,
+ rc = gcry_sexp_new (&keyparm,
"(genkey\n"
" (dsa\n"
" (nbits 4:1024)\n"
@@ -149,7 +149,7 @@ check_rsa_keys (void)
if (verbose)
fprintf (stderr, "creating 1536 bit DSA key\n");
- rc = gcry_sexp_new (&keyparm,
+ rc = gcry_sexp_new (&keyparm,
"(genkey\n"
" (dsa\n"
" (nbits 4:1536)\n"
@@ -173,7 +173,7 @@ check_rsa_keys (void)
if (verbose)
fprintf (stderr, "creating 1024 bit RSA key\n");
- rc = gcry_sexp_new (&keyparm,
+ rc = gcry_sexp_new (&keyparm,
"(genkey\n"
" (rsa\n"
" (nbits 4:1024)\n"
@@ -191,7 +191,7 @@ check_rsa_keys (void)
if (verbose)
fprintf (stderr, "creating 512 bit RSA key with e=257\n");
- rc = gcry_sexp_new (&keyparm,
+ rc = gcry_sexp_new (&keyparm,
"(genkey\n"
" (rsa\n"
" (nbits 3:512)\n"
@@ -209,7 +209,7 @@ check_rsa_keys (void)
if (verbose)
fprintf (stderr, "creating 512 bit RSA key with default e\n");
- rc = gcry_sexp_new (&keyparm,
+ rc = gcry_sexp_new (&keyparm,
"(genkey\n"
" (rsa\n"
" (nbits 3:512)\n"
@@ -275,7 +275,7 @@ progress_cb (void *cb_data, const char *what, int printchar,
(void)what;
(void)current;
(void)total;
-
+
if (printchar == '\n')
fputs ( "<LF>", stdout);
else
@@ -305,7 +305,6 @@ main (int argc, char **argv)
check_rsa_keys ();
check_nonce ();
-
+
return error_count? 1:0;
}
-
diff --git a/tests/keygrip.c b/tests/keygrip.c
index e1908ba3..a33053fa 100644
--- a/tests/keygrip.c
+++ b/tests/keygrip.c
@@ -87,7 +87,7 @@ static struct
" (g #44370CEE0FE8609994183DBFEBA7EEA97D466838BCF65EFF506E35616DA93FA4E572A2F08886B74977BC00CA8CD3DBEA7AEB7DB8CBB180E6975E0D2CA76E023E6DE9F8CCD8826EBA2F72B8516532F6001DEFFAE76AA5E59E0FA33DBA3999B4E92D1703098CDEDCC416CF008801964084CDE1980132B2B78CB4CE9C15A559528B#)"
" (y #3D5DD14AFA2BF24A791E285B90232213D0E3BA74AB1109E768AED19639A322F84BB7D959E2BA92EF73DE4C7F381AA9F4053CFA3CD4527EF9043E304E5B95ED0A3A5A9D590AA641C13DB2B6E32B9B964A6A2C730DD3EA7C8E13F7A140AFF1A91CE375E9B9B960384779DC4EA180FA1F827C52288F366C0770A220F50D6D8FD6F6#)))",
"\x04\xA3\x4F\xA0\x2B\x03\x94\xD7\x32\xAD\xD5\x9B\x50\xAF\xDB\x5D\x57\x22\xA6\x10"
-
+
},
{
GCRY_PK_DSA,
@@ -100,7 +100,7 @@ static struct
" (x #0087F9E91BFBCC1163DE71ED86D557708E32F8ADDE#)))",
"\x04\xA3\x4F\xA0\x2B\x03\x94\xD7\x32\xAD\xD5\x9B\x50\xAF\xDB\x5D\x57\x22\xA6\x10"
},
- {
+ {
GCRY_PK_ECDSA,
"(public-key"
" (ecdsa"
@@ -112,7 +112,7 @@ static struct
" (q #04C8A4CEC2E9A9BC8E173531A67B0840DF345C32E261ADD780E6D83D56EFADFD5DE872F8B854819B59543CE0B7F822330464FBC4E6324DADDCD9D059554F63B344#)))",
"\xE6\xDF\x94\x2D\xBD\x8C\x77\x05\xA3\xDD\x41\x6E\xFC\x04\x01\xDB\x31\x0E\x99\xB6"
},
- {
+ {
GCRY_PK_ECDSA,
"(public-key"
" (ecdsa"
@@ -124,7 +124,7 @@ static struct
" (q #04C8A4CEC2E9A9BC8E173531A67B0840DF345C32E261ADD780E6D83D56EFADFD5DE872F8B854819B59543CE0B7F822330464FBC4E6324DADDCD9D059554F63B344#)))",
"\xE6\xDF\x94\x2D\xBD\x8C\x77\x05\xA3\xDD\x41\x6E\xFC\x04\x01\xDB\x31\x0E\x99\xB6"
},
- {
+ {
GCRY_PK_ECDSA,
"(public-key"
" (ecdsa"
@@ -149,7 +149,7 @@ check (void)
if (gcry_pk_test_algo (key_grips[i].algo))
{
if (verbose)
- fprintf (stderr, "algo %d not available; test skipped\n",
+ fprintf (stderr, "algo %d not available; test skipped\n",
key_grips[i].algo);
continue;
}
@@ -160,11 +160,11 @@ check (void)
ret = gcry_pk_get_keygrip (sexp, buf);
if (!ret)
die ("gcry_pk_get_keygrip failed for %d\n", i);
-
+
if ( memcmp (key_grips[i].grip, buf, sizeof (buf)) )
{
print_hex ("keygrip: ", buf, sizeof buf);
- die ("keygrip for %d does not match\n", i);
+ die ("keygrip for %d does not match\n", i);
}
gcry_sexp_release (sexp);
@@ -199,7 +199,7 @@ main (int argc, char **argv)
die ("version mismatch\n");
gcry_set_progress_handler (progress_handler, NULL);
-
+
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
check ();
diff --git a/tests/mpitests.c b/tests/mpitests.c
index 3ccfae00..cf828425 100644
--- a/tests/mpitests.c
+++ b/tests/mpitests.c
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * USA.
*/
#ifdef HAVE_CONFIG_H
@@ -89,7 +89,7 @@ unsigned char manyff[] = {
-static int
+static int
test_add (void)
{
gcry_mpi_t one;
@@ -97,12 +97,12 @@ test_add (void)
gcry_mpi_t ff;
gcry_mpi_t result;
unsigned char* pc;
-
+
gcry_mpi_scan(&one, GCRYMPI_FMT_USG, ones, sizeof(ones), NULL);
gcry_mpi_scan(&two, GCRYMPI_FMT_USG, twos, sizeof(twos), NULL);
gcry_mpi_scan(&ff, GCRYMPI_FMT_USG, manyff, sizeof(manyff), NULL);
result = gcry_mpi_new(0);
-
+
gcry_mpi_add(result, one, two);
gcry_mpi_aprint(GCRYMPI_FMT_HEX, &pc, NULL, result);
if (verbose)
@@ -114,7 +114,7 @@ test_add (void)
if (verbose)
printf("Result of ff plus one:\n%s\n", pc);
gcry_free(pc);
-
+
gcry_mpi_release(one);
gcry_mpi_release(two);
gcry_mpi_release(ff);
@@ -123,24 +123,24 @@ test_add (void)
}
-static int
+static int
test_sub (void)
{
gcry_mpi_t one;
gcry_mpi_t two;
gcry_mpi_t result;
unsigned char* pc;
-
+
gcry_mpi_scan(&one, GCRYMPI_FMT_USG, ones, sizeof(ones), NULL);
gcry_mpi_scan(&two, GCRYMPI_FMT_USG, twos, sizeof(twos), NULL);
result = gcry_mpi_new(0);
gcry_mpi_sub(result, two, one);
-
+
gcry_mpi_aprint(GCRYMPI_FMT_HEX, &pc, NULL, result);
if (verbose)
printf("Result of two minus one:\n%s\n", pc);
gcry_free(pc);
-
+
gcry_mpi_release(one);
gcry_mpi_release(two);
gcry_mpi_release(result);
@@ -148,24 +148,24 @@ test_sub (void)
}
-static int
+static int
test_mul (void)
{
gcry_mpi_t two;
gcry_mpi_t three;
gcry_mpi_t result;
unsigned char* pc;
-
+
gcry_mpi_scan(&two, GCRYMPI_FMT_USG, twos, sizeof(twos), NULL);
gcry_mpi_scan(&three, GCRYMPI_FMT_USG, threes, sizeof(threes), NULL);
result = gcry_mpi_new(0);
gcry_mpi_mul(result, two, three);
-
+
gcry_mpi_aprint(GCRYMPI_FMT_HEX, &pc, NULL, result);
if (verbose)
printf("Result of two mul three:\n%s\n", pc);
gcry_free(pc);
-
+
gcry_mpi_release(two);
gcry_mpi_release(three);
gcry_mpi_release(result);
@@ -180,7 +180,7 @@ test_powm (void)
{
int b_int = 17;
int e_int = 3;
- int m_int = 19;
+ int m_int = 19;
gcry_mpi_t base = gcry_mpi_set_ui (NULL, b_int);
gcry_mpi_t exp = gcry_mpi_set_ui (NULL, e_int);
gcry_mpi_t mod = gcry_mpi_set_ui (NULL, m_int);
@@ -277,7 +277,7 @@ test_powm (void)
}
-int
+int
main (int argc, char* argv[])
{
if (argc > 1 && !strcmp (argv[1], "--verbose"))
@@ -299,4 +299,3 @@ main (int argc, char* argv[])
return 0;
}
-
diff --git a/tests/pkbench.c b/tests/pkbench.c
index 67b94dc9..15192f0f 100644
--- a/tests/pkbench.c
+++ b/tests/pkbench.c
@@ -102,14 +102,14 @@ read_file (const char *fname, size_t *r_length)
struct stat st;
char *buf;
size_t buflen;
-
+
fp = fopen (fname, "rb");
if (!fp)
{
fail ("can't open `%s': %s\n", fname, strerror (errno));
return NULL;
}
-
+
if (fstat (fileno(fp), &st))
{
fail ("can't stat `%s': %s\n", fname, strerror (errno));
@@ -209,7 +209,7 @@ work_decrypt (context_t context, unsigned int final)
else
{
gcry_sexp_t data_decrypted = NULL;
-
+
err = gcry_pk_decrypt (&data_decrypted,
context->data_encrypted,
context->key_secret);
@@ -279,7 +279,7 @@ work_verify (context_t context, unsigned int final)
gcry_sexp_release (context->data_signed);
context->data_signed = NULL;
}
-
+
return ret;
}
@@ -468,7 +468,7 @@ main (int argc, char **argv)
fips_mode = 1;
argc--; argv++;
}
- }
+ }
gcry_control (GCRYCTL_SET_VERBOSITY, (int)verbose);
@@ -486,12 +486,12 @@ main (int argc, char **argv)
{
/* No valuable keys are create, so we can speed up our RNG. */
gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
- }
+ }
if (debug)
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
-
+
if (genkey_mode && argc == 2)
{
generate_key (argv[0], argv[1]);
@@ -499,7 +499,7 @@ main (int argc, char **argv)
else if (!genkey_mode && argc)
{
int i;
-
+
for (i = 0; i < argc; i++)
process_key_pair_file (argv[i]);
}
@@ -509,6 +509,6 @@ main (int argc, char **argv)
" [OPTIONS] [FILES] (try --help for more information)\n");
exit (1);
}
-
+
return error_count ? 1 : 0;
}
diff --git a/tests/prime.c b/tests/prime.c
index 12bcc894..b365a14c 100644
--- a/tests/prime.c
+++ b/tests/prime.c
@@ -82,7 +82,7 @@ check_primes (void)
err = gcry_prime_group_generator (&g, prime, factors, NULL);
assert (!err);
gcry_prime_release_factors (factors); factors = NULL;
-
+
if (verbose)
{
fprintf (stderr, " %d: g = ", i);
diff --git a/tests/pubkey.c b/tests/pubkey.c
index e5ec464a..92e5f5da 100644
--- a/tests/pubkey.c
+++ b/tests/pubkey.c
@@ -196,11 +196,11 @@ check_keys (gcry_sexp_t pkey, gcry_sexp_t skey, unsigned int nbits_data,
gcry_sexp_t plain;
gcry_mpi_t x;
int rc;
-
+
/* Create plain text. */
x = gcry_mpi_new (nbits_data);
gcry_mpi_randomize (x, nbits_data, GCRY_WEAK_RANDOM);
-
+
rc = gcry_sexp_build (&plain, NULL, "(data (flags raw) (value %m))", x);
if (rc)
die ("converting data for encryption failed: %s\n",
@@ -213,8 +213,8 @@ check_keys (gcry_sexp_t pkey, gcry_sexp_t skey, unsigned int nbits_data,
/* Create plain text. */
x = gcry_mpi_new (nbits_data);
gcry_mpi_randomize (x, nbits_data, GCRY_WEAK_RANDOM);
-
- rc = gcry_sexp_build (&plain, NULL,
+
+ rc = gcry_sexp_build (&plain, NULL,
"(data (flags raw no-blinding) (value %m))", x);
if (rc)
die ("converting data for encryption failed: %s\n",
@@ -256,7 +256,7 @@ get_keys_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
{
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
-
+
rc = gcry_sexp_new (&key_spec,
"(genkey (rsa (nbits 4:1024)))", 0, 1);
if (rc)
@@ -265,7 +265,7 @@ get_keys_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating RSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated RSA key:\n", key);
@@ -288,7 +288,7 @@ get_keys_x931_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
{
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
-
+
rc = gcry_sexp_new (&key_spec,
"(genkey (rsa (nbits 4:1024)(use-x931)))", 0, 1);
if (rc)
@@ -297,7 +297,7 @@ get_keys_x931_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating RSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated RSA (X9.31) key:\n", key);
@@ -321,8 +321,8 @@ get_elg_key_new (gcry_sexp_t *pkey, gcry_sexp_t *skey, int fixed_x)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new
- (&key_spec,
+ rc = gcry_sexp_new
+ (&key_spec,
(fixed_x
? "(genkey (elg (nbits 4:1024)(xvalue my.not-so-secret.key)))"
: "(genkey (elg (nbits 3:512)))"),
@@ -334,7 +334,7 @@ get_elg_key_new (gcry_sexp_t *pkey, gcry_sexp_t *skey, int fixed_x)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating Elgamal key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated ELG key:\n", key);
@@ -358,7 +358,7 @@ get_dsa_key_new (gcry_sexp_t *pkey, gcry_sexp_t *skey, int transient_key)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new (&key_spec,
+ rc = gcry_sexp_new (&key_spec,
transient_key
? "(genkey (dsa (nbits 4:1024)(transient-key)))"
: "(genkey (dsa (nbits 4:1024)))",
@@ -369,7 +369,7 @@ get_dsa_key_new (gcry_sexp_t *pkey, gcry_sexp_t *skey, int transient_key)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating DSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated DSA key:\n", key);
@@ -393,7 +393,7 @@ get_dsa_key_fips186_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new
+ rc = gcry_sexp_new
(&key_spec, "(genkey (dsa (nbits 4:1024)(use-fips186)))", 0, 1);
if (rc)
die ("error creating S-expression: %s\n", gcry_strerror (rc));
@@ -401,7 +401,7 @@ get_dsa_key_fips186_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating DSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated DSA key (fips 186):\n", key);
@@ -425,8 +425,8 @@ get_dsa_key_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new
- (&key_spec,
+ rc = gcry_sexp_new
+ (&key_spec,
"(genkey (dsa (transient-key)(domain"
"(p #d3aed1876054db831d0c1348fbb1ada72507e5fbf9a62cbd47a63aeb7859d6921"
"4adeb9146a6ec3f43520f0fd8e3125dd8bbc5d87405d1ac5f82073cd762a3f8d7"
@@ -444,7 +444,7 @@ get_dsa_key_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating DSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated DSA key:\n", key);
@@ -467,8 +467,8 @@ get_dsa_key_fips186_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new
- (&key_spec,
+ rc = gcry_sexp_new
+ (&key_spec,
"(genkey (dsa (transient-key)(use-fips186)(domain"
"(p #d3aed1876054db831d0c1348fbb1ada72507e5fbf9a62cbd47a63aeb7859d6921"
"4adeb9146a6ec3f43520f0fd8e3125dd8bbc5d87405d1ac5f82073cd762a3f8d7"
@@ -486,7 +486,7 @@ get_dsa_key_fips186_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating DSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated DSA key:\n", key);
@@ -510,10 +510,10 @@ get_dsa_key_fips186_with_seed_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_t key_spec, key, pub_key, sec_key;
int rc;
- rc = gcry_sexp_new
+ rc = gcry_sexp_new
(&key_spec,
"(genkey"
- " (dsa"
+ " (dsa"
" (nbits 4:1024)"
" (use-fips186)"
" (transient-key)"
@@ -526,7 +526,7 @@ get_dsa_key_fips186_with_seed_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
gcry_sexp_release (key_spec);
if (rc)
die ("error generating DSA key: %s\n", gcry_strerror (rc));
-
+
if (verbose > 1)
show_sexp ("generated DSA key (fips 186 with seed):\n", key);
@@ -698,7 +698,7 @@ check_x931_derived_key (int what)
"B93BCA16B541B33F80C933A3B769285C462ED5677BFE89DF07BED5C127FD13"
"241D3C4B"
},
-
+
{ /* Second example from X9.31 (D.2.1). */
"(genkey\n"
" (rsa\n"
@@ -734,12 +734,12 @@ check_x931_derived_key (int what)
"DE30F38728FE7C8635E324E2CD5D8EBCAA1C51993315FD73B38904E107D7A7"
"B7B10EDCA3896906FCF87BE367BB858CA1B27E2FC3C8674ECC8B0F92C0E270"
"BA2ECA3701311F68AFCE208DCC499B4B3DB30FF0605CE055D893BC1461D342"
- "EF32E7D9720B"
+ "EF32E7D9720B"
This is a bug in X9.31, obviously introduced by using
d = e^{-1} mod (p-1)(q-1)
-
+
instead of using the universal exponent as required by 4.1.3:
d = e^{-1} mod lcm(p-1,q-1)
@@ -750,7 +750,7 @@ check_x931_derived_key (int what)
me several hours to figure out that the bugs are in the
document and not in my code.
*/
- },
+ },
{ /* First example from NIST RSAVS (B.1.1). */
"(genkey\n"
@@ -821,7 +821,7 @@ check_x931_derived_key (int what)
gcry_sexp_release (key_spec);
if (err)
die ("error generating RSA key [%d]: %s\n", what, gpg_strerror (err));
-
+
pub_key = gcry_sexp_find_token (key, "public-key", 0);
if (!pub_key)
die ("public part missing in key [%d]\n", what);
@@ -830,7 +830,7 @@ check_x931_derived_key (int what)
if (!sec_key)
die ("private part missing in key [%d]\n", what);
- err = gcry_mpi_scan
+ err = gcry_mpi_scan
(&d_expected, GCRYMPI_FMT_HEX, testtable[what].expected_d, 0, NULL);
if (err)
die ("error converting string [%d]\n", what);
@@ -844,7 +844,7 @@ check_x931_derived_key (int what)
if (gcry_mpi_cmp (d_expected, d_have))
{
show_sexp (NULL, sec_key);
- die ("parameter d does match expected value [%d]\n", what);
+ die ("parameter d does match expected value [%d]\n", what);
}
gcry_mpi_release (d_expected);
gcry_mpi_release (d_have);
@@ -885,6 +885,6 @@ main (int argc, char **argv)
for (i=0; i < 4; i++)
check_x931_derived_key (i);
-
+
return 0;
}
diff --git a/tests/random.c b/tests/random.c
index 502a3758..0575e8a0 100644
--- a/tests/random.c
+++ b/tests/random.c
@@ -61,7 +61,7 @@ writen (int fd, const void *buf, size_t nbytes)
{
size_t nleft = nbytes;
int nwritten;
-
+
while (nleft > 0)
{
nwritten = write (fd, buf, nleft);
@@ -69,13 +69,13 @@ writen (int fd, const void *buf, size_t nbytes)
{
if (errno == EINTR)
nwritten = 0;
- else
+ else
return -1;
}
nleft -= nwritten;
buf = (const char*)buf + nwritten;
}
-
+
return 0;
}
@@ -85,7 +85,7 @@ readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
size_t nleft = buflen;
int nread;
char *p;
-
+
p = buf;
while ( nleft > 0 )
{
@@ -94,7 +94,7 @@ readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
{
if (nread == EINTR)
nread = 0;
- else
+ else
return -1;
}
else if (!nread)
@@ -118,7 +118,7 @@ check_forking (void)
int i, status;
size_t nread;
char tmp1[16], tmp1c[16], tmp1p[16];
-
+
/* We better make sure that the RNG has been initialzied. */
gcry_randomize (tmp1, sizeof tmp1, GCRY_STRONG_RANDOM);
if (verbose)
@@ -148,7 +148,7 @@ check_forking (void)
close (rp[1]);
if (readn (rp[0], tmp1c, sizeof tmp1c, &nread))
- die ("read failed: %s\n", strerror (errno));
+ die ("read failed: %s\n", strerror (errno));
if (nread != sizeof tmp1c)
die ("read too short\n");
@@ -175,7 +175,7 @@ check_nonce_forking (void)
int i, status;
size_t nread;
char nonce1[10], nonce1c[10], nonce1p[10];
-
+
/* We won't get the same nonce back if we never initialized the
nonce subsystem, thus we get one nonce here and forget about
it. */
@@ -207,7 +207,7 @@ check_nonce_forking (void)
close (rp[1]);
if (readn (rp[0], nonce1c, sizeof nonce1c, &nread))
- die ("read failed: %s\n", strerror (errno));
+ die ("read failed: %s\n", strerror (errno));
if (nread != sizeof nonce1c)
die ("read too short\n");
diff --git a/tests/register.c b/tests/register.c
index df90fe09..4d8cebe8 100644
--- a/tests/register.c
+++ b/tests/register.c
@@ -96,7 +96,7 @@ check_list (int algorithm)
list = malloc (sizeof (int) * list_length);
assert (list);
err = gcry_cipher_list (list, &list_length);
-
+
for (i = 0; i < list_length && (! ret); i++)
if (list[i] == algorithm)
ret = 1;
@@ -183,5 +183,5 @@ main (int argc, char **argv)
/* In fips mode we let the Makefile skip this test because a PASS
would not make much sense with all egistering disabled. */
- return in_fips_mode? 77:0;
+ return in_fips_mode? 77:0;
}
diff --git a/tests/rsacvt.c b/tests/rsacvt.c
index b8a20a1b..014cd2a3 100644
--- a/tests/rsacvt.c
+++ b/tests/rsacvt.c
@@ -2,17 +2,17 @@
Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of Libgcrypt.
-
+
Libgcrypt is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
Libgcrypt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
@@ -25,7 +25,7 @@ e861b700e17e8afe68[...]f1
f7a7ca5367c661f8e6[...]61
10001
-# After an empty line another input block may follow.
+# After an empty line another input block may follow.
7861b700e17e8afe68[...]f3
e7a7ca5367c661f8e6[...]71
3
@@ -81,7 +81,7 @@ static int verbose;
static int with_labels;
/* Do not suppress leading zeroes. */
-static int keep_lz;
+static int keep_lz;
/* Create parameters as specified by OpenPGP (rfc4880). That is we
don't store dmp1 and dmp1 but d and make sure that p is less than q. */
@@ -112,7 +112,7 @@ read_textline (FILE *fp)
/* Read line but skip over initial empty lines. */
do
{
- do
+ do
{
if (!fgets (line, sizeof line, fp))
{
@@ -201,7 +201,7 @@ print_mpi_line (const char *label, gcry_mpi_t a)
p = buf;
if (!keep_lz && p[0] == '0' && p[1] == '0' && p[2])
p += 2;
-
+
printf ("%s\n", p);
if (ferror (stdout))
writerr++;
@@ -230,7 +230,7 @@ compute_missing (gcry_mpi_t rsa_p, gcry_mpi_t rsa_q, gcry_mpi_t rsa_e)
tmp_f = gcry_mpi_new (0);
tmp_g = gcry_mpi_new (0);
- /* Check that p < q; if not swap p and q. */
+ /* Check that p < q; if not swap p and q. */
if (openpgp_mode && gcry_mpi_cmp (rsa_p, rsa_q) > 0)
{
fprintf (stderr, PGM ": swapping p and q\n");
@@ -238,7 +238,7 @@ compute_missing (gcry_mpi_t rsa_p, gcry_mpi_t rsa_q, gcry_mpi_t rsa_e)
}
gcry_mpi_mul (rsa_n, rsa_p, rsa_q);
-
+
/* Compute the Euler totient: phi = (p-1)(q-1) */
gcry_mpi_sub_ui (rsa_pm1, rsa_p, 1);
@@ -259,7 +259,7 @@ compute_missing (gcry_mpi_t rsa_p, gcry_mpi_t rsa_q, gcry_mpi_t rsa_e)
gcry_mpi_mod (rsa_pm1, rsa_d, rsa_pm1);
gcry_mpi_mod (rsa_qm1, rsa_d, rsa_qm1);
- /* Compute the CRT value: OpenPGP: u = p^{-1} mod q
+ /* Compute the CRT value: OpenPGP: u = p^{-1} mod q
Standard: iqmp = q^{-1} mod p */
if (openpgp_mode)
gcry_mpi_invm (rsa_u, rsa_p, rsa_q);
@@ -300,7 +300,7 @@ usage (int show_help)
{
if (!show_help)
{
- fputs ("usage: " PGM
+ fputs ("usage: " PGM
" [OPTION] [FILE] (try --help for more information)\n", stderr);
exit (2);
}
@@ -370,7 +370,7 @@ main (int argc, char **argv)
openpgp_mode = 1;
argc--; argv++;
}
- }
+ }
if (argc > 1)
usage (0);
@@ -408,12 +408,12 @@ main (int argc, char **argv)
if (!rsa_e)
die ("RSA parameter 'e' missing or not properly hex encoded\n");
got_eof = skip_to_empty_line (input);
-
+
if (any)
putchar ('\n');
compute_missing (rsa_p, rsa_q, rsa_e);
-
+
gcry_mpi_release (rsa_p);
gcry_mpi_release (rsa_q);
gcry_mpi_release (rsa_e);
@@ -421,7 +421,6 @@ main (int argc, char **argv)
any = 1;
}
while (!got_eof);
-
+
return 0;
}
-
diff --git a/tests/t-mpi-bit.c b/tests/t-mpi-bit.c
index aaad0f1d..85bd32e9 100644
--- a/tests/t-mpi-bit.c
+++ b/tests/t-mpi-bit.c
@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
@@ -91,7 +91,7 @@ static char *
mpi2bitstr (gcry_mpi_t a, size_t length)
{
char *p, *buf;
-
+
buf = p = xmalloc (length+1);
while (length--)
*p++ = gcry_mpi_test_bit (a, length) ? '1':'0';
@@ -147,7 +147,7 @@ lshiftbitstring (const char *string, size_t n)
if (len+n+1 < len)
die ("internal overflow\n");
- /* Allocate enough space. */
+ /* Allocate enough space. */
result = xmalloc (len+n+1);
for (; *string == '0' && string[1]; string++, len--)
;
@@ -282,7 +282,7 @@ test_lshift (int pass)
for (i=0; i < 75; i++)
{
gcry_mpi_lshift (b, a, i);
-
+
result = mpi2bitstr_nlz (b);
tmpstr = mpi2bitstr_nlz (a);
result2 = lshiftbitstring (tmpstr, i);
@@ -296,11 +296,11 @@ test_lshift (int pass)
xfree (result);
xfree (result2);
}
-
+
/* Again. This time using in-place operation. */
gcry_mpi_randomize (a, size_list[size_idx], GCRY_WEAK_RANDOM);
gcry_mpi_clear_highbit (a, size_list[size_idx]);
-
+
for (i=0; i < 75; i++)
{
gcry_mpi_release (b);
@@ -355,7 +355,7 @@ main (int argc, char **argv)
for (i=0; i < 5; i++)
test_lshift (i); /* Run several times due to random initializations. */
-
+
show ("All tests completed. Errors: %d\n", error_count);
return error_count ? 1 : 0;
}
diff --git a/tests/tsexp.c b/tests/tsexp.c
index 21d54a62..73d3d6ed 100644
--- a/tests/tsexp.c
+++ b/tests/tsexp.c
@@ -81,7 +81,7 @@ basic (void)
{ NULL }
};
- info ("doing some pretty pointless tests\n");
+ info ("doing some pretty pointless tests\n");
secure_buffer_len = 99;
secure_buffer = gcry_xmalloc_secure (secure_buffer_len);
@@ -94,7 +94,7 @@ basic (void)
case 0:
string = ("(public-key (dsa (p #41424344#) (y this_is_y) "
"(q #61626364656667#) (g %m)))");
-
+
if ( gcry_sexp_build (&sexp, NULL, string,
gcry_mpi_set_ui (NULL, 42)) )
{
@@ -102,12 +102,12 @@ basic (void)
return;
}
break;
-
+
case 1:
string = ("(public-key (dsa (p #41424344#) (y this_is_y) "
"(q %b) (g %m)))");
-
- if ( gcry_sexp_build (&sexp, NULL, string,
+
+ if ( gcry_sexp_build (&sexp, NULL, string,
15, "foo\0\x01\0x02789012345",
gcry_mpi_set_ui (NULL, 42)) )
{
@@ -119,8 +119,8 @@ basic (void)
case 2:
string = ("(public-key (dsa (p #41424344#) (y silly_y_value) "
"(q %b) (g %m)))");
-
- if ( gcry_sexp_build (&sexp, NULL, string,
+
+ if ( gcry_sexp_build (&sexp, NULL, string,
secure_buffer_len, secure_buffer,
gcry_mpi_set_ui (NULL, 17)) )
{
@@ -154,8 +154,8 @@ basic (void)
gcry_sexp_release (help_sexp);
}
break;
-
-
+
+
default:
return; /* Ready. */
}
@@ -187,7 +187,7 @@ basic (void)
info ("car=`%.*s'\n", (int)n, p);
s2 = gcry_sexp_cdr (s1);
- if (!s2)
+ if (!s2)
{
fail ("no cdr for `%s'\n", token);
continue;
@@ -209,20 +209,20 @@ basic (void)
continue;
}
p = gcry_sexp_nth_data (s2, 0, &n);
- if (!p)
+ if (!p)
{
fail("no car for `%s'\n", parm );
continue;
}
info ("car=`%.*s'\n", (int)n, p);
p = gcry_sexp_nth_data (s2, 1, &n);
- if (!p)
+ if (!p)
{
fail("no cdr for `%s'\n", parm );
continue;
}
info ("cdr=`%.*s'\n", (int)n, p);
-
+
a = gcry_sexp_nth_mpi (s2, 0, GCRYMPI_FMT_USG);
if (!a)
{
@@ -231,7 +231,7 @@ basic (void)
}
}
}
-
+
gcry_sexp_release (sexp);
sexp = NULL;
}
@@ -247,7 +247,7 @@ canon_len (void)
size_t expected;/* expected length or 0 on error and then ... */
size_t erroff; /* ... and at this offset */
gcry_error_t errcode; /* ... with this error code */
- const char *text;
+ const char *text;
} values[] = {
{ 14, 13, 0, GPG_ERR_NO_ERROR, "(9:abcdefghi) " },
{ 16, 15, 0, GPG_ERR_NO_ERROR, "(10:abcdefghix)" },
@@ -274,9 +274,9 @@ canon_len (void)
for (idx=0; values[idx].text; idx++)
{
n = gcry_sexp_canon_len ((const unsigned char*)values[idx].text,
- values[idx].textlen,
+ values[idx].textlen,
&erroff, &errcode);
-
+
if (n && n == values[idx].expected)
; /* success */
else if (!n && !values[idx].expected)
@@ -356,7 +356,7 @@ back_and_forth_one (int testno, const char *buffer, size_t length)
if (*p1 != '\x55' || p1[n1+1] != '\xaa')
fail ("baf %d: memory corrupted (3)\n", testno);
gcry_free (p1);
-
+
/* FIXME: we need a lot more tests */
gcry_sexp_release (se);
@@ -396,7 +396,7 @@ check_sscan (void)
{
static struct {
const char *text;
- gcry_error_t expected_err;
+ gcry_error_t expected_err;
} values[] = {
/* Bug reported by Olivier L'Heureux 2003-10-07 */
{ "(7:sig-val(3:dsa"
@@ -451,6 +451,6 @@ main (int argc, char **argv)
canon_len ();
back_and_forth ();
check_sscan ();
-
+
return error_count? 1:0;
}
diff --git a/tests/version.c b/tests/version.c
index 03259af7..3cbecbcb 100644
--- a/tests/version.c
+++ b/tests/version.c
@@ -2,17 +2,17 @@
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of Libgcrypt.
-
+
Libgcrypt is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
Libgcrypt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
@@ -23,8 +23,8 @@
crash in case MPI function for specific CPU revisions have been
enabled. Running this test first will print out information so to
make it easier to figure out the problem. */
-
-
+
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -55,4 +55,3 @@ main (int argc, char **argv)
return 0;
}
-