git: 832c8a58e1f7 - main - if_ovpn tests: add aes-128-gcm test case

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 10:18:11 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=832c8a58e1f748a1e47b49fa510bfc52097268ed

commit 832c8a58e1f748a1e47b49fa510bfc52097268ed
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-11-11 09:42:02 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-11-11 10:17:39 +0000

    if_ovpn tests: add aes-128-gcm test case
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/net/if_ovpn/if_ovpn.sh | 50 +++++++++++++++++++++++++++++++---------
 1 file changed, 39 insertions(+), 11 deletions(-)

diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh
index 8953e7122a57..51d21b826e72 100644
--- a/tests/sys/net/if_ovpn/if_ovpn.sh
+++ b/tests/sys/net/if_ovpn/if_ovpn.sh
@@ -915,17 +915,10 @@ ra_cleanup()
 	ovpn_cleanup
 }
 
-
-atf_test_case "chacha" "cleanup"
-chacha_head()
+ovpn_algo_body()
 {
-	atf_set descr 'Test DCO with the chacha algorithm'
-	atf_set require.user root
-	atf_set require.progs openvpn
-}
+	algo=$1
 
-chacha_body()
-{
 	ovpn_init
 
 	l=$(vnet_mkepair)
@@ -943,8 +936,8 @@ chacha_body()
 		dev-type tun
 		proto udp4
 
-		cipher CHACHA20-POLY1305
-		data-ciphers CHACHA20-POLY1305
+		cipher ${algo}
+		data-ciphers ${algo}
 		auth SHA256
 
 		local 192.0.2.1
@@ -967,6 +960,9 @@ chacha_body()
 
 		client
 
+		cipher ${algo}
+		data-ciphers ${algo}
+
 		remote 192.0.2.1
 		auth-user-pass $(atf_get_srcdir)/user.pass
 
@@ -984,11 +980,42 @@ chacha_body()
 	atf_check -s exit:0 -o ignore jexec b ping -c 3 198.51.100.1
 }
 
+atf_test_case "chacha" "cleanup"
+chacha_head()
+{
+	atf_set descr 'Test DCO with the chacha algorithm'
+	atf_set require.user root
+	atf_set require.progs openvpn
+}
+
+chacha_body()
+{
+	ovpn_algo_body CHACHA20-POLY1305
+}
+
 chacha_cleanup()
 {
 	ovpn_cleanup
 }
 
+atf_test_case "gcm_128" "cleanup"
+gcm_128_head()
+{
+	atf_set descr 'Test DCO with AES-128-GCM'
+	atf_set require.user root
+	atf_set require.progs openvpn
+}
+
+gcm_128_body()
+{
+	ovpn_algo_body AES-128-GCM
+}
+
+gcm_128_cleanup()
+{
+	ovpn_cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "4in4"
@@ -1002,4 +1029,5 @@ atf_init_test_cases()
 	atf_add_test_case "route_to"
 	atf_add_test_case "ra"
 	atf_add_test_case "chacha"
+	atf_add_test_case "gcm_128"
 }