add additional test condition for GNS crypto
authorFlorian Dold <florian.dold@gmail.com>
Mon, 25 May 2020 21:35:33 +0000 (03:05 +0530)
committerFlorian Dold <florian.dold@gmail.com>
Mon, 25 May 2020 21:35:46 +0000 (03:05 +0530)
src/util/test_crypto_ecdsa.c

index cfa236d6dac2a8bdf5fe8bc34a74ae47fc742cb1..7908590a8405410c67a5b7a66f5d3e048f704489 100644 (file)
@@ -107,6 +107,7 @@ testDeriveSignVerify (void)
   struct GNUNET_CRYPTO_EcdsaPrivateKey *dpriv;
   struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
   struct GNUNET_CRYPTO_EcdsaPublicKey dpub;
+  struct GNUNET_CRYPTO_EcdsaPublicKey dpub2;
 
   dpriv = GNUNET_CRYPTO_ecdsa_private_key_derive (&key,
                                                   "test-derive",
@@ -117,9 +118,17 @@ testDeriveSignVerify (void)
                                          "test-derive",
                                          "test-CTX",
                                          &dpub);
+  GNUNET_CRYPTO_ecdsa_key_get_public (dpriv, &dpub2);
   purp.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose));
   purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
 
+  if (0 != GNUNET_memcmp (&dpub.q_y, &dpub2.q_y))
+  {
+    fprintf (stderr, "%s", "key derivation failed\n");
+    GNUNET_free (dpriv);
+    return GNUNET_SYSERR;
+  }
+
   if (GNUNET_SYSERR ==
       GNUNET_CRYPTO_ecdsa_sign_ (dpriv,
                                  &purp,