Arm Mbed OS support forum

Strange mbedtls_ssl_read error

I’m using mbedtls with a PIC32MX using a gsm modem. The payment gateway I’m working with returns two possible json records. The first is for a specific payment id and the second is the entire payment record which grows with every transaction, at the moment this is “Content-Length: 22530”.
When I request a specific payment all goes smoothly, regardless of my record receiving buffer size but when I request the entire payment record I get “SSL - Bad input parameters to function” and nothing is written to the buffer.

To add to this I’ve compared the mbedtls_ssl_context passed to the function and apart from different f_recv and f_send due to the 2 characters less in the source file, they are identical.

I have the exact same sslclient1 adaptation with the same libraries and configuration as a linux program working with a socket. The only difference between the GET requests is /payment/66 for a specific payment id 66 record and /payment/ for the entire record.
If I perform this with the linux version it simply fills the buffer up to it’s limit (2048 bytes is enough) which is what I want as I only need the latest record and that fits in less than 2048 bytes.

It seems that the error is brought up by specifying “#define MBEDTLS_SSL_MAX_CONTENT_LEN 8192”
but there must be a way of getting the same behavior for both records