Bug 3466 - Prefer using AEAD algorithms
Summary: Prefer using AEAD algorithms
Status: CLOSED WONTFIX
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sshd (show other bugs)
Version: 8.7p1
Hardware: All All
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-02 01:13 AEST by tim
Modified: 2022-10-04 21:58 AEDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2022-08-02 01:13:38 AEST
Prefer using 256-bit AEAD algorithms (CHACHA20_POLY1305, AES_256_GCM, AES_128_GCM), if possible, remove non-AEAD algorithms in the future. 
By the way, although AES_128_GCM key is shorter than AES_256_CTR, but it's AEAD, which is one of cipher supported in TLS 1.3, so prefer it rather than AES_256_CTR.
Comment 1 tim 2022-08-02 01:21:44 AEST
(In reply to tim from comment #0)
> Prefer using 256-bit AEAD algorithms (CHACHA20_POLY1305,
> AES_256_GCM, AES_128_GCM), if possible, remove non-AEAD algorithms
> in the future. 
> By the way, although AES_128_GCM key is shorter than AES_256_CTR,
> but it's AEAD, which is one of cipher supported in TLS 1.3, so
> prefer it rather than AES_256_CTR.
Comment 2 Damien Miller 2022-09-16 13:42:48 AEST
Why?

We do currently preference an AEAD cipher (chacha20-poly1305@openssh.com), but AES-GCM can be slower than AES-CTR.

There are no known weaknesses in using CTR+MAC in the SSH protocol (cf. https://himsen.github.io/pdf/thesis.pdf)
Comment 3 tim 2022-09-23 13:29:24 AEST
Because some proxy provider, such as Psiphon, using AES_CTR_XXX_hmac-sha1 or AES_CTR_XXX_hmac-sha1-96, SHA_1 is weak. 
I think prefer using AEAD is a "defense in depth", because TLS 1.3 and Wireguard onld support AEAD, they are modern and widely used.
Comment 4 tim 2022-09-23 13:40:03 AEST
I do a test in OpenSSL, but it's in a Rocky Linux VM:

openssl speed -evp aes-256-gcm
Doing AES-256-GCM for 3s on 16 size blocks: 13327934 AES-256-GCM's in 2.94s
Doing AES-256-GCM for 3s on 64 size blocks: 4010515 AES-256-GCM's in 2.96s
Doing AES-256-GCM for 3s on 256 size blocks: 3382265 AES-256-GCM's in 2.97s
Doing AES-256-GCM for 3s on 1024 size blocks: 942484 AES-256-GCM's in 2.96s
Doing AES-256-GCM for 3s on 8192 size blocks: 122282 AES-256-GCM's in 2.97s
Doing AES-256-GCM for 3s on 16384 size blocks: 61389 AES-256-GCM's in 2.98s
version: 3.0.1
built on: Thu Aug 11 00:00:00 2022 UTC

openssl speed -evp aes-256-ctr
Doing AES-256-CTR for 3s on 16 size blocks: 15322101 AES-256-CTR's in 2.94s
Doing AES-256-CTR for 3s on 64 size blocks: 4208151 AES-256-CTR's in 2.96s
Doing AES-256-CTR for 3s on 256 size blocks: 3635130 AES-256-CTR's in 2.98s
Doing AES-256-CTR for 3s on 1024 size blocks: 986443 AES-256-CTR's in 2.95s
Doing AES-256-CTR for 3s on 8192 size blocks: 127640 AES-256-CTR's in 2.96s
Doing AES-256-CTR for 3s on 16384 size blocks: 57412 AES-256-CTR's in 2.86s
version: 3.0.1
built on: Thu Aug 11 00:00:00 2022 UTC

AES_CGM doesn't much slower than AES_CTR
Comment 5 Damien Miller 2022-09-24 11:48:52 AEST
The collision weaknesses in SHA-1 are irrelevant for its use in HMAC and HMAC-SHA1 is not at all broken.

I don't see any benefits to promoting AES-GCM to the front on the list. If new cryptanalysis that changes this, then we'll consider changing the ordering.
Comment 6 Darren Tucker 2022-09-25 17:32:17 AEST
(In reply to tim from comment #4)
> AES_CGM doesn't much slower than AES_CTR

This varies a lot depending on the platform.  For a counterexample (Ryzen 3900X), GCM is  half the speed:

$ openssl speed -evp aes-256-gcm
Doing AES-256-GCM for 3s on 16 size blocks: 103804564 AES-256-GCM's in 2.99s
Doing AES-256-GCM for 3s on 64 size blocks: 58949992 AES-256-GCM's in 2.99s
Doing AES-256-GCM for 3s on 256 size blocks: 34661021 AES-256-GCM's in 3.00s
Doing AES-256-GCM for 3s on 1024 size blocks: 11774310 AES-256-GCM's in 2.99s
Doing AES-256-GCM for 3s on 8192 size blocks: 1690281 AES-256-GCM's in 2.99s
Doing AES-256-GCM for 3s on 16384 size blocks: 853186 AES-256-GCM's in 3.00s

$ openssl speed -evp aes-256-ctr
Doing AES-256-CTR for 3s on 16 size blocks: 167022187 AES-256-CTR's in 2.99s
Doing AES-256-CTR for 3s on 64 size blocks: 131872734 AES-256-CTR's in 3.00s
Doing AES-256-CTR for 3s on 256 size blocks: 70440642 AES-256-CTR's in 2.99s
Doing AES-256-CTR for 3s on 1024 size blocks: 23978238 AES-256-CTR's in 3.00s
Doing AES-256-CTR for 3s on 8192 size blocks: 3358652 AES-256-CTR's in 2.99s
Doing AES-256-CTR for 3s on 16384 size blocks: 1703078 AES-256-CTR's in 3.00s
Comment 7 Damien Miller 2022-10-04 21:58:53 AEDT
Closing bugs from openssh-9.1 release cycle