[git] Scute - branch, master, updated. scute-1.3.0-48-ge22c8cf

by Justus Winter cvs at cvs.gnupg.org
Wed Dec 23 18:28:30 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PKCS#11 token on top of gpg-agent".

The branch, master has been updated
       via  e22c8cfa12849b215f16afb34f7a5dc233dbc70a (commit)
       via  7346eab3aced6571ff31fe55d88a78e27415b609 (commit)
       via  055ae9e74155edff860884b5d3bf0ca0ab89a3e7 (commit)
       via  3107e2e3b9b36544433c1b9f506c1a066168c71f (commit)
       via  401461d3bbbe98456d9406ed60414a07fa58c190 (commit)
       via  827fc359f8a79304eb82aa4aa21b2ddd839bff0b (commit)
      from  7b14a8f6dbf3649aacf836cbc7f01ff1309a97ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e22c8cfa12849b215f16afb34f7a5dc233dbc70a
Author: Justus Winter <justus at g10code.com>
Date:   Wed Dec 23 15:20:17 2015 +0100

    Support hash functions other than 'tls-md5sha1'.
    
    * src/agent.c (decode_hash): New function.
    (scute_agent_sign): Use the new function, and return the correct size
    not the maximum size if 'sig_result' is NULL.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/agent.c b/src/agent.c
index 6201086..7e968c0 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -1042,6 +1042,75 @@ pksign_parse_result (const struct signature *sig,
   return 0;
 }
 
