mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-31 09:32:55 +00:00
Fix magic numbers in more J-PAKE tests
In the ecjpake_do_round(), fix a magic number that was causing buffer size to be incorrectly advertised. Followup of 'Fix magic number buffer length in J-PAKE tests' for what seem to be duplicate tests. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
6076fe486b
commit
433a58c170
@ -740,37 +740,37 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
/* Server first round Output */
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_g1_len));
|
||||
buffer_length - buffer0_off, &s_g1_len));
|
||||
TEST_EQUAL(s_g1_len, expected_size_key_share);
|
||||
s_g1_off = buffer0_off;
|
||||
buffer0_off += s_g1_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x1_pk_len));
|
||||
buffer_length - buffer0_off, &s_x1_pk_len));
|
||||
TEST_EQUAL(s_x1_pk_len, expected_size_zk_public);
|
||||
s_x1_pk_off = buffer0_off;
|
||||
buffer0_off += s_x1_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x1_pr_len));
|
||||
buffer_length - buffer0_off, &s_x1_pr_len));
|
||||
TEST_LE_U(s_x1_pr_len, max_expected_size_zk_proof);
|
||||
s_x1_pr_off = buffer0_off;
|
||||
buffer0_off += s_x1_pr_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_g2_len));
|
||||
buffer_length - buffer0_off, &s_g2_len));
|
||||
TEST_EQUAL(s_g2_len, expected_size_key_share);
|
||||
s_g2_off = buffer0_off;
|
||||
buffer0_off += s_g2_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2_pk_len));
|
||||
buffer_length - buffer0_off, &s_x2_pk_len));
|
||||
TEST_EQUAL(s_x2_pk_len, expected_size_zk_public);
|
||||
s_x2_pk_off = buffer0_off;
|
||||
buffer0_off += s_x2_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2_pr_len));
|
||||
buffer_length - buffer0_off, &s_x2_pr_len));
|
||||
TEST_LE_U(s_x2_pr_len, max_expected_size_zk_proof);
|
||||
s_x2_pr_off = buffer0_off;
|
||||
buffer0_off += s_x2_pr_len;
|
||||
@ -860,37 +860,37 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
/* Client first round Output */
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_g1_len));
|
||||
buffer_length - buffer1_off, &c_g1_len));
|
||||
TEST_EQUAL(c_g1_len, expected_size_key_share);
|
||||
c_g1_off = buffer1_off;
|
||||
buffer1_off += c_g1_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x1_pk_len));
|
||||
buffer_length - buffer1_off, &c_x1_pk_len));
|
||||
TEST_EQUAL(c_x1_pk_len, expected_size_zk_public);
|
||||
c_x1_pk_off = buffer1_off;
|
||||
buffer1_off += c_x1_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x1_pr_len));
|
||||
buffer_length - buffer1_off, &c_x1_pr_len));
|
||||
TEST_LE_U(c_x1_pr_len, max_expected_size_zk_proof);
|
||||
c_x1_pr_off = buffer1_off;
|
||||
buffer1_off += c_x1_pr_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_g2_len));
|
||||
buffer_length - buffer1_off, &c_g2_len));
|
||||
TEST_EQUAL(c_g2_len, expected_size_key_share);
|
||||
c_g2_off = buffer1_off;
|
||||
buffer1_off += c_g2_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2_pk_len));
|
||||
buffer_length - buffer1_off, &c_x2_pk_len));
|
||||
TEST_EQUAL(c_x2_pk_len, expected_size_zk_public);
|
||||
c_x2_pk_off = buffer1_off;
|
||||
buffer1_off += c_x2_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2_pr_len));
|
||||
buffer_length - buffer1_off, &c_x2_pr_len));
|
||||
TEST_LE_U(c_x2_pr_len, max_expected_size_zk_proof);
|
||||
c_x2_pr_off = buffer1_off;
|
||||
buffer1_off += c_x2_pr_len;
|
||||
@ -1038,19 +1038,19 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_a_len));
|
||||
buffer_length - buffer0_off, &s_a_len));
|
||||
TEST_EQUAL(s_a_len, expected_size_key_share);
|
||||
s_a_off = buffer0_off;
|
||||
buffer0_off += s_a_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2s_pk_len));
|
||||
buffer_length - buffer0_off, &s_x2s_pk_len));
|
||||
TEST_EQUAL(s_x2s_pk_len, expected_size_zk_public);
|
||||
s_x2s_pk_off = buffer0_off;
|
||||
buffer0_off += s_x2s_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2s_pr_len));
|
||||
buffer_length - buffer0_off, &s_x2s_pr_len));
|
||||
TEST_LE_U(s_x2s_pr_len, max_expected_size_zk_proof);
|
||||
s_x2s_pr_off = buffer0_off;
|
||||
buffer0_off += s_x2s_pr_len;
|
||||
@ -1103,19 +1103,19 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_a_len));
|
||||
buffer_length - buffer1_off, &c_a_len));
|
||||
TEST_EQUAL(c_a_len, expected_size_key_share);
|
||||
c_a_off = buffer1_off;
|
||||
buffer1_off += c_a_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2s_pk_len));
|
||||
buffer_length - buffer1_off, &c_x2s_pk_len));
|
||||
TEST_EQUAL(c_x2s_pk_len, expected_size_zk_public);
|
||||
c_x2s_pk_off = buffer1_off;
|
||||
buffer1_off += c_x2s_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2s_pr_len));
|
||||
buffer_length - buffer1_off, &c_x2s_pr_len));
|
||||
TEST_LE_U(c_x2s_pr_len, max_expected_size_zk_proof);
|
||||
c_x2s_pr_off = buffer1_off;
|
||||
buffer1_off += c_x2s_pr_len;
|
||||
|
@ -57,7 +57,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
/* Server first round Output */
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_g1_len));
|
||||
buffer_length - buffer0_off, &s_g1_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_g1_len, expected_size_key_share);
|
||||
@ -65,7 +65,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_g1_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x1_pk_len));
|
||||
buffer_length - buffer0_off, &s_x1_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_x1_pk_len, expected_size_zk_public);
|
||||
@ -73,7 +73,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_x1_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x1_pr_len));
|
||||
buffer_length - buffer0_off, &s_x1_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(s_x1_pr_len, max_expected_size_zk_proof);
|
||||
@ -81,7 +81,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_x1_pr_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_g2_len));
|
||||
buffer_length - buffer0_off, &s_g2_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_g2_len, expected_size_key_share);
|
||||
@ -89,7 +89,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_g2_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2_pk_len));
|
||||
buffer_length - buffer0_off, &s_x2_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_x2_pk_len, expected_size_zk_public);
|
||||
@ -97,7 +97,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_x2_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2_pr_len));
|
||||
buffer_length - buffer0_off, &s_x2_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(s_x2_pr_len, max_expected_size_zk_proof);
|
||||
@ -154,7 +154,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
/* Client first round Output */
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_g1_len));
|
||||
buffer_length - buffer1_off, &c_g1_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_g1_len, expected_size_key_share);
|
||||
@ -162,7 +162,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_g1_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x1_pk_len));
|
||||
buffer_length - buffer1_off, &c_x1_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_x1_pk_len, expected_size_zk_public);
|
||||
@ -170,7 +170,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_x1_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x1_pr_len));
|
||||
buffer_length - buffer1_off, &c_x1_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(c_x1_pr_len, max_expected_size_zk_proof);
|
||||
@ -178,7 +178,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_x1_pr_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_g2_len));
|
||||
buffer_length - buffer1_off, &c_g2_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_g2_len, expected_size_key_share);
|
||||
@ -186,7 +186,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_g2_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2_pk_len));
|
||||
buffer_length - buffer1_off, &c_x2_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_x2_pk_len, expected_size_zk_public);
|
||||
@ -194,7 +194,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_x2_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2_pr_len));
|
||||
buffer_length - buffer1_off, &c_x2_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(c_x2_pr_len, max_expected_size_zk_proof);
|
||||
@ -290,7 +290,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_a_len));
|
||||
buffer_length - buffer0_off, &s_a_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_a_len, expected_size_key_share);
|
||||
@ -298,7 +298,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_a_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2s_pk_len));
|
||||
buffer_length - buffer0_off, &s_x2s_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(s_x2s_pk_len, expected_size_zk_public);
|
||||
@ -306,7 +306,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer0_off += s_x2s_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(server, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer0 + buffer0_off,
|
||||
512 - buffer0_off, &s_x2s_pr_len));
|
||||
buffer_length - buffer0_off, &s_x2s_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(s_x2s_pr_len, max_expected_size_zk_proof);
|
||||
@ -341,7 +341,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_KEY_SHARE,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_a_len));
|
||||
buffer_length - buffer1_off, &c_a_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_a_len, expected_size_key_share);
|
||||
@ -349,7 +349,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_a_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PUBLIC,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2s_pk_len));
|
||||
buffer_length - buffer1_off, &c_x2s_pk_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_EQUAL(c_x2s_pk_len, expected_size_zk_public);
|
||||
@ -357,7 +357,7 @@ static void ecjpake_do_round(psa_algorithm_t alg, unsigned int primitive,
|
||||
buffer1_off += c_x2s_pk_len;
|
||||
PSA_ASSERT(psa_pake_output(client, PSA_PAKE_STEP_ZK_PROOF,
|
||||
buffer1 + buffer1_off,
|
||||
512 - buffer1_off, &c_x2s_pr_len));
|
||||
buffer_length - buffer1_off, &c_x2s_pr_len));
|
||||
TEST_EQUAL(mbedtls_test_driver_pake_hooks.hits.total,
|
||||
pake_in_driver ? pake_expected_hit_count++ : pake_expected_hit_count);
|
||||
TEST_LE_U(c_x2s_pr_len, max_expected_size_zk_proof);
|
||||
|
Loading…
x
Reference in New Issue
Block a user