aboutsummaryrefslogtreecommitdiffstats
path: root/g10/decrypt-data.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-11-21gpg: Add the AEAD algo number to the DECRYPTION_INFO status line.Werner Koch1-1/+1
* g10/decrypt-data.c (decrypt_data): Print the aead_algo -- GnuPG-bug-id: 7398
2024-09-19gpg: Avoid wrong decryption_failed for signed+OCB msg w/o pubkey.Werner Koch1-0/+9
* g10/decrypt-data.c (struct decode_filter_context_s): Add flag checktag_failed. (aead_checktag): Set flag. (decrypt_data): Initially clear that flag and check the flag after the decryption. * g10/mainproc.c (proc_encrypted): Revert the log_get_errorcount based check. -- This fixes a bug where for an OCB encrypted and signed message with the signing key missing during decryption the DECRYPTION_FAILED status line was printed along with "WARNING: encrypted message has been manipulated". This was because we use log_error to show that the signature could not be verified due to the missing pubkey; the original fix looked at the error counter and thus triggered the decryption failed status. Fixes-commit: 82b39fe254703776209cebb88f428bf2d1eb596b GnuPG-bug-id: 7042
2024-03-14gpg: Make sure a DECRYPTION_OKAY is never issued for a bad OCB tag.Werner Koch1-0/+1
* g10/mainproc.c (proc_encrypted): Force a decryption failure if any error has been seen. * g10/decrypt-data.c (aead_checktag): Issue an ERROR line. -- GnuPG-bug-id: 7042 Note that gpg in any case returns a failure exit code but due to double forking GPGME would not see it.
2022-08-29gpg: Very minor cleanup in decrypt_data.Werner Koch1-3/+6
* g10/decrypt-data.c (decrypt_data): Show also the aead algo with --show-session-key. Remove meanwhile superfluous NULL-ptr test.
2022-08-29g10/decrypt-data: disable output estream buffering to reduce overheadJussi Kivilinna1-0/+2
* g10/decrypt-data.c (decrypt_data): Disable estream buffering for output file. -- Here estream is filled with iobuf_copy which already uses large buffers so additional buffering in estream was just adding memory copy overhead. GnuPG-bug-id: T5828 Signed-off-by: Jussi Kivilinna <[email protected]>
2022-03-18gpg: Print info about the used AEAD algorithm.Werner Koch1-2/+2
* g10/misc.c (openpgp_cipher_algo_mode_name): New. * g10/decrypt-data.c (decrypt_data): Use function here. -- With out this change we would see gpg: cipher algorithm 'AES256' may not be used in --compliance=de-vs mode This is confusing because AES256 is compliant. Now we see gpg: cipher algorithm 'AES256.OCB' may not be used in --compliance=de-vs mode which gives a hint on the problem.
2022-03-18gpg: Allow decryption of symencr even for non-compliant cipher.Werner Koch1-4/+17
* g10/decrypt-data.c (decrypt_data): Add arg compliance_error. Adjust all callers. Fail on compliance error only in --require-compliance mode. Make sure to return an error if the buffer is missing; actually that should be an assert. * g10/mainproc.c (proc_encrypted): Delay printing of the compliance mode status. Consult the compliance error now returned by decrypt_data. -- The actual case here is that we fail hard if a message has been AEAD encrypted with one AEAD capable key and also with one passphrase. In general the preference system takes care of not using AEAD if one recipient's key does not support it. However, if the sender uses her own AEAD-capable key _and_ a passphrase the message will be AEAD encrypted. This change allows to decrypt that anyway along with a warning message. Note that this does currently not work in 2.3 due to a non-compliant libgcrypt. We will however, backport this to 2.2.
2020-05-12common: Change argument order of log_printhex.Werner Koch1-6/+6
* common/logging.c (log_printhex): Chnage order of args. Make it printf alike. Change all callers. * configure.ac: Add -Wno-format-zero-length -- This makes it consistent with modern libgpgrt logging and thus eases back porting from newer GnuPG versions which use libgpgrt logging. Signed-off-by: Werner Koch <[email protected]>
2020-04-16gpg: Make AEAD modes subject to compliance checks.Werner Koch1-10/+13
* g10/decrypt-data.c (decrypt_data): Move aead algo detection up. -- Note that the AEAD modes are not yet approved for --compliance=de-vs Signed-off-by: Werner Koch <[email protected]>
2020-04-16gpg: Support decryption of the new AEAD packetWerner Koch1-4/+494
* common/openpgpdefs.h (aead_algo_t): New. (pkttype_t): Add PKT_ENCRYPTED_AEAD. * g10/decrypt-data.c (struct decode_filter_context_s): Add fields for AEAD. (aead_set_nonce_and_ad): New. (aead_checktag): New. (decrypt_data): Support AEAD. (aead_underflow): New. (aead_decode_filter): New. * g10/dek.h (DEK): Add field use_aead. Turn use_mdc, algo_info_printed, and symmetric into bit flags. * g10/mainproc.c (struct mainproc_context): Add field seen_pkt_encrypted_aead. (release_list): Clear it. (have_seen_pkt_encrypted_aead): New. (symkey_decrypt_seskey): Support AEAD. (proc_symkey_enc): Ditto. (proc_encrypted): Ditto. (proc_plaintext): Ditto. * g10/misc.c (MY_GCRY_CIPHER_MODE_EAX): New. (openpgp_aead_test_algo): New. (openpgp_aead_algo_name): New. (openpgp_aead_algo_info): New. * g10/packet.h (PKT_symkey_enc): Add field use_aead. (PKT_user_id): Add field flags.aead (PKT_public_key): Ditto. (PKT_encrypted): Add fields for AEAD. * g10/parse-packet.c (parse): Handle PKT_ENCRYPTED_AEAD. (parse_symkeyenc): Support AEAD. (parse_encrypted): Ditto. (dump_sig_subpkt): Dump AEAD preference packet. (parse_encrypted_aead): New. -- This patch allows to decrypt data encrypted using the new AEAD mechanism as specified in rfc4880bis. Although preferences are used to enable this new mode, it is useful to have at least a decryption option in case a user switches between GnuPG 2.2 and newer versions. The new AEAD mechanism is much faster than the current CFB+MDC and thus 2.2 will allow faster decryption of symmetric only decryption. This patch is based on the current master (2.3) code base and includes a few other patches. In particular commit 44be675b759d27bac310c2de8bae1b7882a26b65 (gpg: More check for symmetric key encryption.) is included. Signed-off-by: Werner Koch <[email protected]>
2020-04-15gpg: Improve symmetric decryption speed by about 25%Werner Koch1-77/+58
* g10/decrypt-data.c (mdc_decode_filter, decode_filter): Fatcor buffer filling code out to ... (fill_buffer): new. -- This patch includes the master commit d989373f1a46139ed0fbc4d4a91069b78617ad9 and 5d6c080522e1666943b75c99124fb69b985b6941 Benchmarking on our usual X220 shows for a 1.3GiB non-compressed non-armored AES encrypted file (ECDH encrypted but the symmetric decryption takes the majority of the time, reading from stdin writing to /dev/null): | | before | after | |------------+-----------+-----------| | real | 0m15.006s | 0m11.849s | | user | 0m14.304s | 0m11.259s | | sys | 0m0.640s | 0m0.537s | | throughput | 90 MiB/s | 115 MiB/s | Signed-off-by: Werner Koch <[email protected]>
2020-04-15gpg: Reformat parts of decrypt-data.cWerner Koch1-101/+125
* g10/decrypt-data.c (struct decode_filter_context_s): Rename 'defer' to 'holdback' and 'defer_filled' to 'holdbacklen'. Increase size of holdback to allow for future AEAD decryption. Turn 'partial' and 'eof_seen' into bit fields. (decrypt_data): Replace write_status_text by write_Status_printf. Indent parts of the code. -- Signed-off-by: Werner Koch <[email protected]>
2017-07-28gpg,sm: String changes for compliance diagnostics.Werner Koch1-2/+1
Signed-off-by: Werner Koch <[email protected]>
2017-06-23indent,i18n: Make some new strings translatable. Wrap too long lines.Werner Koch1-1/+2
--
2017-06-19indent: Always use "_(" and not "_ (" to mark translatable strings.Werner Koch1-2/+2
-- This makes greping much easier and we have done that since ever. Signed-off-by: Werner Koch <[email protected]>
2017-06-08common,gpg,sm: Restrict the use of algorithms according to CO_DE_VS.Justus Winter1-0/+12
* common/compliance.c (gnupg_pk_is_allowed): New function. (gnupg_cipher_is_allowed): Likewise. (gnupg_digest_is_allowed): Likewise. * common/compliance.h (enum pk_use_case): New definition. (gnupg_pk_is_allowed): New prototype. (gnupg_cipher_is_allowed): Likewise. (gnupg_digest_is_allowed): Likewise. * g10/decrypt-data.c (decrypt_data): Restrict use of algorithms using the new predicates. * g10/encrypt.c (encrypt_crypt): Likewise. * g10/gpg.c (main): Likewise. * g10/pubkey-enc.c (get_session_key): Likewise. * g10/sig-check.c (check_signature2): Likewise. * g10/sign.c (do_sign): Likewise. * sm/decrypt.c (gpgsm_decrypt): Likewise. * sm/encrypt.c (gpgsm_encrypt): Likewise. * sm/gpgsm.c (main): Likewise. * sm/sign.c (gpgsm_sign): Likewise. * sm/verify.c (gpgsm_verify): Likewise. -- With this change, policies can effectively restrict what algorithms are used for different purposes. The algorithm policy for CO_DE_VS is implemented. GnuPG-bug-id: 3191 Signed-off-by: Justus Winter <[email protected]>
2017-03-28g10: Fix memory leak.Justus Winter1-1/+2
* g10/decrypt-data.c (decrypt_data): Free 'filename'. Signed-off-by: Justus Winter <[email protected]>
2017-03-07Remove -I option to common.NIIBE Yutaka1-3/+3
* dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <[email protected]>
2016-11-05Change all http://www.gnu.org in license notices to https://Werner Koch1-1/+1
--
2016-04-29gpg: Remove all assert.h and s/assert/log_assert/.Werner Koch1-8/+7
Signed-off-by: Werner Koch <[email protected]>
2016-01-12common: Fix iobuf API of filter function for alignment.NIIBE Yutaka1-2/+2
* common/iobuf.h (IOBUFCTRL_DESC): Change the call semantics. * common/iobuf.c (iobuf_desc): Add the second argument DESC. (print_chain, iobuf_close, do_open, iobuf_sockopen, iobuf_ioctl) (iobuf_push_filter2, pop_filter, iobuf_write_temp): Change calls of iobuf_desc. (file_filter, file_es_filter, sock_filter, block_filter): Fill the description. * common/t-iobuf.c (every_other_filter, double_filter): Likewise. * g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c, g10/decrypt-data.c, g10/encrypt.c, g10/mdfilter.c, g10/progress.c, g10/textfilter.c: Likewise. -- Newer GCC warns against possible alignment difference of pointers. This change can silence those warnings. Signed-off-by: NIIBE Yutaka <[email protected]>
2015-11-06gpg: Avoid new strings.Werner Koch1-2/+2
* g10/decrypt-data.c (decrypt_data): Use already translated strings. Signed-off-by: Werner Koch <[email protected]>
2015-11-06gpg: Fix formatting string.Neal H. Walfield1-1/+1
* g10/decrypt-data.c (decrypt_data): Fix formatting string. -- Signed-off-by: Neal H. Walfield <[email protected]>
2015-11-05gpg: Add support for unwrapping the outer level of encryption.Neal H. Walfield1-1/+32
* g10/decrypt-data.c (decrypt_data): If OPT.UNWRAP_ENCRYPTION is set, copy the data to the output file instead of continuing to process it. * g10/gpg.c (enum cmd_and_opt_values): Add new value oUnwrap. (opts): Handle oUnwrap. (main): Likewise. * g10/options.h (opt): Add field unwrap_encryption. * g10/plaintext.c (handle_plaintext): Break the output file selection functionality into ... (get_output_file): ... this new function. -- Signed-off-by: Neal H. Walfield <[email protected]> GnuPG-bug-id: 1060 Debian-bug-id: 282061
2015-01-22gpg: Replace remaining old error code macros by GPG_ERR_.Werner Koch1-1/+1
* g10/gpg.h (g10_errstr): Remove macro and change all occurrences by gpg_strerror. (G10ERR_): Remove all macros and change all occurrences by their GPG_ERR_ counterparts. Signed-off-by: Werner Koch <[email protected]>
2014-11-26gpg: Change a bug() call to a regular error message.Werner Koch1-1/+6
* g10/decrypt-data.c (decrypt_data): Return an error code instead of calling BUG(). -- This code path can be triggered by fuzzing gpg and thus with some likeness also by corrupt messages for other reasons.
2014-05-14gpg: Remove useless diagnostic in MDC verification.Werner Koch1-8/+4
* g10/decrypt-data.c (decrypt_data): Do not distinguish between a bad MDC packer header and a bad MDC. -- The separate diagnostic was introduced for debugging a problems. For explaining an MDC error a single error message is easier to understand.
2014-01-29gpg: Remove cipher.h and put algo ids into a common file.Werner Koch1-1/+0
* common/openpgpdefs.h (cipher_algo_t, pubkey_algo_t, digest_algo_t) (compress_algo_t): New. * agent/gpg-agent.c: Remove ../g10/cipher.h. Add openpgpdefs.h. * g10/cipher.h (DEK): Move to ... * g10/dek.h: new file. * g10/cipher.h (is_RSA, is_ELGAMAL, is_DSA) (PUBKEY_MAX_NPKEY, PUBKEY_MAX_NSKEY, PUBKEY_MAX_NSIG, PUBKEY_MAX_NENC) (PUBKEY_USAGE_SIG, PUBKEY_USAGE_ENC, PUBKEY_USAGE_CERT) (PUBKEY_USAGE_AUTH, PUBKEY_USAGE_NONE): Move to * g10/packet.h: here. * g10/cipher.h: Remove. Remove from all files. * g10/filter.h, g10/packet.h: Include dek.h. * g10/Makefile.am (common_source): Remove cipher.h. Add dek.h. Signed-off-by: Werner Koch <[email protected]>
2013-12-11gpg: Change --show-session-key to print the session key earlier.Werner Koch1-0/+17
* g10/cpr.c (write_status_strings): New. (write_status_text): Replace code by a call to write_status_strings. * g10/mainproc.c (proc_encrypted): Remove show_session_key code. * g10/decrypt-data.c (decrypt_data): Add new show_session_key code. -- This feature can be used to return the session key for just a part of a file. For example to downloading just the first 32k of a huge file, decrypting that incomplete part and while ignoring all the errors break out the session key. The session key may then be used on the server to decrypt the entire file without the need to have the private key on the server. GnuPG-bug-id: 1389 Signed-off-by: Werner Koch <[email protected]>
2011-09-20Replace gcry_md_start_debug by gcry_md_debug.Werner Koch1-1/+1
This is to allow building with Libgcrypt master (1.6) which has some cleanups in the API/ABI.
2011-02-03Add a DECRYPTION_INFO status.Werner Koch1-25/+33
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.
2010-10-01Exporting secret keys via gpg-agent is now basically supported.Werner Koch1-2/+2
A couple of forward ported changes. Doc updates.
2009-10-02Implement the server comamnd DECRYPT.Werner Koch1-1/+1
Use int instead of gnupg_fd_t in the server. Comment fixes. Rename encr-data.c -> decrypt-data.c
2009-10-02Fixed EOF detection for encrypted packets.Werner Koch1-31/+113
The code won't get confused anymore by extra packages following the encrypted one.
2009-06-05Add full Camellia support.David Shaw1-7/+7
* configure.ac: Remove Camellia restriction. * gpg.c (main), misc.c (openpgp_cipher_test_algo): Remove Camellia restriction. * misc.c (map_cipher_openpgp_to_gcry), main.h: Add macros for openpgp_cipher_open, openpgp_cipher_get_algo_keylen, and openpgp_cipher_get_algo_blklen to wrap around the corresponding gcry_* functions, but pass the algorithm number through map_cipher_openpgp_to_gcry. This is needed in case the gcry algorithm number doesn't match the OpenPGP number (c.f. Camellia). * encr-data.c, pubkey-enc.c, mainproc.c, cipher.c, encode.c, seskey.c, passphrase.c, seckey-cert.c: Use new openpgp_cipher_* macros here.
2007-12-12Support DSA2.Werner Koch1-2/+3
Support Camellia for testing. More audit stuff.
2007-07-04Changed to GPLv3.Werner Koch1-4/+2
Removed intl/.
2007-02-26Add new SVN only file README.maintWerner Koch1-4/+3
doc/ * gpg.texi (GPG Configuration): Document envvar LANGUAGE. (GPG Configuration Options): Document show-primary-uid-only. g10/ * gpg.c (main): Add verify option show-primary-uid-only. * options.h (VERIFY_SHOW_PRIMARY_UID_ONLY): New. * mainproc.c (check_sig_and_print): Implement it. * encr-data.c (decrypt_data): Correctly test for unknown algorithm. * import.c (check_prefs): Ditto. * keyedit.c (show_prefs): Ditto. * mainproc.c (proc_symkey_enc): Ditto.
2006-12-06Fixes for CVE-2006-6235Werner Koch1-34/+75
2006-10-02Fix for bug 537Werner Koch1-184/+227
2006-06-25About to do a new releaseWerner Koch1-1/+1
2006-04-19Merged with gpg 1.4.3 code. Werner Koch1-48/+61
The gpg part does not yet build.
2005-05-31Updated FSF street address and preparations for a release candidate.Werner Koch1-1/+2
2005-02-10Disable the "quick check" bytes for PK decryptions. This is inDavid Shaw1-3/+5
regards to the Mister and Zuccherato attack on OpenPGP CFB mode.
2004-10-08* encr-data.c (decrypt_data): Give a warning with a weak key, but stillDavid Shaw1-5/+10
allow to decrypt the message.
2003-06-18Finished the bulk of changes for gnupg 1.9. This included switchingWerner Koch1-36/+47
to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
2002-06-29Update head to match stable 1.0David Shaw1-50/+46
2000-07-14See ChangeLog: Fri Jul 14 19:38:23 CEST 2000 Werner KochWerner Koch1-19/+30
2000-01-31See ChangeLog: Mon Jan 31 16:37:34 CET 2000 Werner KochWerner Koch1-1/+0
2000-01-27See ChangeLog: Thu Jan 27 18:00:44 CET 2000 Werner KochWerner Koch1-4/+4