Gpgme_op_sign(...,GPGME_SIG_MODE_CLEAR) output limited to ~20757 with callback data buffers.

Uldis.Ansmits at tieto.com Uldis.Ansmits at tieto.com
Mon Feb 22 09:18:10 CET 2010


> I modified an existing gpgme test. See patch file.

--- tests/gpg/t-encrypt-large.c.ORIG    2010-02-22 10:00:42.000000000 +0200
+++ tests/gpg/t-encrypt-large.c 2010-02-22 10:02:33.000000000 +0200
@@ -50,6 +50,8 @@

   for (; size && parms->bytes_to_send; size--, parms->bytes_to_send--)
     *p++ = rand ();
+/* This seems to be important! Must be highly conmpressable content */
+  memset(buffer,'A',p - (char*)buffer);

   return (p - (char*)buffer);
 }
@@ -103,6 +105,7 @@

   err = gpgme_new (&ctx);
   fail_if_err (err);
+  gpgme_set_passphrase_cb (ctx, passphrase_cb, NULL);
   gpgme_set_armor (ctx, 0);

   /* Install a progress handler to enforce a bit of more work to the
@@ -122,15 +125,8 @@
                       &key[1], 0);
   fail_if_err (err);

-  err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
+  err = gpgme_op_sign(ctx, in, out, GPGME_SIG_MODE_CLEAR);
   fail_if_err (err);
-  result = gpgme_op_encrypt_result (ctx);
-  if (result->invalid_recipients)
-    {
-      fprintf (stderr, "Invalid recipient encountered: %s\n",
-              result->invalid_recipients->fpr);
-      exit (1);
-    }
   printf ("plaintext=%u bytes, ciphertext=%u bytes\n",
           (unsigned int)nbytes, (unsigned int)parms.bytes_received);

@@ -139,5 +135,8 @@
   gpgme_data_release (in);
   gpgme_data_release (out);
   gpgme_release (ctx);
+
+  /* expect the same plain data with signature */
+  if(parms.bytes_received<nbytes){return -1;}
   return 0;
 }



More information about the Gnupg-devel mailing list