Hi Kareem,

Thanks for your quick reply and the hints. There is still no change in the log file; the response remains the same. I have tried various combinations of build options—including all three at once—but the result remains unchanged. I also tested it using the default `user_settings.h` file from the distribution with this additions:

...... from top
/* Make sure this is not an ESP-IDF file */
#undef  WOLFSSL_ESPIDF

#define HAVE_ECC

/* == insertion BerHav == */
#define HAVE_CURVE25519 // For x25519 in supported_groups
#define HAVE_ENCRYPT_THEN_MAC
#define WOLFSSL_SHA384
#define WOLFSSL_SHA512
#define HAVE_RENEGOTIATION_INDICATION
#define WOLFSSL_TLS12
#define HAVE_TLS_EXTENSIONS
#define HAVE_SUPPORTED_CURVES
#define HAVE_EXTENDED_MASTER
#define HAVE_HKDF
#define WC_RSA_PSS
#define HAVE_AESGCM
#define HAVE_SNI
/* == end insertion BerHav == */
/* the rest of the file is unchanged /*

In every case, data retrieval from Nordpool works, but for Buienradar, I continue to get the same error message regardless of the configuration.
Attached the logfile from the connection and result from Nordpool and the failed connection to buienradar. Both uses the same routines to setup and read/write the connection.

Thanks,
Bert

Hi Kareem,

Thanks for your quick response. Unfortunately, the additional options did not lead to a solution. The log looks exactly the same after the new build.

Attached is the user_settings.h file that I am currently using.

Since last Thursday, I have been experiencing an issue retrieving precipitation data from buienradar.nl. The configuration had been working without any problems for about 4 years. The system is now returning a -313 error, which, according to the documentation, appears to be a cipher suite error.

The strange thing is that the same code has continued to work with other sites used to retrieve electricity prices—for example, dataportal-api.nordpoolgroup.com and web-api.tp.entsoe.eu.

When I check which cipher suites are supported using:

nmap --script ssl-enum-ciphers -p 443 gpsgadget.buienradar.nl

I find that they all support `TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256` (using the `ecdh_x25519` key exchange)—a fact I have verified for the connection to Nord Pool Group.

I have tried adding more cipher suites, but that does not seem to be where the problem lies. There is approximately 90kB of RAM available. I hope someone can tell me how to resolve this issue. The site itself seems to be working; in the browser, I receive the expected response at:
https://gpsgadget.buienradar.nl/data/ra … p;lon=5.17

The log shows:

17:13:47 wolfSSLlog: 2, wolfSSL Entering TLSv1_2_client_method_ex
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_new
17:13:47 wolfSSLlog: 2, wolfSSL Entering ReinitSSL
17:13:47 wolfSSLlog: 1, RNG_HEALTH_TEST_CHECK_SIZE = 128
17:13:47 wolfSSLlog: 1, sizeof(seedB_data)         = 128
17:13:47 wolfSSLlog: 2, wolfSSL Entering SetSSL_CTX
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_NewSession
17:13:47 wolfSSLlog: 1, InitSSL done. return 0 (success)
17:13:47 wolfSSLlog: 1, wolfSSL_new InitSSL success
17:13:47 wolfSSLlog: 3, wolfSSL Leaving wolfSSL_new InitSSL =, return 0
17:13:47 wolfSSLlog: 1, TLS 1.2 or lower
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_connect
17:13:47 wolfSSLlog: 2, wolfSSL Entering ReinitSSL
17:13:47 wolfSSLlog: 2, wolfSSL Entering SendClientHello
17:13:47 wolfSSLlog: 1, Adding signature algorithms extension
17:13:47 wolfSSLlog: 1, growing output buffer
17:13:47 wolfSSLlog: 1, Signature Algorithms extension to write
17:13:47 wolfSSLlog: 1, Point Formats extension to write
17:13:47 wolfSSLlog: 1, Supported Groups extension to write
17:13:47 wolfSSLlog: 1, SNI extension to write
17:13:47 wolfSSLlog: 1, Shrinking output buffer
17:13:47 wolfSSLlog: 3, wolfSSL Leaving SendClientHello, return 0
17:13:47 wolfSSLlog: 1, connect state: CLIENT_HELLO_SENT
17:13:47 wolfSSLlog: 1, Server state up to needed state.
17:13:47 wolfSSLlog: 1, Progressing server state...
17:13:47 wolfSSLlog: 1, ProcessReply...
17:13:47 wolfSSLlog: 1, received record layer msg
17:13:47 wolfSSLlog: 1, got ALERT!
17:13:47 wolfSSLlog: 1, Alert type: internal_error
17:13:47 wolfSSLlog: 0, wolfSSL error occurred, error = 80
17:13:47 wolfSSLlog: 0, wolfSSL error occurred, error = -313
17:13:47 ENTSO.ino: 518 ERROR: wolfSSL_connect failed
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_get_version
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_get_cipher
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_get_current_cipher
17:13:47 wolfSSLlog: 2, wolfSSL Entering wolfSSL_CIPHER_get_name
SSL version is TLSv1.2, SSL cipher suite is NONE 

The code is executed on STM32 Blackpill, the IDE is Arduino. WolfSSL version is 5.9.4

The stripped used code is in the attachment.

4

(3 replies, posted in wolfSSL)

Probably the most simple solution is to send a request  with HTTP/1.0 instead of HTTP/1.1. In 1.0 chunking is not supported and a 1.1 client must support chunking. Otherwise the application has to handle the chunks.

Regards,
Bert

5

(3 replies, posted in wolfSSL)

Hello Kareem,
Thanks for your quick reply. Unfortunately, I already suspected that I would have to handle this within the application itself; I couldn't find any information about it.

The application is for personal use and manages the control logic for solar panels combined with a home battery. This component retrieves electricity market prices to determine whether the battery should be charged from the grid or discharged. The prices are fetched from web-api.tp.entsoe.eu.

Thanks,
Bert

6

(3 replies, posted in wolfSSL)

Hi there,

In a server response, the data is transmitted in separate chunks. When processing these data chunks, the size of the next chunk appears interspersed with the data itself. Is this expected behavior? Is there a setting to hide this within the data stream? The application is developed in the Arduino IDE for STM32 using a W5500 Ethernet interface and utilizes wolfSSL 5.8.4.

              <Point>
                <position>45</position>
                  <price.amount>145.69</price.amount>
              </Point>
              <Point>
                <position>46</position>
         <price.amount>146.02</price.a
1b70
mount>
              </Point>
              <Point>
                <position>47</position>
                  <price.amount>142.13</price.amount>
              </Point>

The 0x1b70 is the size of the next chunk.

The data is read into 256-byte buffers. This part works correctly, but the chunk size appearing in the middle of the stream makes interpretation difficult.

YES!

Thanks for pointing!
For those who experience the same issue:

I added to user_settings.h

 #define HAVE_SNI

and in the code after loading the CTX:

  if (wolfSSL_CTX_UseSNI(ctx, WOLFSSL_SNI_HOST_NAME, sniHostName,
                         (word16) XSTRLEN(sniHostName)) != WOLFSSL_SUCCESS) {
    wolfSSL_CTX_free(ctx); 
    ctx = NULL;
  }

Thanks for your very fast reaction!
Could it have something to do with the fact that the server most likely has an SNI certificate?

Using WolfSLL 5.3.1 since a few time on a STM32F411CE using the Arduino IDE and followed most of the instructions widely available. After spending some time i got success to setup a connection to gpsgadget.buienradar.nl, this works reliable.
Now I would like to report abuse port scanners to api.abuseipdb.com.
But the connection setup couldn't pass the setup the TLS connection.
I have checked by SSLlabs if api.abuseipdb.com supports the encryption on  TLSv1.2, SSL cipher suite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 which is also used by gpsgadget.buienradar.nl and it should do.

Anyone any idea? I've read another post here on the forum about error -326, that was due an invalid header of the server. But i couldn't image that a server from a professional service still is not patched.

But the log from api.abuseipdb.com shows:

Memory usage after loading ctx:

Heap end at:        0x20008C98
Stack Ptr end at:   0x2001E9E8
Estimated Free RAM: 99984 wolfSSL ctx get: success
10:54:50 wolfSSLlog: 2, wolfSSL Entering wolfSSL_CTX_set_verify-> connecting to api.abuseipdb.com... Took: 57ms
Connected, continue to setup TLS to: api.abuseipdb.com
10:54:50 wolfSSLlog: 2, wolfSSL Entering SSL_new
10:54:50 wolfSSLlog: 3, wolfSSL Leaving SSL_new, return 0
Memory usage after getting SSL object:

Heap end at:        0x20008C98
Stack Ptr end at:   0x2001E9E8
Estimated Free RAM: 97684

10:54:50 wolfSSLlog: 2, wolfSSL Entering SSL_connect()
10:54:50 wolfSSLlog: 2, wolfSSL Entering SendClientHello
10:54:50 wolfSSLlog: 1, Adding signature algorithms extension
10:54:50 wolfSSLlog: 1, growing output buffer
10:54:50 wolfSSLlog: 1, Signature Algorithms extension to write
10:54:50 wolfSSLlog: 1, Point Formats extension to write
10:54:50 wolfSSLlog: 1, Supported Groups extension to write
10:54:50 wolfSSLlog: 1, Data to send
10:54:50 wolfSSLlog: 1,     16 03 03 00 65 01 00 00 61 03 03 83 46 65 2f 5c |....e...a...Fe/\
10:54:50 wolfSSLlog: 1,     44 16 5f b3 89 26 de 0b 6b a2 06 7e a7 9a 55 22 |D._..&..k..~..U"
10:54:50 wolfSSLlog: 1,     01 b0 22 f4 7e a2 66 c4 08 6f ba 00 00 14 c0 2b |..".~.f..o.....+
10:54:50 wolfSSLlog: 1,     c0 2f c0 27 c0 23 c0 0a c0 09 c0 08 c0 14 c0 13 |./.'.#..........
10:54:50 wolfSSLlog: 1,     c0 12 01 00 00 24 00 0d 00 0c 00 0a 04 03 02 03 |.....$..........
10:54:50 wolfSSLlog: 1,     08 04 04 01 02 01 00 0b 00 02 01 00 00 0a 00 0a |................
10:54:50 wolfSSLlog: 1,     00 08 00 19 00 18 00 17 00 15                   |..........
10:54:50 wolfSSLlog: 1, SendBuffered() => 1 byte(s) message success
10:54:50 wolfSSLlog: 1, Shrinking output buffer
10:54:50 wolfSSLlog: 3, wolfSSL Leaving SendClientHello, return 0
10:54:50 wolfSSLlog: 1, ssl.c connect state: CLIENT_HELLO_SENT
10:54:50 wolfSSLlog: 1, Data received
10:54:50 wolfSSLlog: 1,     15 03 01 00 02                                  |.....
10:54:50 wolfSSLlog: 1, SSL version error
10:54:50 wolfSSLlog: 2, wolfSSL Entering SendAlert
10:54:51 wolfSSLlog: 1, growing output buffer
10:54:51 wolfSSLlog: 1, Data to send
10:54:51 wolfSSLlog: 1,     15 03 03 00 02 02 46                            |......F
10:54:51 wolfSSLlog: 1, SendBuffered() => 1 byte(s) message success
10:54:51 wolfSSLlog: 1, Shrinking output buffer
10:54:51 wolfSSLlog: 3, wolfSSL Leaving SendAlert, return 0
10:54:51 wolfSSLlog: 0, wolfSSL error occurred, error = -326
10:54:51 wolfSSLlog: 2, wolfSSL Entering SSL_get_error
10:54:51 wolfSSLlog: 3, wolfSSL Leaving SSL_get_error, return -326
10:54:51 wolfSSLlog: 2, wolfSSL Entering wolfSSL_ERR_error_string_n
10:54:51 wolfSSLlog: 2, wolfSSL Entering ERR_error_string
ERROR: Report2AbuseIPDB; TLS Connect Error: record layer version error
10:54:51 wolfSSLlog: 2, wolfSSL Entering SSL_shutdown()
10:54:51 wolfSSLlog: 3, wolfSSL Leaving SSL_shutdown(), return -1
cleanup TLS connection
10:54:51 wolfSSLlog: 2, wolfSSL Entering SSL_free
10:54:51 wolfSSLlog: 1, Free'ing client ssl
10:54:51 wolfSSLlog: 1, CTX ref count not 0 yet, no free
10:54:51 wolfSSLlog: 3, wolfSSL Leaving SSL_free, return 0
SSL object cleared
10:54:51 wolfSSLlog: 2, wolfSSL Entering SSL_CTX_free
10:54:51 wolfSSLlog: 1, CTX ref count down to 0, doing full free
10:54:51 wolfSSLlog: 2, wolfSSL Entering wolfSSL_CertManagerFree
10:54:51 wolfSSLlog: 3, wolfSSL Leaving SSL_CTX_free, return 0