Add tests for ssl_get_bytes_avail()
This commit is contained in:
parent
e7a3b10dcc
commit
95c0a63023
@ -112,7 +112,12 @@
|
||||
|
||||
#define MAX_PSK_LEN 256
|
||||
|
||||
/* Size of the basic I/O buffer. Able to hold our default response. */
|
||||
/*
|
||||
* Size of the basic I/O buffer. Able to hold our default response.
|
||||
*
|
||||
* You will need to adapt the ssl_get_bytes_avail() test in ssl-opt.sh
|
||||
* if you change this value to something outside the range <= 100 or > 500
|
||||
*/
|
||||
#define IO_BUF_LEN 200
|
||||
|
||||
/*
|
||||
@ -1491,9 +1496,10 @@ reset:
|
||||
memset( larger_buf, 0, ori_len + extra_len );
|
||||
memcpy( larger_buf, buf, ori_len );
|
||||
|
||||
/* This read should never fail */
|
||||
/* This read should never fail and get the whole cached data */
|
||||
ret = ssl_read( &ssl, larger_buf + ori_len, extra_len );
|
||||
if( ret != extra_len )
|
||||
if( ret != extra_len ||
|
||||
ssl_get_bytes_avail( &ssl ) != 0 )
|
||||
{
|
||||
printf( " ! ssl_read failed on cached data\n" );
|
||||
ret = 1;
|
||||
|
@ -1352,6 +1352,19 @@ run_test "Per-version suites #4" \
|
||||
0 \
|
||||
-c "Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256"
|
||||
|
||||
# Tests for ssl_get_bytes_avail()
|
||||
|
||||
run_test "ssl_get_bytes_avail #1 (no extra data)" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=100" \
|
||||
0 \
|
||||
-s "Read from client: 100 bytes read$"
|
||||
|
||||
run_test "ssl_get_bytes_avail #2 (extra data)" \
|
||||
"$P_SRV" \
|
||||
"$P_CLI request_size=500" \
|
||||
0 \
|
||||
-s "Read from client: 500 bytes read (.*+.*)"
|
||||
|
||||
# Final report
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user