core: New decryption result flag 'legacy_cipher_nomdc'.

* src/gpgme.h.in (_gpgme_op_decrypt_result): Add flag
legacy_cipher_nomdc.
* src/decrypt.c (parse_status_error): Set this flag.
* tests/run-decrypt.c (print_result): print it.
(main): Print the result even on error.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-06-01 01:01:08 +02:00
parent e2aa38b56a
commit dd19cabe81
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
5 changed files with 34 additions and 7 deletions

2
NEWS
View File

@ -6,10 +6,12 @@ Noteworthy changes in version 1.11.2 (unreleased)
* Interface changes relative to the 1.11.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_decrypt_result_t EXTENDED: New field legacy_cipher_nomdc.
cpp: DecryptionResult::sessionKey NEW.
cpp: DecryptionResult::symkeyAlgo NEW.
cpp: Data::rewind NEW.
Noteworthy changes in version 1.11.1 (2018-04-20)
-------------------------------------------------

View File

@ -5368,7 +5368,7 @@ This is a pointer to a structure used to store the result of a
data, you can retrieve the pointer to the result with
@code{gpgme_op_decrypt_result}. As with all result structures, it
this structure shall be considered read-only and an application must
not allocated such a strucure on its own. The structure contains the
not allocate such a strucure on its own. The structure contains the
following members:
@table @code
@ -5378,9 +5378,22 @@ algorithm that is not supported.
@item unsigned int wrong_key_usage : 1
@since{0.9.0}
This is true if the key was not used according to its policy.
@item unsigned int legacy_cipher_nomdc : 1
@since{1.11.2}
The message was made by a legacy algorithm without any integrity
protection. This might be an old but legitimate message.
@item unsigned int is_mime : 1;
@since{1.11.0}
The message claims that the content is a MIME object.
@item unsigned int is_de_vs : 1;
@since{1.10.0}
The message was encrypted in a VS-NfD compliant way. This is a
specification in Germany for a restricted communication level.
@item gpgme_recipient_t recipients
@since{1.1.0}

View File

@ -57,7 +57,7 @@ typedef struct
int any_no_seckey;
/* If the engine emits a DECRYPTION_INFO status and that does not
* indicate that an integrity proetction mode is active, this flag
* indicate that an integrity protection mode is active, this flag
* is set. */
int not_integrity_protected;
@ -214,6 +214,11 @@ parse_status_error (char *args, op_data_t opd)
break;
}
}
else if (!strcmp (field[0], "nomdc_with_legacy_cipher"))
{
opd->result.legacy_cipher_nomdc = 1;
opd->not_integrity_protected = 1;
}
free (args2);

View File

@ -1365,8 +1365,12 @@ struct _gpgme_op_decrypt_result
/* The message claims that the content is a MIME object. */
unsigned int is_mime : 1;
/* The message was made by a legacy algorithm without any integrity
* protection. This might be an old but legitimate message. */
unsigned int legacy_cipher_nomdc : 1;
/* Internal to GPGME, do not use. */
int _unused : 29;
int _unused : 28;
gpgme_recipient_t recipients;

View File

@ -55,6 +55,7 @@ print_result (gpgme_decrypt_result_t result)
printf ("Original file name .: %s\n", nonnull(result->file_name));
printf ("Wrong key usage ....: %s\n", result->wrong_key_usage? "yes":"no");
printf ("Legacy w/o MDC ... .: %s\n", result->legacy_cipher_nomdc?"yes":"no");
printf ("Compliance de-vs ...: %s\n", result->is_de_vs? "yes":"no");
printf ("MIME flag ..........: %s\n", result->is_mime? "yes":"no");
printf ("Unsupported algo ...: %s\n", nonnull(result->unsupported_algorithm));
@ -267,6 +268,8 @@ main (int argc, char **argv)
if (err)
{
fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err));
if (result)
print_result (result);
exit (1);
}
if (result)