[git] GnuPG - branch, master, updated. gnupg-2.1.0beta1-82-g5667e33

by Werner Koch cvs at cvs.gnupg.org
Thu Feb 3 21:21:34 CET 2011


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 "The GNU Privacy Guard".

The branch, master has been updated
       via  5667e332909740fab85d095eb8f96ed2188ece6a (commit)
      from  71e7a1644e37b7e3758f6de0607fdb636ca6f4b1 (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 5667e332909740fab85d095eb8f96ed2188ece6a
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Feb 3 20:59:01 2011 +0100

    Add a DECRYPTION_INFO status.
    
        DECRYPTION_INFO <mdc_method> <sym_algo>
            Print information about the symmetric encryption algorithm and
            the MDC method.  This will be emitted even if the decryption
            fails.

diff --git a/common/ChangeLog b/common/ChangeLog
index 0e3282f..647f7d5 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,5 +1,7 @@
 2011-02-03  Werner Koch  <wk at g10code.com>
 
+	* status.h (STATUS_DECRYPTION_INFO): New.
+
 	* argparse.c (strusage): Update copyright year.
 
 2011-01-31  Werner Koch  <wk at g10code.com>
diff --git a/common/status.h b/common/status.h
index 0533c4a..434ff97 100644
--- a/common/status.h
+++ b/common/status.h
@@ -20,7 +20,7 @@
 #ifndef GNUPG_COMMON_STATUS_H
 #define GNUPG_COMMON_STATUS_H
 
-enum 
+enum
   {
     STATUS_ENTER,
     STATUS_LEAVE,
@@ -39,7 +39,7 @@ enum
     STATUS_TRUST_MARGINAL,
     STATUS_TRUST_FULLY,
     STATUS_TRUST_ULTIMATE,
-  
+
     STATUS_NEED_PASSPHRASE,
     STATUS_VALIDSIG,
     STATUS_SIG_ID,
@@ -49,6 +49,7 @@ enum
     STATUS_NO_PUBKEY,
     STATUS_NO_SECKEY,
     STATUS_NEED_PASSPHRASE_SYM,
+    STATUS_DECRYPTION_INFO,
     STATUS_DECRYPTION_FAILED,
     STATUS_DECRYPTION_OKAY,
     STATUS_MISSING_PASSPHRASE,
@@ -58,20 +59,20 @@ enum
     STATUS_ERRMDC,
     STATUS_IMPORTED,
     STATUS_IMPORT_OK,
-    STATUS_IMPORT_PROBLEM, 
+    STATUS_IMPORT_PROBLEM,
     STATUS_IMPORT_RES,
     STATUS_IMPORT_CHECK,
 
     STATUS_FILE_START,
     STATUS_FILE_DONE,
     STATUS_FILE_ERROR,
-  
+
     STATUS_BEGIN_DECRYPTION,
     STATUS_END_DECRYPTION,
     STATUS_BEGIN_ENCRYPTION,
     STATUS_END_ENCRYPTION,
     STATUS_BEGIN_SIGNING,
-  
+
     STATUS_DELETE_PROBLEM,
 
     STATUS_GET_BOOL,
diff --git a/doc/DETAILS b/doc/DETAILS
index 2e1d92b..185d1af 100644
--- a/doc/DETAILS
+++ b/doc/DETAILS
@@ -57,7 +57,7 @@ record; gpg2 does this by default and the option is a dummy.
 		f = The key is fully valid
 		u = The key is ultimately valid.  This often means
 		    that the secret key is available, but any key may
-		    be marked as ultimately valid. 
+		    be marked as ultimately valid.
 
             If the validity information is given for a UID or UAT
             record, it describes the validity calculated based on this
@@ -97,7 +97,7 @@ record; gpg2 does this by default and the option is a dummy.
 	    This is a single letter, but be prepared that additional
 	    information may follow in some future versions.  For trust
 	    signatures with a regular expression, this is the regular
-	    expression value, quoted as in field 10. 
+	    expression value, quoted as in field 10.
 
 10. Field:  User-ID.  The value is quoted like a C string to avoid
 	    control characters (the colon is quoted "\x3a").
@@ -134,7 +134,7 @@ record; gpg2 does this by default and the option is a dummy.
             this is the same string as the fingerprint. The advantage
             of using this value is that it is guaranteed to have been
             been build by the same lookup algorithm as gpgsm uses.
-            For "uid" records this lists the preferences in the same 
+            For "uid" records this lists the preferences in the same
             way the gpg's --edit-key menu does.
 	    For "sig" records, this is the fingerprint of the key that
 	    issued the signature.  Note that this is only filled in if
@@ -190,7 +190,7 @@ Example for a "tru" trust base record:
     (gpg's option --marginals-needed)
  7: Number of completely trusted users to introduce a new key signer.
     (gpg's option --completes-needed)
- 8: Maximum depth of a certification chain.  
+ 8: Maximum depth of a certification chain.
     *gpg's option --max-cert-depth)
 
 The "spk" signature subpacket records have the fields:
@@ -236,7 +236,7 @@ more arguments in future versions.
 	keyid if it is available.  This is the case with CMS and might
 	eventually also be available for OpenPGP.
 
-    EXPKEYSIG  <long_keyid_or_fpr> <username> 
+    EXPKEYSIG  <long_keyid_or_fpr> <username>
         The signature with the keyid is good, but the signature was
 	made by an expired key. The username is the primary one
 	encoded in UTF-8 and %XX escaped.  The fingerprint may be used
@@ -334,7 +334,7 @@ more arguments in future versions.
     TRUST_UNDEFINED <error token>
     TRUST_NEVER     <error token>
     TRUST_MARGINAL  [0  [<validation_model>]]
-    TRUST_FULLY     [0  [<validation_model>]] 
+    TRUST_FULLY     [0  [<validation_model>]]
     TRUST_ULTIMATE  [0  [<validation_model>]]
 	For good signatures one of these status lines are emitted to
 	indicate the validity of the key used to create the signature.
@@ -355,7 +355,7 @@ more arguments in future versions.
     PKA_TRUST_BAD  <mailbox>
         Depending on the outcome of the PKA check one of the above
         status codes is emitted in addition to a TRUST_* status.
-        Without PKA info available or 
+        Without PKA info available or
 
     SIGEXPIRED
 	This is deprecated in favor of KEYEXPIRED.
@@ -423,17 +423,6 @@ more arguments in future versions.
 	The supplied passphrase was good and the secret key material
 	is therefore usable.
 
-    DECRYPTION_FAILED
-	The symmetric decryption failed - one reason could be a wrong
-	passphrase for a symmetrical encrypted message.
-
-    DECRYPTION_OKAY
-	The decryption process succeeded.  This means, that either the
-	correct secret key has been used or the correct passphrase
-	for a conventional encrypted message was given.  The program
-	itself may return an errorcode because it may not be possible to
-	verify a signature for some reasons.
-
     NO_PUBKEY  <long keyid>
     NO_SECKEY  <long keyid>
 	The key is not available
@@ -452,7 +441,7 @@ more arguments in future versions.
           1 := Entirely new key.
           2 := New user IDs
           4 := New signatures
-          8 := New subkeys 
+          8 := New subkeys
          16 := Contains private key.
         The flags may be ORed.
 
@@ -474,7 +463,7 @@ more arguments in future versions.
 	operation:
 	    1 - verify
             2 - encrypt
-            3 - decrypt        
+            3 - decrypt
 
     FILE_DONE
 	Marks the end of a file processing which has been started
@@ -485,6 +474,22 @@ more arguments in future versions.
 	Mark the start and end of the actual decryption process.  These
 	are also emitted when in --list-only mode.
 
+    DECRYPTION_INFO <mdc_method> <sym_algo>
+        Print information about the symmetric encryption algorithm and
+        the MDC method.  This will be emitted even if the decryption
+        fails.
+
+    DECRYPTION_FAILED
+	The symmetric decryption failed - one reason could be a wrong
+	passphrase for a symmetrical encrypted message.
+
+    DECRYPTION_OKAY
+	The decryption process succeeded.  This means, that either the
+	correct secret key has been used or the correct passphrase
+	for a conventional encrypted message was given.  The program
+	itself may return an errorcode because it may not be possible to
+	verify a signature for some reasons.
+
     BEGIN_ENCRYPTION  <mdc_method> <sym_algo>
     END_ENCRYPTION
 	Mark the start and end of the actual encryption process.
@@ -505,7 +510,7 @@ more arguments in future versions.
 	"char" is the character displayed with no --status-fd enabled, with
 	the linefeed replaced by an 'X'.  "cur" is the current amount
 	done and "total" is amount to be done; a "total" of 0 indicates that
-	the total amount is not known.	The condition 
+	the total amount is not known.	The condition
            TOATL && CUR == TOTAL
         may be used to detect the end of an operation.
         Well known values for WHAT:
@@ -524,7 +529,7 @@ more arguments in future versions.
              "learncard"  Send by the agent and gpgsm while learing
 	                  the data of a smartcard.
              "card_busy"  A smartcard is still working
-        
+
     SIG_CREATED <type> <pubkey algo> <hash algo> <class> <timestamp> <key fpr>
 	A signature has been created using these parameters.
 	    type:  'D' = detached
@@ -536,7 +541,7 @@ more arguments in future versions.
         Note, that TIMESTAMP may either be a number with seconds since
         epoch or an ISO 8601 string which can be detected by the
         presence of the letter 'T' inside.
-        
+
     KEY_CREATED <type> <fingerprint> [<handle>]
         A key has been created
             type: 'B' = primary and subkey
@@ -557,13 +562,13 @@ more arguments in future versions.
 	is used.  The format is suitable to be passed to the option
 	--override-session-key
 
-    NOTATION_NAME <name> 
+    NOTATION_NAME <name>
     NOTATION_DATA <string>
         name and string are %XX escaped; the data may be split
         among several NOTATION_DATA lines.
 
     USERID_HINT <long main keyid> <string>
-        Give a hint about the user ID for a certain keyID. 
+        Give a hint about the user ID for a certain keyID.
 
     POLICY_URL <string>
         string is %XX escaped
@@ -587,7 +592,7 @@ more arguments in future versions.
           8 := "Policy mismatch"
           9 := "Not a secret key"
 	 10 := "Key not trusted"
-         11 := "Missing certificate" 
+         11 := "Missing certificate"
          12 := "Missing issuer certificate"
 
         Note that for historical reasons the INV_RECP status is also
@@ -621,9 +626,9 @@ more arguments in future versions.
 
     SUCCESS [<location>]
         Postive confirimation that an operation succeeded.  <location>
-        is optional but if given should not contain spaces. 
+        is optional but if given should not contain spaces.
         Used only with a few commands.
-            
+
 
     ATTRIBUTE <fpr> <octets> <type> <index> <count>
 	      <timestamp> <expiredate> <flags>
@@ -650,7 +655,7 @@ more arguments in future versions.
            3 = Card with serialnumber detected
            4 = No card available.
            5 = No card reader available
-           6 = No card support available                      
+           6 = No card support available
 
     PLAINTEXT <format> <timestamp> <filename>
         This indicates the format of the plaintext that is about to be
@@ -827,7 +832,7 @@ The format of this file is as follows:
         relinquishes the GUI from implementing its own passphrase
         entry code.  This is a global option.
     %no-ask-passphrase
-        Disable the ask-passphrase mode.        
+        Disable the ask-passphrase mode.
     %no-protection
         With GnuPG 2.1 it is not anymore possible to specify a
         passphrase for unattended key generation.  The passphrase
@@ -898,7 +903,7 @@ The format of this file is as follows:
         information and which is also part of the fingerprint
         calculation.  Either a date like "1986-04-26" or a full
         timestamp like "19860426T042640" may be used.  The time is
-        considered to be UTC.  If it is not given the current time 
+        considered to be UTC.  If it is not given the current time
         is used.
      Preferences: <string>
         Set the cipher, hash, and compression preference values for
@@ -1207,7 +1212,7 @@ Other Notes
 OIDs below the GnuPG arc:
 =========================
 
- 1.3.6.1.4.1.11591.2          GnuPG 
+ 1.3.6.1.4.1.11591.2          GnuPG
  1.3.6.1.4.1.11591.2.1          notation
  1.3.6.1.4.1.11591.2.1.1          pkaAddress
  1.3.6.1.4.1.11591.2.12242973   invalid encoded OID
@@ -1290,4 +1295,3 @@ A better way to do this would be a request like:
 This can be implemented using Hurd's translator mechanism.
 However, I think the whole key server stuff has to be re-thought;
 I have some ideas and probably create a white paper.
-
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 3f8874f..43a8d56 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,5 +1,8 @@
 2011-02-03  Werner Koch  <wk at g10code.com>
 
+	* decrypt-data.c: Include status.h.
+	(decrypt_data): Emit a DECRYPTION_INFO status line.
+
 	* misc.c (has_invalid_email_chars): Relax mailbox name checking.
 	Fixes bug#1315.
 
diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c
index 3779f6a..e95dc10 100644
--- a/g10/decrypt-data.c
+++ b/g10/decrypt-data.c
@@ -30,6 +30,7 @@
 #include "cipher.h"
 #include "options.h"
 #include "i18n.h"
+#include "status.h"
 
 
 static int mdc_decode_filter ( void *opaque, int control, IOBUF a,
@@ -82,7 +83,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
   byte temp[32];
   unsigned blocksize;
   unsigned nprefix;
-  
+
   dfx = xtrycalloc (1, sizeof *dfx);
   if (!dfx)
     return gpg_error_from_syserror ();
@@ -91,12 +92,20 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
   if ( opt.verbose && !dek->algo_info_printed )
     {
       if (!openpgp_cipher_test_algo (dek->algo))
-        log_info (_("%s encrypted data\n"), 
+        log_info (_("%s encrypted data\n"),
                   openpgp_cipher_algo_name (dek->algo));
       else
         log_info (_("encrypted with unknown algorithm %d\n"), dek->algo );
       dek->algo_info_printed = 1;
     }
+
+  {
+    char buf[20];
+
+    snprintf (buf, sizeof buf, "%d %d", ed->mdc_method, dek->algo);
+    write_status_text (STATUS_DECRYPTION_INFO, buf);
+  }
+
   rc = openpgp_cipher_test_algo (dek->algo);
   if (rc)
     goto leave;
@@ -107,7 +116,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
   if ( ed->len && ed->len < (nprefix+2) )
     BUG();
 
-  if ( ed->mdc_method ) 
+  if ( ed->mdc_method )
     {
       if (gcry_md_open (&dfx->mdc_hash, ed->mdc_method, 0 ))
         BUG ();
@@ -142,7 +151,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
       goto leave;
     }
 
-  if (!ed->buf) 
+  if (!ed->buf)
     {
       log_error(_("problem handling encrypted packet\n"));
       goto leave;
@@ -152,7 +161,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
 
   if ( ed->len )
     {
-      for (i=0; i < (nprefix+2) && ed->len; i++, ed->len-- ) 
+      for (i=0; i < (nprefix+2) && ed->len; i++, ed->len-- )
         {
           if ( (c=iobuf_get(ed->buf)) == -1 )
             break;
@@ -160,7 +169,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
             temp[i] = c;
         }
     }
-  else 
+  else
     {
       for (i=0; i < (nprefix+2); i++ )
         if ( (c=iobuf_get(ed->buf)) == -1 )
@@ -168,7 +177,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
         else
           temp[i] = c;
     }
-  
+
   gcry_cipher_decrypt (dfx->cipher_hd, temp, nprefix+2, NULL, 0);
   gcry_cipher_sync (dfx->cipher_hd);
   p = temp;
@@ -179,7 +188,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
       rc = gpg_error (GPG_ERR_BAD_KEY);
       goto leave;
     }
-  
+
   if ( dfx->mdc_hash )
     gcry_md_write (dfx->mdc_hash, temp, nprefix+2);
 
@@ -196,7 +205,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
   if (dfx->eof_seen > 1 )
     rc = gpg_error (GPG_ERR_INV_PACKET);
   else if ( ed->mdc_method )
-    { 
+    {
       /* We used to let parse-packet.c handle the MDC packet but this
          turned out to be a problem with compressed packets: With old
          style packets there is no length information available and
@@ -230,8 +239,8 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
       /* log_printhex("MDC message:", dfx->defer, 22); */
       /* log_printhex("MDC calc:", gcry_md_read (dfx->mdc_hash,0), datalen); */
     }
-  
-  
+
+
  leave:
   release_dfx_context (dfx);
   return rc;
@@ -255,7 +264,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
      looking for the EOF on fixed data works only if the encrypted
      packet is not followed by other data.  This used to be a long
      standing bug which was fixed on 2009-10-02.  */
-  
+
   if ( control == IOBUFCTRL_UNDERFLOW && dfx->eof_seen )
     {
       *ret_len = 0;
@@ -265,7 +274,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
     {
       assert (a);
       assert (size > 44); /* Our code requires at least this size.  */
-      
+
       /* Get at least 22 bytes and put it ahead in the buffer.  */
       if (dfx->partial)
         {
@@ -286,7 +295,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
               buf[n] = c;
             }
         }
-      if (n == 44) 
+      if (n == 44)
         {
           /* We have enough stuff - flush the deferred stuff.  */
           if ( !dfx->defer_filled )  /* First time. */
@@ -301,7 +310,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
           /* Fill up the buffer. */
           if (dfx->partial)
             {
-              for (; n < size; n++ ) 
+              for (; n < size; n++ )
                 {
                   if ( (c = iobuf_get(a)) == -1 )
                     {
@@ -313,7 +322,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
             }
           else
             {
-              for (; n < size && dfx->length; n++, dfx->length--) 
+              for (; n < size && dfx->length; n++, dfx->length--)
                 {
                   c = iobuf_get(a);
                   if (c == -1)
@@ -326,7 +335,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
               if (!dfx->length)
                 dfx->eof_seen = 1; /* Normal EOF.  */
             }
-          
+
           /* Move the trailing 22 bytes back to the defer buffer.  We
              have at least 44 bytes thus a memmove is not needed.  */
           n -= 22;
@@ -362,11 +371,11 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
 	}
       *ret_len = n;
     }
-  else if ( control == IOBUFCTRL_FREE ) 
+  else if ( control == IOBUFCTRL_FREE )
     {
       release_dfx_context (dfx);
     }
-  else if ( control == IOBUFCTRL_DESC ) 
+  else if ( control == IOBUFCTRL_DESC )
     {
       *(char**)buf = "mdc_decode_filter";
     }
@@ -388,13 +397,13 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
       *ret_len = 0;
       rc = -1;
     }
-  else if ( control == IOBUFCTRL_UNDERFLOW ) 
+  else if ( control == IOBUFCTRL_UNDERFLOW )
     {
       assert(a);
-      
+
       if (fc->partial)
         {
-          for (n=0; n < size; n++ ) 
+          for (n=0; n < size; n++ )
             {
               c = iobuf_get(a);
               if (c == -1)
@@ -407,7 +416,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
         }
       else
         {
-          for (n=0; n < size && fc->length; n++, fc->length--) 
+          for (n=0; n < size && fc->length; n++, fc->length--)
             {
               c = iobuf_get(a);
               if (c == -1)
@@ -433,7 +442,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
         }
       *ret_len = n;
     }
-  else if ( control == IOBUFCTRL_FREE ) 
+  else if ( control == IOBUFCTRL_FREE )
     {
       release_dfx_context (fc);
     }
@@ -443,4 +452,3 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
     }
   return rc;
 }
-

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

Summary of changes:
 common/ChangeLog   |    2 +
 common/status.h    |   11 ++++---
 doc/DETAILS        |   70 +++++++++++++++++++++++++++------------------------
 g10/ChangeLog      |    3 ++
 g10/decrypt-data.c |   58 ++++++++++++++++++++++++------------------
 5 files changed, 81 insertions(+), 63 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list