Skip to content

Commit 3f8bd17

Browse files
committed
unit-test/test_keystore: fix C lints
``` /bitbox02-firmware/test/unit-test/test_keystore.c:229:22: error: 4th argument 'host_nonce_commitment' (passed to 'host_commitment') looks like it might be swapped with the 5th, 'commitment' (passed to 'client_commitment_out') [readability-suspicious-call-argument,-warnings-as-errors] assert_false(keys ```
1 parent ce8f04b commit 3f8bd17

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/unit-test/test_keystore.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,24 +219,32 @@ static void _test_keystore_secp256k1_nonce_commit(void** state)
219219
{
220220
uint8_t msg[32] = {0};
221221
memset(msg, 0x88, sizeof(msg));
222-
uint8_t commitment[EC_PUBLIC_KEY_LEN] = {0};
223-
uint8_t host_nonce_commitment[32] = {0};
224-
memset(host_nonce_commitment, 0xAB, sizeof(host_nonce_commitment));
222+
uint8_t client_commitment[EC_PUBLIC_KEY_LEN] = {0};
223+
uint8_t host_commitment[32] = {0};
224+
memset(host_commitment, 0xAB, sizeof(host_commitment));
225225

226226
{
227227
keystore_mock_unlocked(NULL, 0, NULL);
228228
// fails because keystore is locked
229229
assert_false(keystore_secp256k1_nonce_commit(
230-
_keypath, sizeof(_keypath) / sizeof(uint32_t), msg, host_nonce_commitment, commitment));
230+
_keypath,
231+
sizeof(_keypath) / sizeof(uint32_t),
232+
msg,
233+
host_commitment,
234+
client_commitment));
231235
}
232236
{
233237
keystore_mock_unlocked(_mock_seed, sizeof(_mock_seed), _mock_bip39_seed);
234238
assert_true(keystore_secp256k1_nonce_commit(
235-
_keypath, sizeof(_keypath) / sizeof(uint32_t), msg, host_nonce_commitment, commitment));
239+
_keypath,
240+
sizeof(_keypath) / sizeof(uint32_t),
241+
msg,
242+
host_commitment,
243+
client_commitment));
236244
const uint8_t expected_commitment[EC_PUBLIC_KEY_LEN] =
237245
"\x02\xfd\xcf\x79\xf9\xc0\x3f\x6a\xcc\xc6\x56\x95\xa1\x90\x82\xe3\x0b\xfb\x9e\xdc\x93"
238246
"\x04\x5a\x03\x05\x8a\x99\x09\xe4\x9b\x1a\x37\x7b";
239-
assert_memory_equal(expected_commitment, commitment, sizeof(commitment));
247+
assert_memory_equal(expected_commitment, client_commitment, sizeof(client_commitment));
240248
}
241249
}
242250

0 commit comments

Comments
 (0)