[PATCH 2/3] Check that secret keys are valid while running basic pubkey tests

Dmitry Eremin-Solenikov dbaryshkov at gmail.com
Thu Sep 26 14:07:42 CEST 2013


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

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
---
 tests/basic.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/basic.c b/tests/basic.c
index fd8ca0f..9ce684b 100644
--- a/tests/basic.c
+++ b/tests/basic.c
@@ -3719,6 +3719,11 @@ static void
 do_check_one_pubkey (int n, gcry_sexp_t skey, gcry_sexp_t pkey,
 		     const unsigned char *grip, int algo, int flags)
 {
+ gcry_error_t rc;
+
+ rc = gcry_pk_testkey (skey);
+ if (rc)
+	fail ("gcry_pk_testkey failed: %s\n", gpg_strerror (rc));
  if (flags & FLAG_SIGN)
    {
      if (algo == GCRY_PK_ECDSA)
-- 
1.8.4.rc3




More information about the Gcrypt-devel mailing list