1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/crypto
Simon Tatham c1a2114b28 Implement AES-GCM using the @openssh.com protocol IDs.
I only recently found out that OpenSSH defined their own protocol IDs
for AES-GCM, defined to work the same as the standard ones except that
they fixed the semantics for how you select the linked cipher+MAC pair
during key exchange.

(RFC 5647 defines protocol ids for AES-GCM in both the cipher and MAC
namespaces, and requires that you MUST select both or neither - but
this contradicts the selection policy set out in the base SSH RFCs,
and there's no discussion of how you resolve a conflict between them!
OpenSSH's answer is to do it the same way ChaCha20-Poly1305 works,
because that will ensure the two suites don't fight.)

People do occasionally ask us for this linked cipher/MAC pair, and now
I know it's actually feasible, I've implemented it, including a pair
of vector implementations for x86 and Arm using their respective
architecture extensions for multiplying polynomials over GF(2).

Unlike ChaCha20-Poly1305, I've kept the cipher and MAC implementations
in separate objects, with an arm's-length link between them that the
MAC uses when it needs to encrypt single cipher blocks to use as the
inputs to the MAC algorithm. That enables the cipher and the MAC to be
independently selected from their hardware-accelerated versions, just
in case someone runs on a system that has polynomial multiplication
instructions but not AES acceleration, or vice versa.

There's a fourth implementation of the GCM MAC, which is a pure
software implementation of the same algorithm used in the vectorised
versions. It's too slow to use live, but I've kept it in the code for
future testing needs, and because it's a convenient place to dump my
design comments.

The vectorised implementations are fairly crude as far as optimisation
goes. I'm sure serious x86 _or_ Arm optimisation engineers would look
at them and laugh. But GCM is a fast MAC compared to HMAC-SHA-256
(indeed compared to HMAC-anything-at-all), so it should at least be
good enough to use. And we've got a working version with some tests
now, so if someone else wants to improve them, they can.
2022-08-16 20:33:58 +01:00
..
aes-common.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aes-neon.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aes-ni.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aes-select.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aes-sw.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aes.h Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-clmul.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-common.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-footer.h Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-neon.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-ref-poly.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-select.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm-sw.c Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
aesgcm.h Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
arcfour.c Add 'next_message' methods to cipher and MAC vtables. 2022-08-16 18:27:06 +01:00
argon2.c Fix a batch of typos in comments and docs. 2022-01-03 06:40:51 +00:00
bcrypt.c Expose openssh_bcrypt() to testcrypt, and test it. 2021-12-24 10:13:28 +00:00
blake2.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
blowfish.c Add 'next_message' methods to cipher and MAC vtables. 2022-08-16 18:27:06 +01:00
blowfish.h Update source file names in comments and docs. 2022-01-22 15:51:31 +00:00
chacha20-poly1305.c Add 'next_message' methods to cipher and MAC vtables. 2022-08-16 18:27:06 +01:00
CMakeLists.txt Implement AES-GCM using the @openssh.com protocol IDs. 2022-08-16 20:33:58 +01:00
crc32.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
des.c Add 'next_message' methods to cipher and MAC vtables. 2022-08-16 18:27:06 +01:00
diffie-hellman.c Use C99 named initialisers in all ssh_kex instances. 2022-04-15 17:46:06 +01:00
dsa.c Formatting: realign run-on parenthesised stuff. 2022-08-03 20:48:46 +01:00
ecc-arithmetic.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
ecc-ssh.c Formatting: realign run-on parenthesised stuff. 2022-08-03 20:48:46 +01:00
ecc.h testcrypt: adjust some function parameter names. 2021-11-21 22:19:01 +00:00
hash_simple.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
hmac.c Add 'next_message' methods to cipher and MAC vtables. 2022-08-16 18:27:06 +01:00
mac_simple.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
mac.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
md5.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
mpint_i.h Update source file names in comments and docs. 2022-01-22 15:51:31 +00:00
mpint.c Utility function mp_resize. 2022-04-15 17:46:06 +01:00
ntru.c Formatting: realign run-on parenthesised stuff. 2022-08-03 20:48:46 +01:00
ntru.h Implement OpenSSH 9.x's NTRU Prime / Curve25519 kex. 2022-04-15 17:46:06 +01:00
openssh-certs.c Certificate-aware handling of key fingerprints. 2022-08-05 18:08:59 +01:00
prng.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
pubkey-pem.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
pubkey-ppk.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
pubkey-ssh1.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
rsa.c Pageant core: separate public and private key storage. 2022-08-06 11:34:36 +01:00
sha1-common.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha1-neon.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha1-ni.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha1-select.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha1-sw.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha1.h Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha3.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00
sha256-common.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha256-neon.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha256-ni.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha256-select.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha256-sw.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha256.h Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha512-common.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha512-neon.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha512-select.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha512-sw.c Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
sha512.h Break up crypto modules containing HW acceleration. 2021-04-21 21:55:26 +01:00
xdmauth.c Move crypto into its own subdirectory. 2021-04-21 21:55:26 +01:00