diff options
author | Micah Elizabeth Scott <beth@torproject.org> | 2023-03-15 12:31:50 -0700 |
---|---|---|
committer | Micah Elizabeth Scott <beth@torproject.org> | 2023-05-10 07:38:28 -0700 |
commit | 2de98a7f4ea86c234990747fb566e70fef6aee15 (patch) | |
tree | 56959c6ff781edfe7d88b52fa2dffe60689817b4 /src/test | |
parent | 287c78c5a82f0447af01f3558748f048c9f3d2b2 (diff) | |
download | tor-2de98a7f4ea86c234990747fb566e70fef6aee15.tar.gz tor-2de98a7f4ea86c234990747fb566e70fef6aee15.zip |
hs_pow: Represent equix_solution as a byte array
This patch is intended to clarify the points at which we convert
between the internal representation of an equix_solution and a portable
but opaque byte array representation.
Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test_hs_pow.c | 9 | ||||
-rw-r--r-- | src/test/test_hs_pow_slow.c | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/test/test_hs_pow.c b/src/test/test_hs_pow.c index edda3cd643..ca470e2b5d 100644 --- a/src/test/test_hs_pow.c +++ b/src/test/test_hs_pow.c @@ -374,12 +374,11 @@ test_hs_pow_vectors(void *arg) tt_int_op(base16_decode((char*)pow_state->seed_previous, HS_POW_SEED_LEN, seed_hex, 2 * HS_POW_SEED_LEN), OP_EQ, HS_POW_SEED_LEN); - tt_int_op(base16_decode((char*)&solution.nonce, sizeof solution.nonce, - nonce_hex, 2 * sizeof solution.nonce), + tt_int_op(base16_decode((char*)solution.nonce, HS_POW_NONCE_LEN, + nonce_hex, 2 * HS_POW_NONCE_LEN), OP_EQ, HS_POW_NONCE_LEN); - tt_int_op(base16_decode((char*)&solution.equix_solution, - sizeof solution.equix_solution, - sol_hex, 2 * sizeof solution.equix_solution), + tt_int_op(base16_decode((char*)solution.equix_solution, HS_POW_EQX_SOL_LEN, + sol_hex, 2 * HS_POW_EQX_SOL_LEN), OP_EQ, HS_POW_EQX_SOL_LEN); memcpy(solution.seed_head, pow_state->seed_previous, HS_POW_SEED_HEAD_LEN); diff --git a/src/test/test_hs_pow_slow.c b/src/test/test_hs_pow_slow.c index 13d7111e88..690ce0cf78 100644 --- a/src/test/test_hs_pow_slow.c +++ b/src/test/test_hs_pow_slow.c @@ -46,9 +46,9 @@ testing_one_hs_pow_solution(const hs_pow_solution_t *ref_solution, expected = 0; } } else if (variant & 1) { - sol_buffer.nonce[variant % HS_POW_NONCE_LEN]++; + sol_buffer.nonce[variant / 2 % HS_POW_NONCE_LEN]++; } else { - sol_buffer.equix_solution.idx[variant % EQUIX_NUM_IDX]++; + sol_buffer.equix_solution[variant / 2 % HS_POW_EQX_SOL_LEN]++; } tt_int_op(expected, OP_EQ, hs_pow_verify(s, &sol_buffer)); |