- size_t siglen = sizeof sig * 2;
-
- if(!meshlink_sign(mesh1, testdata1, sizeof testdata1, sig, &siglen)) {
- fprintf(stderr, "Signing failed\n");
- return 1;
- }
- if(siglen != MESHLINK_SIGLEN) {
- fprintf(stderr, "Signature has unexpected length %zu != %zu\n", siglen, MESHLINK_SIGLEN);
- return 1;
- }
-
- meshlink_node_t *foo = meshlink_get_node(mesh2, "foo");
- if(!foo) {
- fprintf(stderr, "Bar did not know about node foo\n");
- return 1;
- }
-
- meshlink_node_t *bar = meshlink_get_node(mesh2, "bar");
- if(!bar) {
- fprintf(stderr, "Bar did not know about node bar\n");
- return 1;
- }
-
- if(!meshlink_verify(mesh2, foo, testdata1, sizeof testdata1, sig, siglen)) {
- fprintf(stderr, "False negative verification\n");
- return 1;
- }
+ size_t siglen = sizeof(sig) * 2;
+
+ assert(meshlink_sign(mesh_a, testdata1, sizeof(testdata1), sig, &siglen));
+ assert(siglen == MESHLINK_SIGLEN);
+
+ meshlink_node_t *a = meshlink_get_node(mesh_b, "a");
+ assert(a);
+
+ meshlink_node_t *b = meshlink_get_node(mesh_b, "b");
+ assert(b);
+
+ assert(meshlink_verify(mesh_b, a, testdata1, sizeof(testdata1), sig, siglen));