1 (edited by dennisjones784 2024-12-29 18:43:45)

Topic: Trouble with handshake with WolfSSL

Hello,
2

I'm having some issues using WolfSSL. I tried to ask a question on the WolfSSL forums, but registration is not working right now.

I am using WolfSSL to develop a simple email client for the Nintendo Wii. WolfSSL is the only library that claims to have Wii compatibility. I've successfully built the library with devKitPro, and everything seems to be working, but it fails on the handshake.
geometry dash lite
Here is some sample code:

bool Internet::sslSetup(){

  if(wolfSSL_Init() != SSL_SUCCESS){
    sslReportError();
    return false;
  }
  setState("SSL Init");

  method = wolfSSLv23_client_method();
  if (method == NULL) {
    sslReportError();
    return false;
  }
  setState("SSL Method Set");

  ctx = wolfSSL_CTX_new(method);
  wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);

  if(ctx == NULL){
    sslReportError();
    return false;
  }
  setState("SSL Ctx Init");

  sslSocket = wolfSSL_new(ctx);
  if(sslSocket == NULL){
    sslReportError();
    return false;
  }
  setState("SSL Socket Init");

  wolfSSL_set_fd(sslSocket, socket);
  if(sslSocket == NULL){
    sslReportError();
    return false;
  }
  setState("SSL Socket connected to net socket");

  return true;
}

I don't have any way to debug on the Wii, so I am relegated to text debugging. Here is my log for the WolfSSL debug output:

13 12 2024 00:55 wolfSSL Entering wolfSSL_Init 
13 12 2024 00:55 wolfSSL Entering WOLFSSL_CTX_new 
13 12 2024 00:55 wolfSSL Entering wolfSSL_CertManagerNew 
13 12 2024 00:55 wolfSSL Leaving WOLFSSL_CTX_new, return 0 
13 12 2024 00:55 wolfSSL Entering wolfSSL_CTX_set_verify 
13 12 2024 00:55 wolfSSL Entering SSL_new 
13 12 2024 00:55 wolfSSL Leaving SSL_new, return 0 
13 12 2024 00:55 wolfSSL Entering SSL_set_fd 
13 12 2024 00:55 wolfSSL Leaving SSL_set_fd, return 1 
13 12 2024 00:55 wolfSSL Entering SSL_connect() 
13 12 2024 00:55 growing output buffer
13 12 2024 00:55 Shrinking output buffer
13 12 2024 00:55 connect state: CLIENT_HELLO_SENT 
13 12 2024 00:55 received record layer msg 
13 12 2024 00:55 got ALERT! 
13 12 2024 00:55 Got alert 
13 12 2024 00:55 wolfSSL error occurred, error = 40 
13 12 2024 00:55 wolfSSL error occurred, error = -313 

ny ideas? Trying to connect to smtp.gmail.com on port 465.

Share

Re: Trouble with handshake with WolfSSL

Hi Dennis,

Are you able to capture a Wireshark for this? The client is sending a client_hello and the server is reporting back a handshake failure (40) and closing the socket. Who is the server? Perhaps the server requires TLS v1.3 and you don't have that enabled in your build options. Can you share how you built wolfSSL (user_settings.h file)?

It might be helpful to experiment with a simulator like https://github.com/dolphin-emu/dolphin first.

Thanks,
David Garske, wolfSSL

Share

Re: Trouble with handshake with WolfSSL

Hi Dennis,

Another reason for this could be missing SNI. Make sure you have enabled SNI (HAVE_SNI) and called the API to set the hostname.

See https://www.wolfssl.com/using-server-na … h-wolfssl/

Thanks,
David Garske, wolfSSL

Share