+eax-%-test: eax-%-test.o eax-test.o %.o
+ $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
+
+eax-%-test.confirm: eax-%-test eax-%-test.vectors
+ ./$< <$(srcdir)/eax-$*-test.vectors >$@.new
+ mv -f $@.new $@
+
+msgcode-test: msgcode-test.o
+ $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
+
+msgcode-test.confirm: msgcode-test
+ ./msgcode-test
+ touch $@
+
+XDH_FUNCS = x25519 x448
+x25519_FIELD = f25519
+x448_FIELD = fgoldi
+XDH_FIELDS = $(foreach f,$(XDH_FUNCS),$($f_FIELD))
+
+$(addsuffix -test, $(XDH_FIELDS)): %-test: %-test.o %.o crypto-test.o
+ $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
+
+$(addsuffix -test.o, $(XDH_FIELDS)): %-test.o: ec-field-test.c
+ $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c \
+ -DFIELD=$* $< -o $@
+
+$(addsuffix -test, $(XDH_FUNCS)): %-test: %-test.o %.o crypto-test.o
+ $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
+x25519-test: f25519.o
+x448-test: fgoldi.o
+
+$(addsuffix -test.o, $(XDH_FUNCS)): %-test.o: xdh-test.c
+ $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -c \
+ -DXDH=$* -DFIELD=$($*_FIELD) \
+ $< -o $@
+
+$(addsuffix -test.confirm, $(XDH_FUNCS) $(XDH_FIELDS)): \
+ %-test.confirm: %-test %-tests.in
+ ./$*-test <$(srcdir)/$*-tests.in
+ touch $@
+
+ed25519-test: ed25519-test.o sha512.o f25519.o scaf.o ed25519.o crypto-test.o
+ $(CC) $(LDFLAGS) $(ALL_CFLAGS) -o $@ $^
+
+ed25519-test.confirm: ed25519-test ed25519-tests.in
+ ./ed25519-test <$(srcdir)/ed25519-tests.in
+ touch $@
+
+check-ipaddrset: ipaddrset-test.py ipaddrset.py ipaddrset-test.expected
+ $(srcdir)/ipaddrset-test.py >ipaddrset-test.new
+ diff -u $(srcdir)/ipaddrset-test.expected ipaddrset-test.new
+
+.PRECIOUS: eax-%-test
+