summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-03-18 15:11:31 +0100
committerWerner Koch <wk@gnupg.org>2016-03-18 15:26:25 +0100
commite40939b2141306238cc30a340b867b60fa4dc2a3 (patch)
treedd967b203a66917decc4166e2be71d287692cd77 /tests
parent80e9f95e6f419daa765e4876c858e3e36e808897 (diff)
downloadlibgcrypt-e40939b2141306238cc30a340b867b60fa4dc2a3.tar.gz
dsa: Make regression tests work.
* cipher/dsa.c (sample_secret_key_1024): Comment out unused constant. (ogenerate_fips186): Make it work with use-fips183-2 flag. * cipher/primegen.c (_gcry_generate_fips186_3_prime): Use Emacs standard comment out format. * tests/fips186-dsa.c (check_dsa_gen_186_3): New dummy fucntion. (main): Call it. (main): Compare against current version. * tests/pubkey.c (get_dsa_key_fips186_new): Create 2048 bit key. (get_dsa_key_fips186_with_seed_new): Ditto. (get_dsa_key_fips186_with_domain_new): Comment out. (check_run): Do not call that function. -- Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/fips186-dsa.c11
-rw-r--r--tests/pubkey.c19
2 files changed, 21 insertions, 9 deletions
diff --git a/tests/fips186-dsa.c b/tests/fips186-dsa.c
index 10b18abb..5ee829ea 100644
--- a/tests/fips186-dsa.c
+++ b/tests/fips186-dsa.c
@@ -434,6 +434,14 @@ check_dsa_gen_186_2 (void)
}
+static void
+check_dsa_gen_186_3 (void)
+{
+ /* FIXME: Needs to be implemented. */
+ if (verbose)
+ info ("generating FIPS 186-3 test keys - skipped\n");
+}
+
int
main (int argc, char **argv)
@@ -449,7 +457,7 @@ main (int argc, char **argv)
}
gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
- if (!gcry_check_version ("1.4.4"))
+ if (!gcry_check_version (GCRYPT_VERSION))
die ("version mismatch\n");
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
if (debug)
@@ -459,6 +467,7 @@ main (int argc, char **argv)
check_dsa_gen_186_2 ();
+ check_dsa_gen_186_3 ();
return error_count ? 1 : 0;
diff --git a/tests/pubkey.c b/tests/pubkey.c
index ae5eea2d..26bd9e3a 100644
--- a/tests/pubkey.c
+++ b/tests/pubkey.c
@@ -490,7 +490,7 @@ get_dsa_key_fips186_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
int rc;
rc = gcry_sexp_new
- (&key_spec, "(genkey (dsa (nbits 4:1024)(use-fips186)))", 0, 1);
+ (&key_spec, "(genkey (dsa (nbits 4:2048)(use-fips186)))", 0, 1);
if (rc)
die ("error creating S-expression: %s\n", gcry_strerror (rc));
rc = gcry_pk_genkey (&key, key_spec);
@@ -557,6 +557,7 @@ get_dsa_key_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
*skey = sec_key;
}
+#if 0
static void
get_dsa_key_fips186_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
{
@@ -598,7 +599,7 @@ get_dsa_key_fips186_with_domain_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
*pkey = pub_key;
*skey = sec_key;
}
-
+#endif /*0*/
static void
get_dsa_key_fips186_with_seed_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
@@ -610,7 +611,7 @@ get_dsa_key_fips186_with_seed_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
(&key_spec,
"(genkey"
" (dsa"
- " (nbits 4:1024)"
+ " (nbits 4:2048)"
" (use-fips186)"
" (transient-key)"
" (derive-parms"
@@ -722,12 +723,14 @@ check_run (void)
gcry_sexp_release (pkey);
gcry_sexp_release (skey);
+ /* We need new test vectors for get_dsa_key_fips186_with_domain_new. */
if (verbose)
- fprintf (stderr, "Generating DSA key with given domain (FIPS 186).\n");
- get_dsa_key_fips186_with_domain_new (&pkey, &skey);
- /* Fixme: Add a check function for DSA keys. */
- gcry_sexp_release (pkey);
- gcry_sexp_release (skey);
+ fprintf (stderr, "Generating DSA key with given domain (FIPS 186)"
+ " - skipped.\n");
+ /* get_dsa_key_fips186_with_domain_new (&pkey, &skey); */
+ /* /\* Fixme: Add a check function for DSA keys. *\/ */
+ /* gcry_sexp_release (pkey); */
+ /* gcry_sexp_release (skey); */
if (verbose)
fprintf (stderr, "Generating DSA key with given seed (FIPS 186).\n");