mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-03-14 14:56:05 -06:00
test/qtest/hace: Specify explicit array sizes for test vectors and hash results
To enhance code readability and prevent potential buffer overflows or unintended size assumptions, this commit updates all fixed-size array declarations to use explicit array sizes. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Acked-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/qemu-devel/20250515081008.583578-20-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
70985b0ea7
commit
33627ab237
1 changed files with 13 additions and 13 deletions
|
|
@ -19,9 +19,9 @@
|
|||
* for hash in sha512sum sha256sum md5sum; do $hash /tmp/test; done
|
||||
*
|
||||
*/
|
||||
static const uint8_t test_vector[] = {0x61, 0x62, 0x63};
|
||||
static const uint8_t test_vector[3] = {0x61, 0x62, 0x63};
|
||||
|
||||
static const uint8_t test_result_sha512[] = {
|
||||
static const uint8_t test_result_sha512[64] = {
|
||||
0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49,
|
||||
0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
|
||||
0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a,
|
||||
|
|
@ -29,12 +29,12 @@ static const uint8_t test_result_sha512[] = {
|
|||
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f,
|
||||
0xa5, 0x4c, 0xa4, 0x9f};
|
||||
|
||||
static const uint8_t test_result_sha256[] = {
|
||||
static const uint8_t test_result_sha256[32] = {
|
||||
0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde,
|
||||
0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
|
||||
0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad};
|
||||
|
||||
static const uint8_t test_result_md5[] = {
|
||||
static const uint8_t test_result_md5[16] = {
|
||||
0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0, 0xd6, 0x96, 0x3f, 0x7d,
|
||||
0x28, 0xe1, 0x7f, 0x72};
|
||||
|
||||
|
|
@ -48,11 +48,11 @@ static const uint8_t test_result_md5[] = {
|
|||
* for hash in sha512sum sha256sum; do $hash /tmp/test; done
|
||||
*
|
||||
*/
|
||||
static const uint8_t test_vector_sg1[] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
|
||||
static const uint8_t test_vector_sg2[] = {0x67, 0x68, 0x69};
|
||||
static const uint8_t test_vector_sg3[] = {0x6a, 0x6b, 0x6c};
|
||||
static const uint8_t test_vector_sg1[6] = {0x61, 0x62, 0x63, 0x64, 0x65, 0x66};
|
||||
static const uint8_t test_vector_sg2[3] = {0x67, 0x68, 0x69};
|
||||
static const uint8_t test_vector_sg3[3] = {0x6a, 0x6b, 0x6c};
|
||||
|
||||
static const uint8_t test_result_sg_sha512[] = {
|
||||
static const uint8_t test_result_sg_sha512[64] = {
|
||||
0x17, 0x80, 0x7c, 0x72, 0x8e, 0xe3, 0xba, 0x35, 0xe7, 0xcf, 0x7a, 0xf8,
|
||||
0x23, 0x11, 0x6d, 0x26, 0xe4, 0x1e, 0x5d, 0x4d, 0x6c, 0x2f, 0xf1, 0xf3,
|
||||
0x72, 0x0d, 0x3d, 0x96, 0xaa, 0xcb, 0x6f, 0x69, 0xde, 0x64, 0x2e, 0x63,
|
||||
|
|
@ -60,7 +60,7 @@ static const uint8_t test_result_sg_sha512[] = {
|
|||
0x84, 0x25, 0x7c, 0x32, 0xc8, 0xf6, 0xd0, 0x85, 0x4a, 0xe6, 0xb5, 0x40,
|
||||
0xf8, 0x6d, 0xda, 0x2e};
|
||||
|
||||
static const uint8_t test_result_sg_sha256[] = {
|
||||
static const uint8_t test_result_sg_sha256[32] = {
|
||||
0xd6, 0x82, 0xed, 0x4c, 0xa4, 0xd9, 0x89, 0xc1, 0x34, 0xec, 0x94, 0xf1,
|
||||
0x55, 0x1e, 0x1e, 0xc5, 0x80, 0xdd, 0x6d, 0x5a, 0x6e, 0xcd, 0xe9, 0xf3,
|
||||
0xd3, 0x5e, 0x6e, 0x4a, 0x71, 0x7f, 0xbd, 0xe4};
|
||||
|
|
@ -76,7 +76,7 @@ static const uint8_t test_result_sg_sha256[] = {
|
|||
* echo -n -e 'abc' | dd of=/tmp/test
|
||||
* for hash in sha512sum sha256sum; do $hash /tmp/test; done
|
||||
*/
|
||||
static const uint8_t test_vector_accum_512[] = {
|
||||
static const uint8_t test_vector_accum_512[128] = {
|
||||
0x61, 0x62, 0x63, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
@ -94,7 +94,7 @@ static const uint8_t test_vector_accum_512[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18};
|
||||
|
||||
static const uint8_t test_vector_accum_256[] = {
|
||||
static const uint8_t test_vector_accum_256[64] = {
|
||||
0x61, 0x62, 0x63, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
|
@ -104,7 +104,7 @@ static const uint8_t test_vector_accum_256[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18};
|
||||
|
||||
static const uint8_t test_result_accum_sha512[] = {
|
||||
static const uint8_t test_result_accum_sha512[64] = {
|
||||
0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49,
|
||||
0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
|
||||
0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a, 0x21, 0x92, 0x99, 0x2a,
|
||||
|
|
@ -112,7 +112,7 @@ static const uint8_t test_result_accum_sha512[] = {
|
|||
0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f,
|
||||
0xa5, 0x4c, 0xa4, 0x9f};
|
||||
|
||||
static const uint8_t test_result_accum_sha256[] = {
|
||||
static const uint8_t test_result_accum_sha256[32] = {
|
||||
0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde,
|
||||
0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
|
||||
0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue