diff options
author | Werner Koch <[email protected]> | 2018-01-23 11:07:25 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2018-01-23 11:07:57 +0000 |
commit | 9aab9167bca38323973e853845ca95ae8e9b6871 (patch) | |
tree | f06594e52ed3722b0cc37979c7d6d3829dcb0d96 /g10/import.c | |
parent | gpg: Unify AEAD parameter retrieval. (diff) | |
download | gnupg-9aab9167bca38323973e853845ca95ae8e9b6871.tar.gz gnupg-9aab9167bca38323973e853845ca95ae8e9b6871.zip |
gpg: Implement AEAD for SKESK packets.
* g10/packet.h (PKT_symkey_enc): Add field aead_algo.
* g10/build-packet.c (do_symkey_enc): Support version 5 packets.
* g10/parse-packet.c (parse_symkeyenc): Ditto.
* g10/encrypt.c (encrypt_symmetric): Force using a random session
key in AEAD mode.
(encrypt_seskey): Add and support arg aead_algo.
(write_symkey_enc): Ditto.
(encrypt_simple): Adjust accordingly.
(encrypt_filter): Ditto.
* g10/gpgcompose.c (sk_esk): For now call encrypt_seskey without AEAD
support.
* g10/mainproc.c (symkey_decrypt_seskey): Support AEAD. Nver call BUG
but return an error.
(proc_symkey_enc): Call symkey_decrypt_seskey in a bug compatible way.
* g10/import.c (check_prefs): Check AEAD preferences.
* g10/keyedit.c (show_prefs): Print AEAD preferences.
--
For easier debugging this patch also changes some diagnostics to also
print the encryption mode with the cipher algorithm.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/import.c')
-rw-r--r-- | g10/import.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c index 71e39557c..ed679d5c0 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1113,6 +1113,24 @@ check_prefs (ctrl_t ctrl, kbnode_t keyblock) problem=1; } } + else if(prefs->type==PREFTYPE_AEAD) + { + if (openpgp_aead_test_algo (prefs->value)) + { + /* FIXME: The test below is wrong. We should + * check if ...algo_name yields a "?" and + * only in that case use NUM. */ + const char *algo = + (openpgp_aead_test_algo (prefs->value) + ? num + : openpgp_aead_algo_name (prefs->value)); + if(!problem) + check_prefs_warning(pk); + log_info(_(" \"%s\": preference for AEAD" + " algorithm %s\n"), user, algo); + problem=1; + } + } else if(prefs->type==PREFTYPE_HASH) { if(openpgp_md_test_algo(prefs->value)) @@ -2255,6 +2273,7 @@ transfer_secret_keys (ctrl_t ctrl, struct import_stats_s *stats, { char countbuf[35]; + /* FIXME: Support AEAD */ /* Note that the IVLEN may be zero if we are working on a dummy key. We can't express that in an S-expression and thus we send dummy data for the IV. */ |