forked from wolfSSL/wolfssl
Zero buffer size test should be implemented another way
This commit is contained in:
16
tests/api.c
16
tests/api.c
@@ -31228,8 +31228,10 @@ static int test_wolfSSL_a2i_ASN1_INTEGER(void)
|
|||||||
BIO_free(out);
|
BIO_free(out);
|
||||||
|
|
||||||
AssertNotNull(fixed = BIO_new(wolfSSL_BIO_s_fixed_mem()));
|
AssertNotNull(fixed = BIO_new(wolfSSL_BIO_s_fixed_mem()));
|
||||||
|
/* TODO: can't create zero length buffer
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(i2a_ASN1_INTEGER(fixed, ai), 0);
|
AssertIntEQ(i2a_ASN1_INTEGER(fixed, ai), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(i2a_ASN1_INTEGER(fixed, ai), 0);
|
AssertIntEQ(i2a_ASN1_INTEGER(fixed, ai), 0);
|
||||||
BIO_free(fixed);
|
BIO_free(fixed);
|
||||||
@@ -32016,8 +32018,10 @@ static int test_wolfSSL_ASN1_STRING_print_ex(void)
|
|||||||
AssertIntEQ(p_len, 15);
|
AssertIntEQ(p_len, 15);
|
||||||
BIO_read(bio, (void*)rbuf, 15);
|
BIO_read(bio, (void*)rbuf, 15);
|
||||||
AssertStrEQ((char*)rbuf, "Hello wolfSSL!");
|
AssertStrEQ((char*)rbuf, "Hello wolfSSL!");
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 14), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 14), 1);
|
||||||
@@ -32030,8 +32034,10 @@ static int test_wolfSSL_ASN1_STRING_print_ex(void)
|
|||||||
AssertIntEQ(p_len, 9);
|
AssertIntEQ(p_len, 9);
|
||||||
BIO_read(bio, (void*)rbuf, 9);
|
BIO_read(bio, (void*)rbuf, 9);
|
||||||
AssertStrEQ((char*)rbuf, "a\\+\\;\\<\\>");
|
AssertStrEQ((char*)rbuf, "a\\+\\;\\<\\>");
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, esc_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, esc_str, flags), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, esc_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, esc_str, flags), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 8), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 8), 1);
|
||||||
@@ -32044,8 +32050,10 @@ static int test_wolfSSL_ASN1_STRING_print_ex(void)
|
|||||||
AssertIntEQ(p_len, 28);
|
AssertIntEQ(p_len, 28);
|
||||||
BIO_read(bio, (void*)rbuf, 28);
|
BIO_read(bio, (void*)rbuf, 28);
|
||||||
AssertStrEQ((char*)rbuf, "OCTET STRING:Hello wolfSSL!");
|
AssertStrEQ((char*)rbuf, "OCTET STRING:Hello wolfSSL!");
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 12), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 12), 1);
|
||||||
@@ -32060,8 +32068,10 @@ static int test_wolfSSL_ASN1_STRING_print_ex(void)
|
|||||||
AssertIntEQ(p_len, 31);
|
AssertIntEQ(p_len, 31);
|
||||||
BIO_read(bio, (void*)rbuf, 31);
|
BIO_read(bio, (void*)rbuf, 31);
|
||||||
AssertStrEQ((char*)rbuf, "#48656C6C6F20776F6C6653534C2100");
|
AssertStrEQ((char*)rbuf, "#48656C6C6F20776F6C6653534C2100");
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 30), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 30), 1);
|
||||||
@@ -32074,8 +32084,10 @@ static int test_wolfSSL_ASN1_STRING_print_ex(void)
|
|||||||
AssertIntEQ(p_len, 35);
|
AssertIntEQ(p_len, 35);
|
||||||
BIO_read(bio, (void*)rbuf, 35);
|
BIO_read(bio, (void*)rbuf, 35);
|
||||||
AssertStrEQ((char*)rbuf, "#040F48656C6C6F20776F6C6653534C2100");
|
AssertStrEQ((char*)rbuf, "#040F48656C6C6F20776F6C6653534C2100");
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
AssertIntEQ(wolfSSL_ASN1_STRING_print_ex(fixed, asn_str, flags), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 2), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 2), 1);
|
||||||
@@ -32235,7 +32247,7 @@ static int test_wolfSSL_ASN1_GENERALIZEDTIME_print(void)
|
|||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
|
|
||||||
AssertNotNull(bio = BIO_new(wolfSSL_BIO_s_fixed_mem()));
|
AssertNotNull(bio = BIO_new(wolfSSL_BIO_s_fixed_mem()));
|
||||||
for (i = 0; i < 20; i++) {
|
for (i = 1; i < 20; i++) { /* TODO: can't create zero length buffers */
|
||||||
AssertIntEQ(BIO_set_write_buf_size(bio, i), 1);
|
AssertIntEQ(BIO_set_write_buf_size(bio, i), 1);
|
||||||
AssertIntEQ(wolfSSL_ASN1_GENERALIZEDTIME_print(bio, >ime), 0);
|
AssertIntEQ(wolfSSL_ASN1_GENERALIZEDTIME_print(bio, >ime), 0);
|
||||||
}
|
}
|
||||||
@@ -32677,8 +32689,10 @@ static int test_wolfSSL_ASN1_TIME_print(void)
|
|||||||
AssertIntEQ(XMEMCMP(buf, "Dec 16 21:17:49 2022 GMT", sizeof(buf) - 1), 0);
|
AssertIntEQ(XMEMCMP(buf, "Dec 16 21:17:49 2022 GMT", sizeof(buf) - 1), 0);
|
||||||
|
|
||||||
/* Test BIO_write fails. */
|
/* Test BIO_write fails. */
|
||||||
|
/* TODO: can't create zero length buffers
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 0), 1);
|
||||||
AssertIntEQ(ASN1_TIME_print(fixed, notBefore), 0);
|
AssertIntEQ(ASN1_TIME_print(fixed, notBefore), 0);
|
||||||
|
*/
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 1), 1);
|
||||||
AssertIntEQ(ASN1_TIME_print(fixed, notBefore), 0);
|
AssertIntEQ(ASN1_TIME_print(fixed, notBefore), 0);
|
||||||
AssertIntEQ(BIO_set_write_buf_size(fixed, 23), 1);
|
AssertIntEQ(BIO_set_write_buf_size(fixed, 23), 1);
|
||||||
|
Reference in New Issue
Block a user