aboutsummaryrefslogtreecommitdiff
path: root/src/kex.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-10-08 13:24:49 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-09 12:05:40 +0200
commit46090facbae8c8292d2775546082ccbd5e56fbd1 (patch)
tree3e6875a6e353d9d496972f0756f220446f082db2 /src/kex.c
parent777786d76c83b017ce6936bd15aa3413fd65bcca (diff)
downloadlibssh-46090facbae8c8292d2775546082ccbd5e56fbd1.tar.gz
libssh-46090facbae8c8292d2775546082ccbd5e56fbd1.tar.xz
libssh-46090facbae8c8292d2775546082ccbd5e56fbd1.zip
libcrypto: Implement OpenSSH-compatible AES-GCM ciphers using OpenSSL
The commit also propares the internals throughout the code base for the inclusion of a new AEAD cipher, because previously, the source code counted only with chacha20-poly1305 cipher, which is very specific in many cases. The SSH_HMAC_AEAD_GCM mac algorithm is not actually used, but the name needed to be defined so we can match in the algorithms selection per OpenSSH specification (MACs are ignored in case GCM is select as a cipher [1]). If the provided OpenSSL does not provide EVP_aes_128_gcm() function, the AES-GCM ciphers will not be compiled in. [1] https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.chacha20poly1305?annotate=HEAD Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/kex.c')
-rw-r--r--src/kex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kex.c b/src/kex.c
index a59374c5..e0fd5680 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -59,10 +59,15 @@
# endif /* HAVE_OPENSSL_BLOWFISH_H */
# ifdef HAVE_OPENSSL_AES_H
+# ifdef HAVE_OPENSSL_EVP_AES_GCM
+# define GCM "aes256-gcm@openssh.com,aes128-gcm@openssh.com,"
+# else
+# define GCM ""
+# endif /* HAVE_OPENSSL_EVP_AES_GCM */
# ifdef BROKEN_AES_CTR
-# define AES "aes256-cbc,aes192-cbc,aes128-cbc,"
+# define AES GCM "aes256-cbc,aes192-cbc,aes128-cbc,"
# else /* BROKEN_AES_CTR */
-# define AES "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,"
+# define AES GCM "aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,"
# endif /* BROKEN_AES_CTR */
# else /* HAVE_OPENSSL_AES_H */
# define AES ""