3 """Check that legacy protocol works with different cryptographic algorithms."""
7 from testlib.test import Test
8 from testlib.proc import Tinc
9 from testlib.log import log
10 from testlib import cmd, check
13 def init(ctx: Test, digest: str, cipher: str) -> T.Tuple[Tinc, Tinc]:
14 """Initialize new test nodes."""
15 foo, bar = ctx.node(), ctx.node()
22 set ExperimentalProtocol no
26 foo.cmd("--force", stdin=stdin)
34 set ExperimentalProtocol no
38 bar.cmd("--force", stdin=stdin)
40 foo.add_script(bar.script_up)
41 bar.add_script(foo.script_up)
43 cmd.exchange(foo, bar)
44 bar.cmd("add", "ConnectTo", foo.name)
50 def test(foo: Tinc, bar: Tinc) -> None:
51 """Run tests on algorithm pair."""
52 log.info("waiting for bar to come up")
53 foo[bar.script_up].wait()
55 log.info("waiting for foo to come up")
56 bar[foo.script_up].wait()
58 log.info("checking node reachability")
59 stdout, _ = foo.cmd("info", bar.name)
60 check.is_in("reachable", stdout)
63 for alg_digest in "none", "sha256", "sha512":
64 for alg_cipher in "none", "aes-256-cbc":
65 with Test("compression") as context:
66 node0, node1 = init(context, alg_digest, alg_cipher)