Skip to content

Commit ecb4420

Browse files
committed
Address missed instances of sizeof
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
1 parent 1868870 commit ecb4420

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

library/ecp_curves.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ static int ecp_mod_p255(mbedtls_mpi *N)
12521252
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
12531253
}
12541254
M.p = Mp;
1255-
memset(Mp, 0, sizeof Mp);
1255+
memset(Mp, 0, sizeof(Mp));
12561256
memcpy(Mp, N->p + P255_WIDTH - 1, M.n * sizeof(mbedtls_mpi_uint));
12571257
MBEDTLS_MPI_CHK(mbedtls_mpi_shift_r(&M, 255 % (8 * sizeof(mbedtls_mpi_uint))));
12581258
M.n++; /* Make room for multiplication by 19 */

tests/suites/test_suite_mdx.function

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ void md2_text(char *text_src_string, data_t *hash)
1212
unsigned char src_str[100];
1313
unsigned char output[16];
1414

15-
memset(src_str, 0x00, sizeof src_str);
16-
memset(output, 0x00, sizeof output);
15+
memset(src_str, 0x00, sizeof(src_str));
16+
memset(output, 0x00, sizeof(output));
1717

1818
strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
1919

2020
ret = mbedtls_md2_ret(src_str, strlen((char *) src_str), output);
2121
TEST_ASSERT(ret == 0);
2222

2323
TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
24-
sizeof output, hash->len) == 0);
24+
sizeof(output), hash->len) == 0);
2525
}
2626
/* END_CASE */
2727

@@ -32,16 +32,16 @@ void md4_text(char *text_src_string, data_t *hash)
3232
unsigned char src_str[100];
3333
unsigned char output[16];
3434

35-
memset(src_str, 0x00, sizeof src_str);
36-
memset(output, 0x00, sizeof output);
35+
memset(src_str, 0x00, sizeof(src_str));
36+
memset(output, 0x00, sizeof(output));
3737

3838
strncpy((char *) src_str, text_src_string, sizeof(src_str) - 1);
3939

4040
ret = mbedtls_md4_ret(src_str, strlen((char *) src_str), output);
4141
TEST_ASSERT(ret == 0);
4242

4343
TEST_ASSERT(mbedtls_test_hexcmp(output, hash->x,
44-
sizeof output, hash->len) == 0);
44+
sizeof(output), hash->len) == 0);
4545
}
4646
/* END_CASE */
4747

0 commit comments

Comments
 (0)