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.
This commit is contained in:
Werner Koch 2011-02-03 20:59:01 +01:00
parent 71e7a1644e
commit 5667e33290
5 changed files with 81 additions and 63 deletions

View File

@ -1,5 +1,7 @@
2011-02-03 Werner Koch <wk@g10code.com> 2011-02-03 Werner Koch <wk@g10code.com>
* status.h (STATUS_DECRYPTION_INFO): New.
* argparse.c (strusage): Update copyright year. * argparse.c (strusage): Update copyright year.
2011-01-31 Werner Koch <wk@g10code.com> 2011-01-31 Werner Koch <wk@g10code.com>

View File

@ -20,7 +20,7 @@
#ifndef GNUPG_COMMON_STATUS_H #ifndef GNUPG_COMMON_STATUS_H
#define GNUPG_COMMON_STATUS_H #define GNUPG_COMMON_STATUS_H
enum enum
{ {
STATUS_ENTER, STATUS_ENTER,
STATUS_LEAVE, STATUS_LEAVE,
@ -39,7 +39,7 @@ enum
STATUS_TRUST_MARGINAL, STATUS_TRUST_MARGINAL,
STATUS_TRUST_FULLY, STATUS_TRUST_FULLY,
STATUS_TRUST_ULTIMATE, STATUS_TRUST_ULTIMATE,
STATUS_NEED_PASSPHRASE, STATUS_NEED_PASSPHRASE,
STATUS_VALIDSIG, STATUS_VALIDSIG,
STATUS_SIG_ID, STATUS_SIG_ID,
@ -49,6 +49,7 @@ enum
STATUS_NO_PUBKEY, STATUS_NO_PUBKEY,
STATUS_NO_SECKEY, STATUS_NO_SECKEY,
STATUS_NEED_PASSPHRASE_SYM, STATUS_NEED_PASSPHRASE_SYM,
STATUS_DECRYPTION_INFO,
STATUS_DECRYPTION_FAILED, STATUS_DECRYPTION_FAILED,
STATUS_DECRYPTION_OKAY, STATUS_DECRYPTION_OKAY,
STATUS_MISSING_PASSPHRASE, STATUS_MISSING_PASSPHRASE,
@ -58,20 +59,20 @@ enum
STATUS_ERRMDC, STATUS_ERRMDC,
STATUS_IMPORTED, STATUS_IMPORTED,
STATUS_IMPORT_OK, STATUS_IMPORT_OK,
STATUS_IMPORT_PROBLEM, STATUS_IMPORT_PROBLEM,
STATUS_IMPORT_RES, STATUS_IMPORT_RES,
STATUS_IMPORT_CHECK, STATUS_IMPORT_CHECK,
STATUS_FILE_START, STATUS_FILE_START,
STATUS_FILE_DONE, STATUS_FILE_DONE,
STATUS_FILE_ERROR, STATUS_FILE_ERROR,
STATUS_BEGIN_DECRYPTION, STATUS_BEGIN_DECRYPTION,
STATUS_END_DECRYPTION, STATUS_END_DECRYPTION,
STATUS_BEGIN_ENCRYPTION, STATUS_BEGIN_ENCRYPTION,
STATUS_END_ENCRYPTION, STATUS_END_ENCRYPTION,
STATUS_BEGIN_SIGNING, STATUS_BEGIN_SIGNING,
STATUS_DELETE_PROBLEM, STATUS_DELETE_PROBLEM,
STATUS_GET_BOOL, STATUS_GET_BOOL,

View File

@ -57,7 +57,7 @@ record; gpg2 does this by default and the option is a dummy.
f = The key is fully valid f = The key is fully valid
u = The key is ultimately valid. This often means u = The key is ultimately valid. This often means
that the secret key is available, but any key may 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 If the validity information is given for a UID or UAT
record, it describes the validity calculated based on this 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 This is a single letter, but be prepared that additional
information may follow in some future versions. For trust information may follow in some future versions. For trust
signatures with a regular expression, this is the regular 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 10. Field: User-ID. The value is quoted like a C string to avoid
control characters (the colon is quoted "\x3a"). 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 this is the same string as the fingerprint. The advantage
of using this value is that it is guaranteed to have been of using this value is that it is guaranteed to have been
been build by the same lookup algorithm as gpgsm uses. 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. way the gpg's --edit-key menu does.
For "sig" records, this is the fingerprint of the key that For "sig" records, this is the fingerprint of the key that
issued the signature. Note that this is only filled in if 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) (gpg's option --marginals-needed)
7: Number of completely trusted users to introduce a new key signer. 7: Number of completely trusted users to introduce a new key signer.
(gpg's option --completes-needed) (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) *gpg's option --max-cert-depth)
The "spk" signature subpacket records have the fields: 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 keyid if it is available. This is the case with CMS and might
eventually also be available for OpenPGP. 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 The signature with the keyid is good, but the signature was
made by an expired key. The username is the primary one made by an expired key. The username is the primary one
encoded in UTF-8 and %XX escaped. The fingerprint may be used 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_UNDEFINED <error token>
TRUST_NEVER <error token> TRUST_NEVER <error token>
TRUST_MARGINAL [0 [<validation_model>]] TRUST_MARGINAL [0 [<validation_model>]]
TRUST_FULLY [0 [<validation_model>]] TRUST_FULLY [0 [<validation_model>]]
TRUST_ULTIMATE [0 [<validation_model>]] TRUST_ULTIMATE [0 [<validation_model>]]
For good signatures one of these status lines are emitted to For good signatures one of these status lines are emitted to
indicate the validity of the key used to create the signature. indicate the validity of the key used to create the signature.
@ -355,7 +355,7 @@ more arguments in future versions.
PKA_TRUST_BAD <mailbox> PKA_TRUST_BAD <mailbox>
Depending on the outcome of the PKA check one of the above Depending on the outcome of the PKA check one of the above
status codes is emitted in addition to a TRUST_* status. status codes is emitted in addition to a TRUST_* status.
Without PKA info available or Without PKA info available or
SIGEXPIRED SIGEXPIRED
This is deprecated in favor of KEYEXPIRED. 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 The supplied passphrase was good and the secret key material
is therefore usable. 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_PUBKEY <long keyid>
NO_SECKEY <long keyid> NO_SECKEY <long keyid>
The key is not available The key is not available
@ -452,7 +441,7 @@ more arguments in future versions.
1 := Entirely new key. 1 := Entirely new key.
2 := New user IDs 2 := New user IDs
4 := New signatures 4 := New signatures
8 := New subkeys 8 := New subkeys
16 := Contains private key. 16 := Contains private key.
The flags may be ORed. The flags may be ORed.
@ -474,7 +463,7 @@ more arguments in future versions.
operation: operation:
1 - verify 1 - verify
2 - encrypt 2 - encrypt
3 - decrypt 3 - decrypt
FILE_DONE FILE_DONE
Marks the end of a file processing which has been started 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 Mark the start and end of the actual decryption process. These
are also emitted when in --list-only mode. 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> BEGIN_ENCRYPTION <mdc_method> <sym_algo>
END_ENCRYPTION END_ENCRYPTION
Mark the start and end of the actual encryption process. 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 "char" is the character displayed with no --status-fd enabled, with
the linefeed replaced by an 'X'. "cur" is the current amount 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 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 TOATL && CUR == TOTAL
may be used to detect the end of an operation. may be used to detect the end of an operation.
Well known values for WHAT: Well known values for WHAT:
@ -524,7 +529,7 @@ more arguments in future versions.
"learncard" Send by the agent and gpgsm while learing "learncard" Send by the agent and gpgsm while learing
the data of a smartcard. the data of a smartcard.
"card_busy" A smartcard is still working "card_busy" A smartcard is still working
SIG_CREATED <type> <pubkey algo> <hash algo> <class> <timestamp> <key fpr> SIG_CREATED <type> <pubkey algo> <hash algo> <class> <timestamp> <key fpr>
A signature has been created using these parameters. A signature has been created using these parameters.
type: 'D' = detached type: 'D' = detached
@ -536,7 +541,7 @@ more arguments in future versions.
Note, that TIMESTAMP may either be a number with seconds since Note, that TIMESTAMP may either be a number with seconds since
epoch or an ISO 8601 string which can be detected by the epoch or an ISO 8601 string which can be detected by the
presence of the letter 'T' inside. presence of the letter 'T' inside.
KEY_CREATED <type> <fingerprint> [<handle>] KEY_CREATED <type> <fingerprint> [<handle>]
A key has been created A key has been created
type: 'B' = primary and subkey 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 is used. The format is suitable to be passed to the option
--override-session-key --override-session-key
NOTATION_NAME <name> NOTATION_NAME <name>
NOTATION_DATA <string> NOTATION_DATA <string>
name and string are %XX escaped; the data may be split name and string are %XX escaped; the data may be split
among several NOTATION_DATA lines. among several NOTATION_DATA lines.
USERID_HINT <long main keyid> <string> 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> POLICY_URL <string>
string is %XX escaped string is %XX escaped
@ -587,7 +592,7 @@ more arguments in future versions.
8 := "Policy mismatch" 8 := "Policy mismatch"
9 := "Not a secret key" 9 := "Not a secret key"
10 := "Key not trusted" 10 := "Key not trusted"
11 := "Missing certificate" 11 := "Missing certificate"
12 := "Missing issuer certificate" 12 := "Missing issuer certificate"
Note that for historical reasons the INV_RECP status is also Note that for historical reasons the INV_RECP status is also
@ -621,9 +626,9 @@ more arguments in future versions.
SUCCESS [<location>] SUCCESS [<location>]
Postive confirimation that an operation succeeded. <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. Used only with a few commands.
ATTRIBUTE <fpr> <octets> <type> <index> <count> ATTRIBUTE <fpr> <octets> <type> <index> <count>
<timestamp> <expiredate> <flags> <timestamp> <expiredate> <flags>
@ -650,7 +655,7 @@ more arguments in future versions.
3 = Card with serialnumber detected 3 = Card with serialnumber detected
4 = No card available. 4 = No card available.
5 = No card reader available 5 = No card reader available
6 = No card support available 6 = No card support available
PLAINTEXT <format> <timestamp> <filename> PLAINTEXT <format> <timestamp> <filename>
This indicates the format of the plaintext that is about to be 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 relinquishes the GUI from implementing its own passphrase
entry code. This is a global option. entry code. This is a global option.
%no-ask-passphrase %no-ask-passphrase
Disable the ask-passphrase mode. Disable the ask-passphrase mode.
%no-protection %no-protection
With GnuPG 2.1 it is not anymore possible to specify a With GnuPG 2.1 it is not anymore possible to specify a
passphrase for unattended key generation. The passphrase 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 information and which is also part of the fingerprint
calculation. Either a date like "1986-04-26" or a full calculation. Either a date like "1986-04-26" or a full
timestamp like "19860426T042640" may be used. The time is 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. is used.
Preferences: <string> Preferences: <string>
Set the cipher, hash, and compression preference values for Set the cipher, hash, and compression preference values for
@ -1207,7 +1212,7 @@ Other Notes
OIDs below the GnuPG arc: 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 notation
1.3.6.1.4.1.11591.2.1.1 pkaAddress 1.3.6.1.4.1.11591.2.1.1 pkaAddress
1.3.6.1.4.1.11591.2.12242973 invalid encoded OID 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. This can be implemented using Hurd's translator mechanism.
However, I think the whole key server stuff has to be re-thought; However, I think the whole key server stuff has to be re-thought;
I have some ideas and probably create a white paper. I have some ideas and probably create a white paper.

View File

@ -1,5 +1,8 @@
2011-02-03 Werner Koch <wk@g10code.com> 2011-02-03 Werner Koch <wk@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. * misc.c (has_invalid_email_chars): Relax mailbox name checking.
Fixes bug#1315. Fixes bug#1315.

View File

@ -30,6 +30,7 @@
#include "cipher.h" #include "cipher.h"
#include "options.h" #include "options.h"
#include "i18n.h" #include "i18n.h"
#include "status.h"
static int mdc_decode_filter ( void *opaque, int control, IOBUF a, 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]; byte temp[32];
unsigned blocksize; unsigned blocksize;
unsigned nprefix; unsigned nprefix;
dfx = xtrycalloc (1, sizeof *dfx); dfx = xtrycalloc (1, sizeof *dfx);
if (!dfx) if (!dfx)
return gpg_error_from_syserror (); 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 ( opt.verbose && !dek->algo_info_printed )
{ {
if (!openpgp_cipher_test_algo (dek->algo)) 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)); openpgp_cipher_algo_name (dek->algo));
else else
log_info (_("encrypted with unknown algorithm %d\n"), dek->algo ); log_info (_("encrypted with unknown algorithm %d\n"), dek->algo );
dek->algo_info_printed = 1; 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); rc = openpgp_cipher_test_algo (dek->algo);
if (rc) if (rc)
goto leave; 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) ) if ( ed->len && ed->len < (nprefix+2) )
BUG(); BUG();
if ( ed->mdc_method ) if ( ed->mdc_method )
{ {
if (gcry_md_open (&dfx->mdc_hash, ed->mdc_method, 0 )) if (gcry_md_open (&dfx->mdc_hash, ed->mdc_method, 0 ))
BUG (); BUG ();
@ -142,7 +151,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
goto leave; goto leave;
} }
if (!ed->buf) if (!ed->buf)
{ {
log_error(_("problem handling encrypted packet\n")); log_error(_("problem handling encrypted packet\n"));
goto leave; goto leave;
@ -152,7 +161,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
if ( ed->len ) 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 ) if ( (c=iobuf_get(ed->buf)) == -1 )
break; break;
@ -160,7 +169,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
temp[i] = c; temp[i] = c;
} }
} }
else else
{ {
for (i=0; i < (nprefix+2); i++ ) for (i=0; i < (nprefix+2); i++ )
if ( (c=iobuf_get(ed->buf)) == -1 ) if ( (c=iobuf_get(ed->buf)) == -1 )
@ -168,7 +177,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
else else
temp[i] = c; temp[i] = c;
} }
gcry_cipher_decrypt (dfx->cipher_hd, temp, nprefix+2, NULL, 0); gcry_cipher_decrypt (dfx->cipher_hd, temp, nprefix+2, NULL, 0);
gcry_cipher_sync (dfx->cipher_hd); gcry_cipher_sync (dfx->cipher_hd);
p = temp; 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); rc = gpg_error (GPG_ERR_BAD_KEY);
goto leave; goto leave;
} }
if ( dfx->mdc_hash ) if ( dfx->mdc_hash )
gcry_md_write (dfx->mdc_hash, temp, nprefix+2); 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 ) if (dfx->eof_seen > 1 )
rc = gpg_error (GPG_ERR_INV_PACKET); rc = gpg_error (GPG_ERR_INV_PACKET);
else if ( ed->mdc_method ) else if ( ed->mdc_method )
{ {
/* We used to let parse-packet.c handle the MDC packet but this /* We used to let parse-packet.c handle the MDC packet but this
turned out to be a problem with compressed packets: With old turned out to be a problem with compressed packets: With old
style packets there is no length information available and 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 message:", dfx->defer, 22); */
/* log_printhex("MDC calc:", gcry_md_read (dfx->mdc_hash,0), datalen); */ /* log_printhex("MDC calc:", gcry_md_read (dfx->mdc_hash,0), datalen); */
} }
leave: leave:
release_dfx_context (dfx); release_dfx_context (dfx);
return rc; 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 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 packet is not followed by other data. This used to be a long
standing bug which was fixed on 2009-10-02. */ standing bug which was fixed on 2009-10-02. */
if ( control == IOBUFCTRL_UNDERFLOW && dfx->eof_seen ) if ( control == IOBUFCTRL_UNDERFLOW && dfx->eof_seen )
{ {
*ret_len = 0; *ret_len = 0;
@ -265,7 +274,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
{ {
assert (a); assert (a);
assert (size > 44); /* Our code requires at least this size. */ assert (size > 44); /* Our code requires at least this size. */
/* Get at least 22 bytes and put it ahead in the buffer. */ /* Get at least 22 bytes and put it ahead in the buffer. */
if (dfx->partial) if (dfx->partial)
{ {
@ -286,7 +295,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
buf[n] = c; buf[n] = c;
} }
} }
if (n == 44) if (n == 44)
{ {
/* We have enough stuff - flush the deferred stuff. */ /* We have enough stuff - flush the deferred stuff. */
if ( !dfx->defer_filled ) /* First time. */ if ( !dfx->defer_filled ) /* First time. */
@ -301,7 +310,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
/* Fill up the buffer. */ /* Fill up the buffer. */
if (dfx->partial) if (dfx->partial)
{ {
for (; n < size; n++ ) for (; n < size; n++ )
{ {
if ( (c = iobuf_get(a)) == -1 ) if ( (c = iobuf_get(a)) == -1 )
{ {
@ -313,7 +322,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
} }
else else
{ {
for (; n < size && dfx->length; n++, dfx->length--) for (; n < size && dfx->length; n++, dfx->length--)
{ {
c = iobuf_get(a); c = iobuf_get(a);
if (c == -1) if (c == -1)
@ -326,7 +335,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
if (!dfx->length) if (!dfx->length)
dfx->eof_seen = 1; /* Normal EOF. */ dfx->eof_seen = 1; /* Normal EOF. */
} }
/* Move the trailing 22 bytes back to the defer buffer. We /* Move the trailing 22 bytes back to the defer buffer. We
have at least 44 bytes thus a memmove is not needed. */ have at least 44 bytes thus a memmove is not needed. */
n -= 22; n -= 22;
@ -362,11 +371,11 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
} }
*ret_len = n; *ret_len = n;
} }
else if ( control == IOBUFCTRL_FREE ) else if ( control == IOBUFCTRL_FREE )
{ {
release_dfx_context (dfx); release_dfx_context (dfx);
} }
else if ( control == IOBUFCTRL_DESC ) else if ( control == IOBUFCTRL_DESC )
{ {
*(char**)buf = "mdc_decode_filter"; *(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; *ret_len = 0;
rc = -1; rc = -1;
} }
else if ( control == IOBUFCTRL_UNDERFLOW ) else if ( control == IOBUFCTRL_UNDERFLOW )
{ {
assert(a); assert(a);
if (fc->partial) if (fc->partial)
{ {
for (n=0; n < size; n++ ) for (n=0; n < size; n++ )
{ {
c = iobuf_get(a); c = iobuf_get(a);
if (c == -1) if (c == -1)
@ -407,7 +416,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
} }
else 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); c = iobuf_get(a);
if (c == -1) if (c == -1)
@ -433,7 +442,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
} }
*ret_len = n; *ret_len = n;
} }
else if ( control == IOBUFCTRL_FREE ) else if ( control == IOBUFCTRL_FREE )
{ {
release_dfx_context (fc); release_dfx_context (fc);
} }
@ -443,4 +452,3 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
} }
return rc; return rc;
} }