@@ -259,11 +259,7 @@ EXP_FUNC void STDCALL ssl_free(SSL *ssl)
259
259
*/
260
260
EXP_FUNC int STDCALL ssl_read (SSL * ssl , uint8_t * * in_data )
261
261
{
262
- int ret = increase_bm_data_size (ssl );
263
- if (ret != SSL_OK ) {
264
- return ret ;
265
- }
266
- ret = basic_read (ssl , in_data );
262
+ int ret = basic_read (ssl , in_data );
267
263
268
264
/* check for return code so we can send an alert */
269
265
if (ret < SSL_OK && ret != SSL_CLOSE_NOTIFY )
@@ -287,10 +283,6 @@ EXP_FUNC int STDCALL ssl_read(SSL *ssl, uint8_t **in_data)
287
283
EXP_FUNC int STDCALL ssl_write (SSL * ssl , const uint8_t * out_data , int out_len )
288
284
{
289
285
int n = out_len , nw , i , tot = 0 ;
290
- int ret = increase_bm_data_size (ssl );
291
- if (ret != SSL_OK ) {
292
- return ret ;
293
- }
294
286
/* maximum size of a TLS packet is around 16kB, so fragment */
295
287
do
296
288
{
@@ -1293,9 +1285,21 @@ int basic_read(SSL *ssl, uint8_t **in_data)
1293
1285
/* do we violate the spec with the message size? */
1294
1286
if (ssl -> need_bytes > ssl -> max_plain_length + RT_EXTRA - BM_RECORD_OFFSET )
1295
1287
{
1296
- ret = SSL_ERROR_INVALID_PROT_MSG ;
1297
1288
printf ("ssl->need_bytes=%d > %d\r\n" , ssl -> need_bytes , ssl -> max_plain_length + RT_EXTRA - BM_RECORD_OFFSET );
1298
- goto error ;
1289
+ if (ssl -> can_increase_data_size )
1290
+ {
1291
+ ret = increase_bm_data_size (ssl );
1292
+ if (ret != SSL_OK )
1293
+ {
1294
+ ret = SSL_ERROR_INVALID_PROT_MSG ;
1295
+ goto error ;
1296
+ }
1297
+ }
1298
+ else
1299
+ {
1300
+ ret = SSL_ERROR_INVALID_PROT_MSG ;
1301
+ goto error ;
1302
+ }
1299
1303
}
1300
1304
1301
1305
CLR_SSL_FLAG (SSL_NEED_RECORD );
0 commit comments