aboutsummaryrefslogtreecommitdiffstats
path: root/g10/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-01-23 18:08:16 +0000
committerWerner Koch <[email protected]>2018-01-23 18:08:16 +0000
commitf3ef8b0dcaede1c85da0dff8eeceda6a994f0b28 (patch)
tree26438580bccad14556dd29a97591baa26cef217e /g10/misc.c
parentgpg: Copy the AEAD prefs to the user ID struct. (diff)
downloadgnupg-f3ef8b0dcaede1c85da0dff8eeceda6a994f0b28.tar.gz
gnupg-f3ef8b0dcaede1c85da0dff8eeceda6a994f0b28.zip
gpg: New option --chunk-size.
* g10/gpg.c (opts): New option --chunk-size. (oChunkSize): New const. (build_list_aead_test_algo, build_list_aead_algo_name): New. (my_strusage): List AEAD algos. (main): Implement --chunk-size.. * g10/options.h (struct opt): Add field 'chunk_size'. (DBG_IPC): Remove duplicated macro. * g10/main.h (DEFAULT_AEAD_ALGO): Depend on Libgcrypt version. * g10/misc.c (openpgp_aead_test_algo): Ditto. * g10/cipher-aead.c: Silence if not in debug mode. * g10/decrypt-data.c: Ditto. -- And that new option immediatley revealed bugs in our chunking code :-(.
Diffstat (limited to 'g10/misc.c')
-rw-r--r--g10/misc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c
index 36d3bdc36..8c54793ed 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -591,11 +591,23 @@ openpgp_cipher_algo_name (cipher_algo_t algo)
gpg_error_t
openpgp_aead_test_algo (aead_algo_t algo)
{
+ /* FIXME: We currently have no easy way to test whether libgcrypt
+ * implements a mode. The only way we can do this is to open a
+ * cipher context with that mode and close it immediately. That is
+ * a bit costly. So we look at the libgcrypt version and assume
+ * nothing has been patched out. */
switch (algo)
{
case AEAD_ALGO_NONE:
break;
+
case AEAD_ALGO_EAX:
+#if GCRYPT_VERSION_NUMBER < 0x010900
+ break;
+#else
+ return 0;
+#endif
+
case AEAD_ALGO_OCB:
return 0;
}