+/* Decodes the hash DATA of size LEN (if necessary).  Returns a
+   pointer to the raw hash data in R_DATA, the size in R_LEN, and the
+   name of the hash function in R_HASH.
+
+   Prior to TLSv1.2, the hash function was the concatenation of MD5
+   and SHA1 applied to the data respectively, and no encoding was
+   applied.  From TLSv1.2 on, the hash value is prefixed with an hash
+   identifier and encoded using ASN1.
+
+   FIXME: Reference.  */
+static gpg_error_t
+decode_hash (const unsigned char *data, int len,
+             const unsigned char **r_data, size_t *r_len,
+             const char **r_hash)
+{
+  static unsigned char rmd160_prefix[15] = /* Object ID is 1.3.36.3.2.1 */
+    { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x24, 0x03,
+      0x02, 0x01, 0x05, 0x00, 0x04, 0x14  };
+  static unsigned char sha1_prefix[15] =   /* (1.3.14.3.2.26) */
+    { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03,
+      0x02, 0x1a, 0x05, 0x00, 0x04, 0x14  };
+  static unsigned char sha224_prefix[19] = /* (2.16.840.1.101.3.4.2.4) */
+    { 0x30, 0x2D, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48,
+      0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 0x00, 0x04,
+      0x1C  };
+  static unsigned char sha256_prefix[19] = /* (2.16.840.1.101.3.4.2.1) */
+    { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+      0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
+      0x00, 0x04, 0x20  };
+  static unsigned char sha384_prefix[19] = /* (2.16.840.1.101.3.4.2.2) */
+    { 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+      0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05,
+      0x00, 0x04, 0x30  };
+  static unsigned char sha512_prefix[19] = /* (2.16.840.1.101.3.4.2.3) */
+    { 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+      0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05,
+      0x00, 0x04, 0x40  };
+
+#define HANDLE(hash,hashlen)                                            \
+  if (len == sizeof hash ## _prefix + (hashlen)                         \
+      && !memcmp (data, hash ## _prefix, sizeof hash ## _prefix))       \
+    {                                                                   \
+      *r_data = data + sizeof hash ## _prefix;                          \
+      *r_len = hashlen;                                                 \
+      *r_hash = #hash;                                                  \
+    }
+
+  if (len == 36)
+    {
+      /* Prior to TLSv1.2, a combination of MD5 and SHA1 was used.  */
+      *r_data = data;
+      *r_len = 36;
+      *r_hash = "tls-md5sha1";
+    }
+      /* TLSv1.2 encodes the hash value using ASN1.  */
+  else HANDLE (sha1,   20)
+  else HANDLE (rmd160, 20)
+  else HANDLE (sha224, 28)
+  else HANDLE (sha256, 32)
+  else HANDLE (sha384, 48)
+  else HANDLE (sha512, 64)
+    else
+      return gpg_error (GPG_ERR_INV_ARG);
+
+#undef HANDLE
+
+  return 0;
+}
+
 /* Call the agent to learn about a smartcard.  */
 gpg_error_t
 scute_agent_sign (char *grip, unsigned char *data, int len,
@@ -1049,7 +1118,10 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
 {
   char cmd[150];
   gpg_error_t err;
-#define MAX_DATA_LEN 36
+  const char *hash;
+  const unsigned char *raw_data;
+  size_t raw_len;
+#define MAX_DATA_LEN	64	/* Size of an SHA512 sum.  */
   unsigned char pretty_data[2 * MAX_DATA_LEN + 1];
   int i;
   struct signature sig;
@@ -1059,16 +1131,16 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
   if (sig_len == NULL)
     return gpg_error (GPG_ERR_INV_ARG);
 
+  err = decode_hash (data, len, &raw_data, &raw_len, &hash);
+  if (err)
+    return err;
+
   if (sig_result == NULL)
     {
-      /* FIXME:  We return the largest supported size - is that correct?  */
-      *sig_len = MAX_SIGNATURE_BITS / 8;
+      *sig_len = raw_len;
       return 0;
     }
 
-  if (len > MAX_DATA_LEN)
-    return gpg_error (GPG_ERR_INV_ARG);
-
   if (grip == NULL || sig_result == NULL)
     return gpg_error (GPG_ERR_INV_ARG);
 
@@ -1078,11 +1150,11 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
   if (err)
     return err;
 
-  for (i = 0; i < len; i++)
-    snprintf (&pretty_data[2 * i], 3, "%02X", data[i]);
-  pretty_data[2 * len] = '\0';
+  for (i = 0; i < raw_len; i++)
+    snprintf (&pretty_data[2 * i], 3, "%02X", raw_data[i]);
+  pretty_data[2 * raw_len] = '\0';
 
-  snprintf (cmd, sizeof (cmd), "SETHASH --hash=tls-md5sha1 %s", pretty_data);
+  snprintf (cmd, sizeof (cmd), "SETHASH --hash=%s %s", hash, pretty_data);
   err = assuan_transact (agent_ctx, cmd, NULL, NULL, default_inq_cb,
 			 NULL, NULL, NULL);
   if (err)

commit 7346eab3aced6571ff31fe55d88a78e27415b609
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 21 17:37:55 2015 +0100

    Support 4096 bit RSA keys.
    
    * src/agent.c (MAX_SIGNATURE_{BITS,LEN}): Tweak values.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/agent.c b/src/agent.c
index db67cac..6201086 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -952,11 +952,11 @@ scute_agent_check_status (void)
 }
 
 

-/* We only support RSA signatures up to 2048 bits.  */
-#define MAX_SIGNATURE_BITS 2048
+/* We only support RSA signatures up to 4096 bits.  */
+#define MAX_SIGNATURE_BITS 4096
 
-/* Enough space to hold a 2048 bit RSA signature in an S-expression.  */
-#define MAX_SIGNATURE_LEN 350
+/* Enough space to hold a 4096 bit RSA signature in an S-expression.  */
+#define MAX_SIGNATURE_LEN 640	/* FIXME: magic value */
 
 struct signature
 {

commit 055ae9e74155edff860884b5d3bf0ca0ab89a3e7
Author: Justus Winter <justus at g10code.com>
Date:   Wed Dec 23 13:21:48 2015 +0100

    Properly parse the s-expressions.
    
    * src/agent.c (pksign_parse_result): New function.
    (scute_agent_sign): Use the new function to parse the s-expression.
    * src/sexp-parse.h: New file copied from GnuPG.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/agent.c b/src/agent.c
index 1fd5e29..db67cac 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -1,5 +1,5 @@
 /* agent.c - Talking to gpg-agent.
-   Copyright (C) 2006, 2007, 2008 g10 Code GmbH
+   Copyright (C) 2006, 2007, 2008, 2015 g10 Code GmbH
 
    This file is part of Scute.
  
@@ -51,6 +51,7 @@
 
 #include "debug.h"
 #include "support.h"
+#include "sexp-parse.h"
 #include "cert.h"
 #include "agent.h"
 
@@ -980,14 +981,66 @@ pksign_cb (void *opaque, const void *buffer, size_t length)
   return 0;
 }
 
+/* Parse the result of an pksign operation which is a s-expression in
+   normal form that looks like (7:sig-val(3:rsa(1:s<LENGTH>:<DATA>))).
+   The raw result is stored in RESULT of size *LEN, and *LEN is
+   adjusted to the actual size.  */
+static gpg_error_t
+pksign_parse_result (const struct signature *sig,
+                     unsigned char *result, unsigned int *len)
+{
+  gpg_error_t err;
+  const unsigned char *s = sig->data;
+  size_t n;
+  int depth;
+
+  if (*s++ != '(')
+    gpg_error (GPG_ERR_INV_SEXP);
+
+  n = snext (&s);
+  if (! n)
+    return gpg_error (GPG_ERR_INV_SEXP);
+  if (! smatch (&s, n, "sig-val"))
+    return gpg_error (GPG_ERR_UNKNOWN_SEXP);
+
+  if (*s++ != '(')
+    gpg_error (GPG_ERR_UNKNOWN_SEXP);
+
+  n = snext (&s);
+  if (! n)
+    return gpg_error (GPG_ERR_INV_SEXP);
+  if (! smatch (&s, n, "rsa"))
+    return gpg_error (GPG_ERR_UNKNOWN_SEXP);
+
+  if (*s++ != '(')
+    gpg_error (GPG_ERR_UNKNOWN_SEXP);
+
+  n = snext (&s);
+  if (! n)
+    return gpg_error (GPG_ERR_INV_SEXP);
+  if (! smatch (&s, n, "s"))
+    return gpg_error (GPG_ERR_UNKNOWN_SEXP);
+
+  n = snext (&s);
+  if (! n)
+    return gpg_error (GPG_ERR_INV_SEXP);
+
+  if (*len < (unsigned int) n)
+    return gpg_error (GPG_ERR_INV_LENGTH);
+
+  *len = (unsigned int) n;
+  memcpy (result, s, n);
+  s += n;
+
+  depth = 3;
+  err = sskip (&s, &depth);
+  if (err)
+    return err;
+  if (s - sig->data != sig->len || depth != 0)
+    return gpg_error (GPG_ERR_INV_SEXP);
 
-#define SIG_PREFIX   "(7:sig-val(3:rsa(1:s128:"
-#define SIG_PREFIX_2 "(7:sig-val(3:rsa(1:s256:"
-#define SIG_PREFIX_LEN (sizeof (SIG_PREFIX) - 1)
-#define SIG_POSTFIX ")))"
-#define SIG_POSTFIX_LEN (sizeof (SIG_POSTFIX) - 1)
-#define SIG_LEN 128
-#define SIG_LEN_2 256
+  return 0;
+}
 
 /* Call the agent to learn about a smartcard.  */
 gpg_error_t
@@ -1016,7 +1069,7 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
   if (len > MAX_DATA_LEN)
     return gpg_error (GPG_ERR_INV_ARG);
 
-  if (grip == NULL || sig_result == NULL || *sig_len < SIG_LEN)
+  if (grip == NULL || sig_result == NULL)
     return gpg_error (GPG_ERR_INV_ARG);
 
   snprintf (cmd, sizeof (cmd), "SIGKEY %s", grip);
@@ -1040,32 +1093,8 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
   if (err)
     return err;
 
-  /* FIXME: we need a real parser to cope with all kind of S-expressions.  */
-  if (sig.len == SIG_PREFIX_LEN + SIG_LEN_2 + SIG_POSTFIX_LEN)
-    {
-      if (memcmp (sig.data, SIG_PREFIX_2, SIG_PREFIX_LEN))
-        return gpg_error (GPG_ERR_BAD_SIGNATURE);
-      if (memcmp (sig.data + sig.len - SIG_POSTFIX_LEN,
-                  SIG_POSTFIX, SIG_POSTFIX_LEN))
-        return gpg_error (GPG_ERR_BAD_SIGNATURE);
-      memcpy (sig_result, sig.data + SIG_PREFIX_LEN, SIG_LEN_2);
-      *sig_len = SIG_LEN_2;
-    }
-  else
-    {
-      if (sig.len != SIG_PREFIX_LEN + SIG_LEN + SIG_POSTFIX_LEN)
-        return gpg_error (GPG_ERR_BAD_SIGNATURE);
-      if (memcmp (sig.data, SIG_PREFIX, SIG_PREFIX_LEN))
-        return gpg_error (GPG_ERR_BAD_SIGNATURE);
-      if (memcmp (sig.data + sig.len - SIG_POSTFIX_LEN,
-                  SIG_POSTFIX, SIG_POSTFIX_LEN))
-        return gpg_error (GPG_ERR_BAD_SIGNATURE);
-      memcpy (sig_result, sig.data + SIG_PREFIX_LEN, SIG_LEN);
-      *sig_len = SIG_LEN;
-    }
-  
-  
-  return 0;
+  err = pksign_parse_result (&sig, sig_result, sig_len);
+  return err;
 }
 
 
diff --git a/src/sexp-parse.h b/src/sexp-parse.h
new file mode 100644
index 0000000..f68c552
--- /dev/null
+++ b/src/sexp-parse.h
@@ -0,0 +1,137 @@
+/* sexp-parse.h - S-expression helper functions
+ * Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
+ *
+ *   - the GNU Lesser General Public License as published by the Free
+ *     Software Foundation; either version 3 of the License, or (at
+ *     your option) any later version.
+ *
+ * or
+ *
+ *   - the GNU General Public License as published by the Free
+ *     Software Foundation; either version 2 of the License, or (at
+ *     your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SEXP_PARSE_H
+#define SEXP_PARSE_H
+
+#include <gpg-error.h>
+
+
+/* Return the length of the next S-Exp part and update the pointer to
+   the first data byte.  0 is returned on error */
+static inline size_t
+snext (unsigned char const **buf)
+{
+  const unsigned char *s;
+  int n;
+
+  s = *buf;
+  for (n=0; *s && *s != ':' && (*s >= '0' && *s <= '9'); s++)
+    n = n*10 + (*s - '0');
+  if (!n || *s != ':')
+    return 0; /* we don't allow empty lengths */
+  *buf = s+1;
+  return n;
+}
+
+/* Skip over the S-Expression BUF points to and update BUF to point to
+   the chacter right behind.  DEPTH gives the initial number of open
+   lists and may be passed as a positive number to skip over the
+   remainder of an S-Expression if the current position is somewhere
+   in an S-Expression.  The function may return an error code if it
+   encounters an impossible condition.  */
+static inline gpg_error_t
+sskip (unsigned char const **buf, int *depth)
+{
+  const unsigned char *s = *buf;
+  size_t n;
+  int d = *depth;
+
+  while (d > 0)
+    {
+      if (*s == '(')
+        {
+          d++;
+          s++;
+        }
+      else if (*s == ')')
+        {
+          d--;
+          s++;
+        }
+      else
+        {
+          if (!d)
+            return gpg_error (GPG_ERR_INV_SEXP);
+          n = snext (&s);
+          if (!n)
+            return gpg_error (GPG_ERR_INV_SEXP);
+          s += n;
+        }
+    }
+  *buf = s;
+  *depth = d;
+  return 0;
+}
+
+
+/* Check whether the the string at the address BUF points to matches
+   the token.  Return true on match and update BUF to point behind the
+   token.  Return false and do not update the buffer if it does not
+   match. */
+static inline int
+smatch (unsigned char const **buf, size_t buflen, const char *token)
+{
+  size_t toklen = strlen (token);
+
+  if (buflen != toklen || memcmp (*buf, token, toklen))
+    return 0;
+  *buf += toklen;
+  return 1;
+}
+
+/* Format VALUE for use as the length indicatior of an S-expression.
+   The caller needs to provide a buffer HELP_BUFFER wth a length of
+   HELP_BUFLEN.  The return value is a pointer into HELP_BUFFER with
+   the formatted length string.  The colon and a trailing nul are
+   appended.  HELP_BUFLEN must be at least 3 - a more useful value is
+   15.  If LENGTH is not NULL, the LENGTH of the resulting string
+   (excluding the terminating nul) is stored at that address. */
+static inline char *
+smklen (char *help_buffer, size_t help_buflen, size_t value, size_t *length)
+{
+  char *p = help_buffer + help_buflen;
+
+  if (help_buflen >= 3)
+    {
+      *--p = 0;
+      *--p = ':';
+      do
+        {
+          *--p = '0' + (value % 10);
+          value /= 10;
+        }
+      while (value && p > help_buffer);
+    }
+
+  if (length)
+    *length = (help_buffer + help_buflen) - p;
+  return p;
+}
+
+
+#endif /*SEXP_PARSE_H*/

commit 3107e2e3b9b36544433c1b9f506c1a066168c71f
Author: Justus Winter <justus at g10code.com>
Date:   Wed Dec 23 13:21:00 2015 +0100

    Introduce constant for maximum signature length.
    
    * src/agent.c (MAX_SIGNATURE_BITS): New macro.
    (scute_agent_sign): Use new macro.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/agent.c b/src/agent.c
index 7da2599..1fd5e29 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -951,6 +951,9 @@ scute_agent_check_status (void)
 }
 
 

+/* We only support RSA signatures up to 2048 bits.  */
+#define MAX_SIGNATURE_BITS 2048
+
 /* Enough space to hold a 2048 bit RSA signature in an S-expression.  */
 #define MAX_SIGNATURE_LEN 350
 
@@ -1006,7 +1009,7 @@ scute_agent_sign (char *grip, unsigned char *data, int len,
   if (sig_result == NULL)
     {
       /* FIXME:  We return the largest supported size - is that correct?  */
-      *sig_len = SIG_LEN_2;
+      *sig_len = MAX_SIGNATURE_BITS / 8;
       return 0;
     }
 

commit 401461d3bbbe98456d9406ed60414a07fa58c190
Author: Justus Winter <justus at g10code.com>
Date:   Wed Dec 23 17:38:55 2015 +0100

    tests: Update Makefile.am, signal skipped tests.
    
    * tests/Makefile.am (INCLUDES): Use the new name 'AM_CPPFLAGS'.
    * tests/t-auth.c (main): Properly signal that the test is skipped.
    * tests/t-closeallsessions.c (main): Likewise.
    * tests/t-findobjects.c (main): Likewise.
    * tests/t-getattribute.c (main): Likewise.
    * tests/t-getmechanisminfo.c (main): Likewise.
    * tests/t-getmechanismlist.c (main): Likewise.
    * tests/t-getsessioninfo.c (main): Likewise.
    * tests/t-gettokeninfo.c (main): Likewise.
    * tests/t-opensession.c (main): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7b5f00..644eeb0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,5 +37,5 @@ TESTS = t-link t-getfunctionlist t-initialize t-getinfo t-getslotlist \
 
 noinst_PROGRAMS = $(TESTS)
 
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/src
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src
 LDADD = ../src/scute.la
diff --git a/tests/t-auth.c b/tests/t-auth.c
index dabf1b9..53c23ed 100644
--- a/tests/t-auth.c
+++ b/tests/t-auth.c
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-closeallsessions.c b/tests/t-closeallsessions.c
index 291ad52..69d8b53 100644
--- a/tests/t-closeallsessions.c
+++ b/tests/t-closeallsessions.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-findobjects.c b/tests/t-findobjects.c
index e12b7bb..fc0cd24 100644
--- a/tests/t-findobjects.c
+++ b/tests/t-findobjects.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-getattribute.c b/tests/t-getattribute.c
index 0afd643..ae319ff 100644
--- a/tests/t-getattribute.c
+++ b/tests/t-getattribute.c
@@ -549,7 +549,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-getmechanisminfo.c b/tests/t-getmechanisminfo.c
index 804c494..b384b56 100644
--- a/tests/t-getmechanisminfo.c
+++ b/tests/t-getmechanisminfo.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-getmechanismlist.c b/tests/t-getmechanismlist.c
index c6a87d2..e3455be 100644
--- a/tests/t-getmechanismlist.c
+++ b/tests/t-getmechanismlist.c
@@ -52,7 +52,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-getsessioninfo.c b/tests/t-getsessioninfo.c
index 3089cfe..1d4d902 100644
--- a/tests/t-getsessioninfo.c
+++ b/tests/t-getsessioninfo.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-gettokeninfo.c b/tests/t-gettokeninfo.c
index cbb563d..444c190 100644
--- a/tests/t-gettokeninfo.c
+++ b/tests/t-gettokeninfo.c
@@ -51,7 +51,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);
diff --git a/tests/t-opensession.c b/tests/t-opensession.c
index ce8c919..77d86fe 100644
--- a/tests/t-opensession.c
+++ b/tests/t-opensession.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
   if (slots_count == 0)
     {
       printf ("Skipping test because no token is present.\n");
-      return 0;
+      return 77;
     }
 
   printf ("Number of slots with tokens: %lu\n", slots_count);

commit 827fc359f8a79304eb82aa4aa21b2ddd839bff0b
Author: Justus Winter <justus at g10code.com>
Date:   Wed Dec 23 13:15:09 2015 +0100

    Mute trivial unused-parameter warnings.
    
    --
    This covers all trivial cases (e.g. the stubbed-out PKCS#11
    functions).  It does not add any code.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/src/agent.c b/src/agent.c
index 938edef..7da2599 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -432,7 +432,9 @@ read_version_cb (void *opaque, const void *buffer, size_t length)
 {
   char version[20];
   const char *s;
-  
+
+  (void) opaque;
+
   if (length > sizeof (version) -1)
     length = sizeof (version) - 1;
   strncpy (version, buffer, length);
diff --git a/src/p11-cancelfunction.c b/src/p11-cancelfunction.c
index 463313d..12ff890 100644
--- a/src/p11-cancelfunction.c
+++ b/src/p11-cancelfunction.c
@@ -36,5 +36,6 @@
 

 CK_DEFINE_FUNCTION(CK_RV, C_CancelFunction) (CK_SESSION_HANDLE hSession)
 {
+  (void) hSession;
   return CKR_FUNCTION_NOT_PARALLEL;
 }
diff --git a/src/p11-copyobject.c b/src/p11-copyobject.c
index 05ea032..cf40f8d 100644
--- a/src/p11-copyobject.c
+++ b/src/p11-copyobject.c
@@ -39,5 +39,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_CopyObject)
       CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount,
       CK_OBJECT_HANDLE_PTR phNewObject)
 {
+  (void) hSession;
+  (void) hObject;
+  (void) pTemplate;
+  (void) ulCount;
+  (void) phNewObject;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-createobject.c b/src/p11-createobject.c
index 5e64f22..964dd96 100644
--- a/src/p11-createobject.c
+++ b/src/p11-createobject.c
@@ -38,5 +38,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_CreateObject)
      (CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate,
       CK_ULONG ulCount, CK_OBJECT_HANDLE_PTR phObject)
 {
+  (void) hSession;
+  (void) pTemplate;
+  (void) ulCount;
+  (void) phObject;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decrypt.c b/src/p11-decrypt.c
index ab5d811..d7a518b 100644
--- a/src/p11-decrypt.c
+++ b/src/p11-decrypt.c
@@ -39,5 +39,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_Decrypt)
       CK_ULONG ulEncryptedDataLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
 {
   /* FIXME: Implement this.  */
+  (void) hSession;
+  (void) pEncryptedData;
+  (void) ulEncryptedDataLen;
+  (void) pData;
+  (void) pulDataLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decryptdigestupdate.c b/src/p11-decryptdigestupdate.c
index 2ff696a..bc63615 100644
--- a/src/p11-decryptdigestupdate.c
+++ b/src/p11-decryptdigestupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_DecryptDigestUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart,
       CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 {
+  (void) hSession;
+  (void) pEncryptedPart;
+  (void) ulEncryptedPartLen;
+  (void) pPart;
+  (void) pulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decryptfinal.c b/src/p11-decryptfinal.c
index 50a364d..90c653d 100644
--- a/src/p11-decryptfinal.c
+++ b/src/p11-decryptfinal.c
@@ -39,5 +39,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_DecryptFinal)
       CK_ULONG_PTR pulLastPartLen)
 {
   /* FIXME: Implement this.  */
+  (void) hSession;
+  (void) pLastPart;
+  (void) pulLastPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decryptinit.c b/src/p11-decryptinit.c
index 7dd7096..5c2d5e6 100644
--- a/src/p11-decryptinit.c
+++ b/src/p11-decryptinit.c
@@ -39,5 +39,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_DecryptInit)
       CK_OBJECT_HANDLE hKey)
 {
   /* FIXME: Implement this.  */
+  (void) hSession;
+  (void) pMechanism;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decryptupdate.c b/src/p11-decryptupdate.c
index 91dbeaa..0797059 100644
--- a/src/p11-decryptupdate.c
+++ b/src/p11-decryptupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_DecryptUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart,
       CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 {
+  (void) hSession;
+  (void) pEncryptedPart;
+  (void) ulEncryptedPartLen;
+  (void) pPart;
+  (void) pulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-decryptverifyupdate.c b/src/p11-decryptverifyupdate.c
index 490de13..f157980 100644
--- a/src/p11-decryptverifyupdate.c
+++ b/src/p11-decryptverifyupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_DecryptVerifyUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedPart,
       CK_ULONG ulEncryptedPartLen, CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
 {
+  (void) hSession;
+  (void) pEncryptedPart;
+  (void) ulEncryptedPartLen;
+  (void) pPart;
+  (void) pulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-derivekey.c b/src/p11-derivekey.c
index 0e9d654..6387abb 100644
--- a/src/p11-derivekey.c
+++ b/src/p11-derivekey.c
@@ -39,5 +39,11 @@ CK_DEFINE_FUNCTION(CK_RV, C_DeriveKey)
       CK_OBJECT_HANDLE hBaseKey, CK_ATTRIBUTE_PTR pTemplate,
       CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hBaseKey;
+  (void) pTemplate;
+  (void) ulAttributeCount;
+  (void) phKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-destroyobject.c b/src/p11-destroyobject.c
index d6a95a4..5bf785e 100644
--- a/src/p11-destroyobject.c
+++ b/src/p11-destroyobject.c
@@ -38,5 +38,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_DestroyObject)
      (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject)
 {
   /* FIXME: Implement this.  */
+  (void) hSession;
+  (void) hObject;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digest.c b/src/p11-digest.c
index 3e4821c..0025463 100644
--- a/src/p11-digest.c
+++ b/src/p11-digest.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_Digest)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen,
       CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
 {
+  (void) hSession;
+  (void) pData;
+  (void) ulDataLen;
+  (void) pDigest;
+  (void) pulDigestLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digestencryptupdate.c b/src/p11-digestencryptupdate.c
index 86d4a0a..538b593 100644
--- a/src/p11-digestencryptupdate.c
+++ b/src/p11-digestencryptupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_DigestEncryptUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen,
       CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
+  (void) pEncryptedPart;
+  (void) pulEncryptedPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digestfinal.c b/src/p11-digestfinal.c
index 62a0370..e98396c 100644
--- a/src/p11-digestfinal.c
+++ b/src/p11-digestfinal.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_DigestFinal)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pDigest,
       CK_ULONG_PTR pulDigestLen)
 {
+  (void) hSession;
+  (void) pDigest;
+  (void) pulDigestLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digestinit.c b/src/p11-digestinit.c
index 3904a49..4180350 100644
--- a/src/p11-digestinit.c
+++ b/src/p11-digestinit.c
@@ -37,5 +37,7 @@
 CK_DEFINE_FUNCTION(CK_RV, C_DigestInit)
      (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism)
 {
+  (void) hSession;
+  (void) pMechanism;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digestkey.c b/src/p11-digestkey.c
index 671ce7f..ab67e19 100644
--- a/src/p11-digestkey.c
+++ b/src/p11-digestkey.c
@@ -37,5 +37,7 @@
 CK_DEFINE_FUNCTION(CK_RV, C_DigestKey)
      (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hKey)
 {
+  (void) hSession;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-digestupdate.c b/src/p11-digestupdate.c
index a5a878c..8da5414 100644
--- a/src/p11-digestupdate.c
+++ b/src/p11-digestupdate.c
@@ -37,5 +37,8 @@
 CK_DEFINE_FUNCTION(CK_RV, C_DigestUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-encrypt.c b/src/p11-encrypt.c
index 80ab6db..c397f46 100644
--- a/src/p11-encrypt.c
+++ b/src/p11-encrypt.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_Encrypt)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen,
       CK_BYTE_PTR pEncryptedData, CK_ULONG_PTR pulEncryptedDataLen)
 {
+  (void) hSession;
+  (void) pData;
+  (void) ulDataLen;
+  (void) pEncryptedData;
+  (void) pulEncryptedDataLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-encryptfinal.c b/src/p11-encryptfinal.c
index 7b63ae9..2bc7b45 100644
--- a/src/p11-encryptfinal.c
+++ b/src/p11-encryptfinal.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_EncryptFinal)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pLastEncryptedPart,
       CK_ULONG_PTR pulLastEncryptedPartLen)
 {
+  (void) hSession;
+  (void) pLastEncryptedPart;
+  (void) pulLastEncryptedPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-encryptinit.c b/src/p11-encryptinit.c
index 6196332..f3276be 100644
--- a/src/p11-encryptinit.c
+++ b/src/p11-encryptinit.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_EncryptInit)
      (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
       CK_OBJECT_HANDLE hKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-encryptupdate.c b/src/p11-encryptupdate.c
index 588accd..5741dc6 100644
--- a/src/p11-encryptupdate.c
+++ b/src/p11-encryptupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_EncryptUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen,
       CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
+  (void) pEncryptedPart;
+  (void) pulEncryptedPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-generatekey.c b/src/p11-generatekey.c
index 66c3d89..699a4a2 100644
--- a/src/p11-generatekey.c
+++ b/src/p11-generatekey.c
@@ -39,5 +39,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_GenerateKey)
       CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount,
       CK_OBJECT_HANDLE_PTR phKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) pTemplate;
+  (void) ulCount;
+  (void) phKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-generatekeypair.c b/src/p11-generatekeypair.c
index c78f365..3300074 100644
--- a/src/p11-generatekeypair.c
+++ b/src/p11-generatekeypair.c
@@ -41,5 +41,13 @@ CK_DEFINE_FUNCTION(CK_RV, C_GenerateKeyPair)
       CK_ULONG ulPrivateKeyAttributeCount,
       CK_OBJECT_HANDLE_PTR phPublicKey, CK_OBJECT_HANDLE_PTR phPrivateKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) pPublicKeyTemplate;
