mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Fix use of 'buffer' in test
This commit is contained in:
18
tests/api.c
18
tests/api.c
@@ -29957,22 +29957,22 @@ static void test_wolfSSL_RAND_bytes(void)
|
|||||||
const int size3 = RNG_MAX_BLOCK_LEN * 2; /* in bytes */
|
const int size3 = RNG_MAX_BLOCK_LEN * 2; /* in bytes */
|
||||||
const int size4 = RNG_MAX_BLOCK_LEN * 4; /* in bytes */
|
const int size4 = RNG_MAX_BLOCK_LEN * 4; /* in bytes */
|
||||||
int max_bufsize;
|
int max_bufsize;
|
||||||
byte *buffer;
|
byte *my_buf;
|
||||||
|
|
||||||
printf(testingFmt, "test_wolfSSL_RAND_bytes()");
|
printf(testingFmt, "test_wolfSSL_RAND_bytes()");
|
||||||
|
|
||||||
max_bufsize = size4;
|
max_bufsize = size4;
|
||||||
|
|
||||||
buffer = (byte*)XMALLOC(max_bufsize * sizeof(byte), NULL,
|
my_buf = (byte*)XMALLOC(max_bufsize * sizeof(byte), NULL,
|
||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
AssertNotNull(buffer);
|
AssertNotNull(my_buf);
|
||||||
XMEMSET(buffer, 0, max_bufsize);
|
XMEMSET(my_buf, 0, max_bufsize);
|
||||||
AssertIntEQ(wolfSSL_RAND_bytes(buffer, size1), 1);
|
AssertIntEQ(wolfSSL_RAND_bytes(my_buf, size1), 1);
|
||||||
AssertIntEQ(wolfSSL_RAND_bytes(buffer, size2), 1);
|
AssertIntEQ(wolfSSL_RAND_bytes(my_buf, size2), 1);
|
||||||
AssertIntEQ(wolfSSL_RAND_bytes(buffer, size3), 1);
|
AssertIntEQ(wolfSSL_RAND_bytes(my_buf, size3), 1);
|
||||||
AssertIntEQ(wolfSSL_RAND_bytes(buffer, size4), 1);
|
AssertIntEQ(wolfSSL_RAND_bytes(my_buf, size4), 1);
|
||||||
|
|
||||||
XFREE(buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
XFREE(my_buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
|
|
||||||
printf(resultFmt, passed);
|
printf(resultFmt, passed);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user