diff options
author | Werner Koch <[email protected]> | 2020-04-16 06:52:29 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2020-04-16 06:52:29 +0000 |
commit | cec397e00240829495de2b487fe60d997d810c03 (patch) | |
tree | bf110c9ca7e93e3368c0a0ea4bbb8520d6f80322 /g10/decrypt-data.c | |
parent | indent: Some typo and indentation changes for gpg. (diff) | |
download | gnupg-cec397e00240829495de2b487fe60d997d810c03.tar.gz gnupg-cec397e00240829495de2b487fe60d997d810c03.zip |
gpg: Make AEAD modes subject to compliance checks.
* 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]>
Diffstat (limited to 'g10/decrypt-data.c')
-rw-r--r-- | g10/decrypt-data.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c index 86a16a718..345447db1 100644 --- a/g10/decrypt-data.c +++ b/g10/decrypt-data.c @@ -220,6 +220,8 @@ int decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) { decode_filter_ctx_t dfx; + enum gcry_cipher_modes ciphermode; + unsigned int startivlen; byte *p; int rc=0, c, i; byte temp[32]; @@ -243,9 +245,18 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) dek->algo_info_printed = 1; } + if (ed->aead_algo) + { + rc = openpgp_aead_algo_info (ed->aead_algo, &ciphermode, &startivlen); + if (rc) + goto leave; + log_assert (startivlen <= sizeof dfx->startiv); + } + else + ciphermode = GCRY_CIPHER_MODE_CFB; + /* Check compliance. */ - if (! gnupg_cipher_is_allowed (opt.compliance, 0, dek->algo, - GCRY_CIPHER_MODE_CFB)) + if (!gnupg_cipher_is_allowed (opt.compliance, 0, dek->algo, ciphermode)) { log_error (_("cipher algorithm '%s' may not be used in %s mode\n"), openpgp_cipher_algo_name (dek->algo), @@ -286,20 +297,12 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek) if (ed->aead_algo) { - enum gcry_cipher_modes ciphermode; - unsigned int startivlen; - if (blocksize != 16) { rc = gpg_error (GPG_ERR_CIPHER_ALGO); goto leave; } - rc = openpgp_aead_algo_info (ed->aead_algo, &ciphermode, &startivlen); - if (rc) - goto leave; - log_assert (startivlen <= sizeof dfx->startiv); - if (ed->chunkbyte > 56) { log_error ("invalid AEAD chunkbyte %u\n", ed->chunkbyte); |