+  (void) ulPublicKeyAttributeCount;
+  (void) pPrivateKeyTemplate;
+  (void) ulPrivateKeyAttributeCount;
+  (void) phPublicKey;
+  (void) phPrivateKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-generaterandom.c b/src/p11-generaterandom.c
index 35328d2..f192e9d 100644
--- a/src/p11-generaterandom.c
+++ b/src/p11-generaterandom.c
@@ -39,5 +39,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_GenerateRandom)
       CK_ULONG ulRandomLen)
 {
   /* FIXME: Implement me.  */
+  (void) hSession;
+  (void) pRandomData;
+  (void) ulRandomLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-getfunctionstatus.c b/src/p11-getfunctionstatus.c
index 6b05d21..8fe7bc0 100644
--- a/src/p11-getfunctionstatus.c
+++ b/src/p11-getfunctionstatus.c
@@ -36,5 +36,6 @@
 

 CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionStatus) (CK_SESSION_HANDLE hSession)
 {
+  (void) hSession;
   return CKR_FUNCTION_NOT_PARALLEL;
 }
diff --git a/src/p11-getobjectsize.c b/src/p11-getobjectsize.c
index 235d054..f0dcf62 100644
--- a/src/p11-getobjectsize.c
+++ b/src/p11-getobjectsize.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_GetObjectSize)
      (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject,
       CK_ULONG_PTR pulSize)
 {
+  (void) hSession;
+  (void) hObject;
+  (void) pulSize;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-getoperationstate.c b/src/p11-getoperationstate.c
index 466329f..0da7b5e 100644
--- a/src/p11-getoperationstate.c
+++ b/src/p11-getoperationstate.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_GetOperationState)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pOperationState,
       CK_ULONG_PTR pulOperationStateLen)
 {
+  (void) hSession;
+  (void) pOperationState;
+  (void) pulOperationStateLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-initpin.c b/src/p11-initpin.c
index e6d8883..1512060 100644
--- a/src/p11-initpin.c
+++ b/src/p11-initpin.c
@@ -37,5 +37,8 @@
 CK_DEFINE_FUNCTION(CK_RV, C_InitPIN)
      (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen)
 {
+  (void) hSession;
+  (void) pPin;
+  (void) ulPinLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-inittoken.c b/src/p11-inittoken.c
index b7a2dd8..63ab1cc 100644
--- a/src/p11-inittoken.c
+++ b/src/p11-inittoken.c
@@ -38,5 +38,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_InitToken)
      (CK_SLOT_ID slotID, CK_UTF8CHAR_PTR pPin, CK_ULONG ulPinLen,
       CK_UTF8CHAR_PTR pLabel)
 {
+  (void) slotID;
+  (void) pPin;
+  (void) ulPinLen;
+  (void) pLabel;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-login.c b/src/p11-login.c
index 7b7ce23..bcc4796 100644
--- a/src/p11-login.c
+++ b/src/p11-login.c
@@ -38,5 +38,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_Login)
      (CK_SESSION_HANDLE hSession, CK_USER_TYPE userType, CK_UTF8CHAR_PTR pPin,
       CK_ULONG ulPinLen)
 {
+  (void) hSession;
+  (void) userType;
+  (void) pPin;
+  (void) ulPinLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-logout.c b/src/p11-logout.c
index 270ab73..cea1cb2 100644
--- a/src/p11-logout.c
+++ b/src/p11-logout.c
@@ -37,5 +37,6 @@
 CK_DEFINE_FUNCTION(CK_RV, C_Logout)
      (CK_SESSION_HANDLE hSession)
 {
+  (void) hSession;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-seedrandom.c b/src/p11-seedrandom.c
index 796d008..437b652 100644
--- a/src/p11-seedrandom.c
+++ b/src/p11-seedrandom.c
@@ -37,5 +37,8 @@
 CK_DEFINE_FUNCTION(CK_RV, C_SeedRandom)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen)
 {
+  (void) hSession;
+  (void) pSeed;
+  (void) ulSeedLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-setattributevalue.c b/src/p11-setattributevalue.c
index 1b45d37..271361b 100644
--- a/src/p11-setattributevalue.c
+++ b/src/p11-setattributevalue.c
@@ -38,5 +38,9 @@ CK_DEFINE_FUNCTION(CK_RV, C_SetAttributeValue)
      (CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject,
       CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
 {
+  (void) hSession;
+  (void) hObject;
+  (void) pTemplate;
+  (void) ulCount;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-setoperationstate.c b/src/p11-setoperationstate.c
index 9e51a5d..9b9f470 100644
--- a/src/p11-setoperationstate.c
+++ b/src/p11-setoperationstate.c
@@ -39,5 +39,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_SetOperationState)
       CK_ULONG ulOperationStateLen, CK_OBJECT_HANDLE hEncryptionKey,
       CK_OBJECT_HANDLE hAuthenticationKey)
 {
+  (void) hSession;
+  (void) pOperationState;
+  (void) ulOperationStateLen;
+  (void) hEncryptionKey;
+  (void) hAuthenticationKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-setpin.c b/src/p11-setpin.c
index a473024..6924bf0 100644
--- a/src/p11-setpin.c
+++ b/src/p11-setpin.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_SetPIN)
      (CK_SESSION_HANDLE hSession, CK_UTF8CHAR_PTR pOldPin, CK_ULONG ulOldLen,
       CK_UTF8CHAR_PTR pNewPin, CK_ULONG ulNewLen)
 {
+  (void) hSession;
+  (void) pOldPin;
+  (void) ulOldLen;
+  (void) pNewPin;
+  (void) ulNewLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-signencryptupdate.c b/src/p11-signencryptupdate.c
index f89c049..d869b4b 100644
--- a/src/p11-signencryptupdate.c
+++ b/src/p11-signencryptupdate.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignEncryptUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen,
       CK_BYTE_PTR pEncryptedPart, CK_ULONG_PTR pulEncryptedPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
+  (void) pEncryptedPart;
+  (void) pulEncryptedPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-signfinal.c b/src/p11-signfinal.c
index a639d1b..0aa2f49 100644
--- a/src/p11-signfinal.c
+++ b/src/p11-signfinal.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignFinal)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature,
       CK_ULONG_PTR pulSignatureLen)
 {
+  (void) hSession;
+  (void) pSignature;
+  (void) pulSignatureLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-signrecover.c b/src/p11-signrecover.c
index 47a1919..d1283e5 100644
--- a/src/p11-signrecover.c
+++ b/src/p11-signrecover.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignRecover)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen,
       CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen)
 {
+  (void) hSession;
+  (void) pData;
+  (void) ulDataLen;
+  (void) pSignature;
+  (void) pulSignatureLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-signrecoverinit.c b/src/p11-signrecoverinit.c
index 5e8e78a..6c3373d 100644
--- a/src/p11-signrecoverinit.c
+++ b/src/p11-signrecoverinit.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_SignRecoverInit)
      (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
       CK_OBJECT_HANDLE hKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-signupdate.c b/src/p11-signupdate.c
index 39d6835..229f888 100644
--- a/src/p11-signupdate.c
+++ b/src/p11-signupdate.c
@@ -37,5 +37,8 @@
 CK_DEFINE_FUNCTION(CK_RV, C_SignUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-unwrapkey.c b/src/p11-unwrapkey.c
index 0f8cfa1..91a2640 100644
--- a/src/p11-unwrapkey.c
+++ b/src/p11-unwrapkey.c
@@ -40,5 +40,13 @@ CK_DEFINE_FUNCTION(CK_RV, C_UnwrapKey)
       CK_ULONG ulWrappedKeyLen, CK_ATTRIBUTE_PTR pTemplate,
       CK_ULONG ulAttributeCount, CK_OBJECT_HANDLE_PTR phKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hUnwrappingKey;
+  (void) pWrappedKey;
+  (void) ulWrappedKeyLen;
+  (void) pTemplate;
+  (void) ulAttributeCount;
+  (void) phKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verify.c b/src/p11-verify.c
index fc4d8c5..af3944c 100644
--- a/src/p11-verify.c
+++ b/src/p11-verify.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_Verify)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pData, CK_ULONG ulDataLen,
       CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
 {
+  (void) hSession;
+  (void) pData;
+  (void) ulDataLen;
+  (void) pSignature;
+  (void) ulSignatureLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verifyfinal.c b/src/p11-verifyfinal.c
index a31dca5..672f226 100644
--- a/src/p11-verifyfinal.c
+++ b/src/p11-verifyfinal.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_VerifyFinal)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature,
       CK_ULONG ulSignatureLen)
 {
+  (void) hSession;
+  (void) pSignature;
+  (void) ulSignatureLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verifyinit.c b/src/p11-verifyinit.c
index b27bbc4..61d3682 100644
--- a/src/p11-verifyinit.c
+++ b/src/p11-verifyinit.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_VerifyInit)
      (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
       CK_OBJECT_HANDLE hKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verifyrecover.c b/src/p11-verifyrecover.c
index 6650627..76219fb 100644
--- a/src/p11-verifyrecover.c
+++ b/src/p11-verifyrecover.c
@@ -38,5 +38,10 @@ CK_DEFINE_FUNCTION(CK_RV, C_VerifyRecover)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pSignature,
       CK_ULONG ulSignatureLen, CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
 {
+  (void) hSession;
+  (void) pSignature;
+  (void) ulSignatureLen;
+  (void) pData;
+  (void) pulDataLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verifyrecoverinit.c b/src/p11-verifyrecoverinit.c
index 722855a..1c98dfa 100644
--- a/src/p11-verifyrecoverinit.c
+++ b/src/p11-verifyrecoverinit.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_VerifyRecoverInit)
      (CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism,
       CK_OBJECT_HANDLE hKey)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hKey;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-verifyupdate.c b/src/p11-verifyupdate.c
index ae418ec..b667ef0 100644
--- a/src/p11-verifyupdate.c
+++ b/src/p11-verifyupdate.c
@@ -37,5 +37,8 @@
 CK_DEFINE_FUNCTION(CK_RV, C_VerifyUpdate)
      (CK_SESSION_HANDLE hSession, CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
 {
+  (void) hSession;
+  (void) pPart;
+  (void) ulPartLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-waitforslotevent.c b/src/p11-waitforslotevent.c
index 320e06c..9cd7de9 100644
--- a/src/p11-waitforslotevent.c
+++ b/src/p11-waitforslotevent.c
@@ -38,5 +38,8 @@ CK_DEFINE_FUNCTION(CK_RV, C_WaitForSlotEvent)
      (CK_FLAGS flags, CK_SLOT_ID_PTR pSlot, CK_VOID_PTR pReserved)
 {
   /* See the TODO file why this is not implemented.  */
+  (void) flags;
+  (void) pSlot;
+  (void) pReserved;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/p11-wrapkey.c b/src/p11-wrapkey.c
index f94b480..ca031bd 100644
--- a/src/p11-wrapkey.c
+++ b/src/p11-wrapkey.c
@@ -39,5 +39,11 @@ CK_DEFINE_FUNCTION(CK_RV, C_WrapKey)
       CK_OBJECT_HANDLE hWrappingKey, CK_OBJECT_HANDLE hKey,
       CK_BYTE_PTR pWrappedKey, CK_ULONG_PTR pulWrappedKeyLen)
 {
+  (void) hSession;
+  (void) pMechanism;
+  (void) hWrappingKey;
+  (void) hKey;
+  (void) pWrappedKey;
+  (void) pulWrappedKeyLen;
   return CKR_FUNCTION_NOT_SUPPORTED;
 }
diff --git a/src/slots.c b/src/slots.c
index 26c9efa..b1712aa 100644
--- a/src/slots.c
+++ b/src/slots.c
@@ -194,6 +194,8 @@ object_alloc (void **data_r, void *hook)
 {
   struct object *object;
 
+  (void) hook;
+
   object = calloc (1, sizeof (*object));
   if (object == NULL)
     return gpg_error_from_syserror ();
@@ -221,6 +223,8 @@ session_alloc (void **data_r, void *hook)
 {
   struct session *session;
 
+  (void) hook;
+
   session = calloc (1, sizeof (*session));
   if (session == NULL)
     return gpg_error_from_syserror ();
@@ -255,6 +259,8 @@ slot_alloc (void **data_r, void *hook)
   int idx;
   CK_FLAGS flags;
 
+  (void) hook;
+
   slot = calloc (1, sizeof (*slot));
   if (slot == NULL)
     return gpg_error_from_syserror ();
@@ -579,6 +585,7 @@ slot_token_manufacturer (slot_iterator_t id)
 char *
 slot_token_application (slot_iterator_t id)
 {
+  (void) id;
   /* slots_update() makes sure this is correct.  */
   return "OpenPGP";
 }
diff --git a/src/table.c b/src/table.c
index 24d54d8..a1d4869 100644
--- a/src/table.c
+++ b/src/table.c
@@ -292,6 +292,7 @@ scute_table_next (scute_table_t table, int index)
 bool
 scute_table_last (scute_table_t table, int index)
 {
+  (void) table;
   return INDEX_COPY_IN (index) == INDEX_EOT;
 }
 
diff --git a/tests/t-auth.c b/tests/t-auth.c
index 576f860..dabf1b9 100644
--- a/tests/t-auth.c
+++ b/tests/t-auth.c
@@ -94,6 +94,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-closeallsessions.c b/tests/t-closeallsessions.c
index 871cff4..291ad52 100644
--- a/tests/t-closeallsessions.c
+++ b/tests/t-closeallsessions.c
@@ -42,6 +42,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-findobjects.c b/tests/t-findobjects.c
index aeef53a..e12b7bb 100644
--- a/tests/t-findobjects.c
+++ b/tests/t-findobjects.c
@@ -41,6 +41,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-getattribute.c b/tests/t-getattribute.c
index 136f8b8..0afd643 100644
--- a/tests/t-getattribute.c
+++ b/tests/t-getattribute.c
@@ -535,6 +535,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   if (argc > 1 && !strcmp ("--printable", argv[1]))
     printable = true;
     
diff --git a/tests/t-getfunctionlist.c b/tests/t-getfunctionlist.c
index 1495e1d..702ed29 100644
--- a/tests/t-getfunctionlist.c
+++ b/tests/t-getfunctionlist.c
@@ -43,6 +43,9 @@ main (int argc, char *argv[])
 {
   CK_RV err;
 
+  (void) argc;
+  (void) argv;
+
   /* This is the only function that can be called without
      initialization.  */
   err = C_GetFunctionList (&fl);
diff --git a/tests/t-getinfo.c b/tests/t-getinfo.c
index e465cf9..b90f132 100644
--- a/tests/t-getinfo.c
+++ b/tests/t-getinfo.c
@@ -38,6 +38,9 @@ main (int argc, char *argv[])
   CK_RV err;
   CK_INFO info;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetInfo (&info);
diff --git a/tests/t-getmechanisminfo.c b/tests/t-getmechanisminfo.c
index 5e5ac0d..804c494 100644
--- a/tests/t-getmechanisminfo.c
+++ b/tests/t-getmechanisminfo.c
@@ -41,6 +41,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-getmechanismlist.c b/tests/t-getmechanismlist.c
index 02fed8f..c6a87d2 100644
--- a/tests/t-getmechanismlist.c
+++ b/tests/t-getmechanismlist.c
@@ -41,6 +41,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-getsessioninfo.c b/tests/t-getsessioninfo.c
index 3d8ad4c..3089cfe 100644
--- a/tests/t-getsessioninfo.c
+++ b/tests/t-getsessioninfo.c
@@ -42,6 +42,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-getslotinfo.c b/tests/t-getslotinfo.c
index 78a231e..576d313 100644
--- a/tests/t-getslotinfo.c
+++ b/tests/t-getslotinfo.c
@@ -41,6 +41,8 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argv;
+
   if (argc > 1)
     token = true;
 
diff --git a/tests/t-getslotlist.c b/tests/t-getslotlist.c
index b44f85c..17ad3e3 100644
--- a/tests/t-getslotlist.c
+++ b/tests/t-getslotlist.c
@@ -41,6 +41,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   if (argc > 1)
     token = true;
 
diff --git a/tests/t-gettokeninfo.c b/tests/t-gettokeninfo.c
index 91861ae..cbb563d 100644
--- a/tests/t-gettokeninfo.c
+++ b/tests/t-gettokeninfo.c
@@ -40,6 +40,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);
diff --git a/tests/t-initialize.c b/tests/t-initialize.c
index 5964b68..a8a6c7b 100644
--- a/tests/t-initialize.c
+++ b/tests/t-initialize.c
@@ -37,6 +37,9 @@ main (int argc, char *argv[])
 {
   CK_RV err;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_Finalize (NULL);
diff --git a/tests/t-link.c b/tests/t-link.c
index 96a6e70..4bac096 100644
--- a/tests/t-link.c
+++ b/tests/t-link.c
@@ -36,6 +36,9 @@
 int
 main (int argc, char *argv[])
 {
+  (void) argc;
+  (void) argv;
+
   /* We don't do anything useful.  We just print a list of function
      pointers to avoid elimination of dead code.  */
   DO_ONE (C_CancelFunction);
diff --git a/tests/t-opensession.c b/tests/t-opensession.c
index 6c92aab..ce8c919 100644
--- a/tests/t-opensession.c
+++ b/tests/t-opensession.c
@@ -42,6 +42,9 @@ main (int argc, char *argv[])
   CK_ULONG slots_count;
   unsigned int i;
 
+  (void) argc;
+  (void) argv;
+
   init_cryptoki ();
 
   err = C_GetSlotList (true, NULL, &slots_count);

-----------------------------------------------------------------------

Summary of changes:
 src/agent.c                   | 202 ++++++++++++++++++++++++++++++++----------
 src/p11-cancelfunction.c      |   1 +
 src/p11-copyobject.c          |   5 ++
 src/p11-createobject.c        |   4 +
 src/p11-decrypt.c             |   5 ++
 src/p11-decryptdigestupdate.c |   5 ++
 src/p11-decryptfinal.c        |   3 +
 src/p11-decryptinit.c         |   3 +
 src/p11-decryptupdate.c       |   5 ++
 src/p11-decryptverifyupdate.c |   5 ++
 src/p11-derivekey.c           |   6 ++
 src/p11-destroyobject.c       |   2 +
 src/p11-digest.c              |   5 ++
 src/p11-digestencryptupdate.c |   5 ++
 src/p11-digestfinal.c         |   3 +
 src/p11-digestinit.c          |   2 +
 src/p11-digestkey.c           |   2 +
 src/p11-digestupdate.c        |   3 +
 src/p11-encrypt.c             |   5 ++
 src/p11-encryptfinal.c        |   3 +
 src/p11-encryptinit.c         |   3 +
 src/p11-encryptupdate.c       |   5 ++
 src/p11-generatekey.c         |   5 ++
 src/p11-generatekeypair.c     |   8 ++
 src/p11-generaterandom.c      |   3 +
 src/p11-getfunctionstatus.c   |   1 +
 src/p11-getobjectsize.c       |   3 +
 src/p11-getoperationstate.c   |   3 +
 src/p11-initpin.c             |   3 +
 src/p11-inittoken.c           |   4 +
 src/p11-login.c               |   4 +
 src/p11-logout.c              |   1 +
 src/p11-seedrandom.c          |   3 +
 src/p11-setattributevalue.c   |   4 +
 src/p11-setoperationstate.c   |   5 ++
 src/p11-setpin.c              |   5 ++
 src/p11-signencryptupdate.c   |   5 ++
 src/p11-signfinal.c           |   3 +
 src/p11-signrecover.c         |   5 ++
 src/p11-signrecoverinit.c     |   3 +
 src/p11-signupdate.c          |   3 +
 src/p11-unwrapkey.c           |   8 ++
 src/p11-verify.c              |   5 ++
 src/p11-verifyfinal.c         |   3 +
 src/p11-verifyinit.c          |   3 +
 src/p11-verifyrecover.c       |   5 ++
 src/p11-verifyrecoverinit.c   |   3 +
 src/p11-verifyupdate.c        |   3 +
 src/p11-waitforslotevent.c    |   3 +
 src/p11-wrapkey.c             |   6 ++
 src/sexp-parse.h              | 137 ++++++++++++++++++++++++++++
 src/slots.c                   |   7 ++
 src/table.c                   |   1 +
 tests/Makefile.am             |   2 +-
 tests/t-auth.c                |   5 +-
 tests/t-closeallsessions.c    |   5 +-
 tests/t-findobjects.c         |   5 +-
 tests/t-getattribute.c        |   5 +-
 tests/t-getfunctionlist.c     |   3 +
 tests/t-getinfo.c             |   3 +
 tests/t-getmechanisminfo.c    |   5 +-
 tests/t-getmechanismlist.c    |   5 +-
 tests/t-getsessioninfo.c      |   5 +-
 tests/t-getslotinfo.c         |   2 +
 tests/t-getslotlist.c         |   3 +
 tests/t-gettokeninfo.c        |   5 +-
 tests/t-initialize.c          |   3 +
 tests/t-link.c                |   3 +
 tests/t-opensession.c         |   5 +-
 69 files changed, 543 insertions(+), 58 deletions(-)
 create mode 100644 src/sexp-parse.h


hooks/post-receive
-- 
PKCS#11 token on top of gpg-agent
http://git.gnupg.org




More information about the Gnupg-commits mailing list