ftbfs
[oweals/gnunet.git] / src / pq / test_pq.c
index b9bf1be76cabadbd742fbd1630f88149083ade7b..67cf32733429a0bf9dbc496a3486b2facf41e4e8 100644 (file)
@@ -2,16 +2,20 @@
   This file is part of GNUnet
   (C) 2015, 2016 GNUnet e.V.
 
-  GNUnet is free software; you can redistribute it and/or modify it under the
-  terms of the GNU General Public License as published by the Free Software
-  Foundation; either version 3, or (at your option) any later version.
+  GNUnet is free software: you can redistribute it and/or modify it
+  under the terms of the GNU Affero General Public License as published
+  by the Free Software Foundation, either version 3 of the License,
+  or (at your option) any later version.
 
-  GNUnet 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 General Public License for more details.
+  GNUnet 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
+  Affero General Public License for more details.
+  You should have received a copy of the GNU Affero General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-  You should have received a copy of the GNU General Public License along with
-  GNUnet; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /**
  * @file pq/test_pq.c
@@ -89,10 +93,10 @@ postgres_prepare (PGconn *db_conn)
 static int
 run_queries (PGconn *conn)
 {
-  struct GNUNET_CRYPTO_rsa_PublicKey *pub;
-  struct GNUNET_CRYPTO_rsa_PublicKey *pub2 = NULL;
-  struct GNUNET_CRYPTO_rsa_Signature *sig;
-  struct GNUNET_CRYPTO_rsa_Signature *sig2 = NULL;
+  struct GNUNET_CRYPTO_RsaPublicKey *pub;
+  struct GNUNET_CRYPTO_RsaPublicKey *pub2 = NULL;
+  struct GNUNET_CRYPTO_RsaSignature *sig;
+  struct GNUNET_CRYPTO_RsaSignature *sig2 = NULL;
   struct GNUNET_TIME_Absolute abs_time = GNUNET_TIME_absolute_get ();
   struct GNUNET_TIME_Absolute abs_time2;
   struct GNUNET_TIME_Absolute forever = GNUNET_TIME_UNIT_FOREVER_ABS;
@@ -101,9 +105,10 @@ run_queries (PGconn *conn)
   struct GNUNET_HashCode hc2;
   PGresult *result;
   int ret;
-  struct GNUNET_CRYPTO_rsa_PrivateKey *priv;
-  char msg[] = "Hello";
+  struct GNUNET_CRYPTO_RsaPrivateKey *priv;
+  const char msg[] = "hello";
   void *msg2;
+  struct GNUNET_HashCode hmsg;
   size_t msg2_len;
   uint16_t u16;
   uint16_t u162;
@@ -114,9 +119,9 @@ run_queries (PGconn *conn)
 
   priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
   pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
-  sig = GNUNET_CRYPTO_rsa_sign (priv,
-                               msg,
-                               sizeof (msg));
+  memset (&hmsg, 42, sizeof (hmsg));
+  sig = GNUNET_CRYPTO_rsa_sign_fdh (priv,
+                                    &hmsg);
   u16 = 16;
   u32 = 32;
   u64 = 64;
@@ -186,9 +191,8 @@ run_queries (PGconn *conn)
     GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us);
     GNUNET_break (forever.abs_value_us == forever2.abs_value_us);
     GNUNET_break (0 ==
-                 memcmp (&hc,
-                         &hc2,
-                         sizeof (struct GNUNET_HashCode)));
+                 GNUNET_memcmp (&hc,
+                         &hc2));
     GNUNET_break (0 ==
                  GNUNET_CRYPTO_rsa_signature_cmp (sig,
                                                   sig2));
@@ -217,8 +221,8 @@ run_queries (PGconn *conn)
 
 
 int
-main(int argc,
-     const char *const argv[])
+main (int argc,
+      const char *const argv[])
 {
   PGconn *conn;
   PGresult *result;
@@ -235,7 +239,7 @@ main(int argc,
             PQerrorMessage (conn));
     GNUNET_break (0);
     PQfinish (conn);
-    return 0; /* We ignore this type of error... */
+    return 77; /* signal test was skipped */
   }
 
   result = PQexec (conn,