Commit b0dc773
committed
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which obviates the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
Signed-off-by: Steffan Karger <steffan@karger.me>1 parent 03c325b commit b0dc773
File tree
11 files changed
+810
-102
lines changed- src/openvpn
11 files changed
+810
-102
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
| |||
828 | 835 | | |
829 | 836 | | |
830 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
831 | 845 | | |
832 | 846 | | |
833 | 847 | | |
| |||
857 | 871 | | |
858 | 872 | | |
859 | 873 | | |
860 | | - | |
861 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
862 | 878 | | |
863 | 879 | | |
864 | 880 | | |
| |||
887 | 903 | | |
888 | 904 | | |
889 | 905 | | |
890 | | - | |
891 | 906 | | |
892 | 907 | | |
893 | 908 | | |
| |||
904 | 919 | | |
905 | 920 | | |
906 | 921 | | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
907 | 933 | | |
908 | 934 | | |
909 | 935 | | |
| |||
1072 | 1098 | | |
1073 | 1099 | | |
1074 | 1100 | | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1075 | 1105 | | |
1076 | 1106 | | |
1077 | 1107 | | |
| |||
0 commit comments