aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-01-21 15:42:29 +0000
committerWerner Koch <[email protected]>2018-01-21 16:00:27 +0000
commit7356d6ec50ea24bc9449187e1c2b3ecd717b789f (patch)
tree5740a607ce592858e1d93527c00a741c0188a4bc
parentgpg: First take on PKT_ENCRYPTED_AEAD. (diff)
downloadgnupg-7356d6ec50ea24bc9449187e1c2b3ecd717b789f.tar.gz
gnupg-7356d6ec50ea24bc9449187e1c2b3ecd717b789f.zip
gpg: Support EAX if for latest Libgcrypt.
* g10/cipher-aead.c (MY_GCRY_CIPHER_MODE_EAX): New. (write_header): Use it. * g10/decrypt-data.c (MY_GCRY_CIPHER_MODE_EAX): New. (decrypt_data): Use it. * g10/misc.c (openpgp_aead_test_algo): Allow EAX. -- This allows the use of EAX when the latest Libgcrypt master is used. Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--g10/cipher-aead.c10
-rw-r--r--g10/decrypt-data.c9
-rw-r--r--g10/misc.c1
3 files changed, 16 insertions, 4 deletions
diff --git a/g10/cipher-aead.c b/g10/cipher-aead.c
index f247a83de..1d7263419 100644
--- a/g10/cipher-aead.c
+++ b/g10/cipher-aead.c
@@ -33,6 +33,11 @@
#include "options.h"
#include "main.h"
+/* FIXME: Libgcrypt 1.9 will support EAX. Until we kame this a
+ * requirement we hardwire the enum used for EAX. */
+#define MY_GCRY_CIPHER_MODE_EAX 14
+
+
/* The size of the buffer we allocate to encrypt the data. This must
* be a multiple of the OCB blocksize (16 byte). */
#define AEAD_ENC_BUFFER_SIZE (64*1024)
@@ -151,6 +156,11 @@ write_header (cipher_filter_context_t *cfx, iobuf_t a)
startivlen = 15;
break;
+ case AEAD_ALGO_EAX:
+ ciphermode = MY_GCRY_CIPHER_MODE_EAX;
+ startivlen = 16;
+ break;
+
default:
log_error ("unsupported AEAD algo %d\n", cfx->dek->use_aead);
err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c
index 80e16ecb7..79e255480 100644
--- a/g10/decrypt-data.c
+++ b/g10/decrypt-data.c
@@ -31,6 +31,10 @@
#include "../common/status.h"
#include "../common/compliance.h"
+/* FIXME: Libgcrypt 1.9 will support EAX. Until we kame this a
+ * requirement we hardwire the enum used for EAX. */
+#define MY_GCRY_CIPHER_MODE_EAX 14
+
static int aead_decode_filter (void *opaque, int control, iobuf_t a,
byte *buf, size_t *ret_len);
@@ -278,9 +282,8 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
break;
case AEAD_ALGO_EAX:
startivlen = 16;
- log_error ("unsupported AEAD algo %d\n", ed->aead_algo);
- rc = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
- goto leave;
+ ciphermode = MY_GCRY_CIPHER_MODE_EAX;
+ break;
default:
log_error ("unknown AEAD algo %d\n", ed->aead_algo);
rc = gpg_error (GPG_ERR_INV_CIPHER_MODE);
diff --git a/g10/misc.c b/g10/misc.c
index 2da0d270c..f7ac3c708 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -591,7 +591,6 @@ openpgp_aead_test_algo (aead_algo_t algo)
case AEAD_ALGO_NONE:
break;
case AEAD_ALGO_EAX:
- return gpg_error (GPG_ERR_NOT_SUPPORTED);
case AEAD_ALGO_OCB:
return 0;
}