Commit 75d70433 authored by Mark Andrews's avatar Mark Andrews

Merge branch 'marka-fix-signature-test-v9_11' into 'v9_11'

Fix code to generate the test signatues.

See merge request !3106
parents 67451d55 4ecf3b89
Pipeline #34690 passed with stages
in 1 minute and 44 seconds
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <cmocka.h> #include <cmocka.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hex.h>
#include <isc/print.h> #include <isc/print.h>
#include <isc/stdio.h> #include <isc/stdio.h>
#include <isc/string.h> #include <isc/string.h>
...@@ -208,14 +209,50 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname, ...@@ -208,14 +209,50 @@ check_sig(const char *datapath, const char *sigpath, const char *keyname,
assert_int_equal(result, ISC_R_SUCCESS); assert_int_equal(result, ISC_R_SUCCESS);
result = dst_context_verify(ctx, &sigreg); result = dst_context_verify(ctx, &sigreg);
assert_true((expect && (result == ISC_R_SUCCESS)) || /*
(!expect && (result != ISC_R_SUCCESS))); * Compute the expected signature and emit it
* so the precomputed signature can be updated.
* This should only be done if the covered data
* is updated.
*/
if (expect && result != ISC_R_SUCCESS) {
isc_result_t result2;
dst_context_destroy(&ctx);
result2 = dst_context_create3(key, mctx,
DNS_LOGCATEGORY_GENERAL, false,
&ctx);
assert_int_equal(result2, ISC_R_SUCCESS);
result2 = dst_context_adddata(ctx, &datareg);
assert_int_equal(result2, ISC_R_SUCCESS);
char sigbuf2[4096];
isc_buffer_t sigb;
isc_buffer_init(&sigb, sigbuf2, sizeof(sigbuf2));
result2 = dst_context_sign(ctx, &sigb);
assert_int_equal(result2, ISC_R_SUCCESS);
isc_region_t r;
isc_buffer_usedregion(&sigb, &r);
char hexbuf[4096] = { 0 };
isc_buffer_t hb;
isc_buffer_init(&hb, hexbuf, sizeof(hexbuf));
isc_hex_totext(&r, 0, "", &hb);
fprintf(stderr, "# %s:\n# %s\n", sigpath, hexbuf);
}
isc_mem_put(mctx, data, size + 1); isc_mem_put(mctx, data, size + 1);
dst_context_destroy(&ctx); dst_context_destroy(&ctx);
dst_key_free(&key); dst_key_free(&key);
assert_true((expect && (result == ISC_R_SUCCESS)) ||
(!expect && (result != ISC_R_SUCCESS)));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment