c - ssl_connect does nothing at all (observed in wireshark) -


i have code cross compiled 2 devices. on 1 device code works flawlessly, on other ssl_connect nothing. info both devices:

device 1: (working)  cpu: powerpc @ 220mhz  ram: 128mb sd-ram  linux 2.6.24.6  device 2: (not working)  cpu: powerpc @ 133mhz  ram:32mb sd-ram  linux 2.4.21 

here's code i'm using after sending ehlo , starttls:

static ssl_ctx *ctx = null;  static ssl *ssl = null;   void createtlssession(int sockfd)  {                int retvalue=0;          printf("creating tls session...\n");          ssl_library_init();          ssl_load_error_strings();          openssl_add_all_algorithms();          //ctx = ssl_ctx_new(tlsv1_client_method());          ctx = ssl_ctx_new(tlsv1_client_method());          //(ssl_ctx_set_options(ctx, ssl_op_no_compression);          //ssl_ctx_set_mode(ctx, ssl_mode_release_buffers);          if (ctx == null)          {                  printf("failed initialize context\n");                  return;          }          printf("ctx created...\n");          ssl = ssl_new(ctx);          if (ssl == null)          {                  printf("failed create ssl structure...\n");                  return;          }          if (!ssl_set_fd(ssl, sockfd))          {                  printf("failed bind socket fd\n");                  return;          }          printf("ssl bound sockfd=%d...\n",sockfd);          while (retvalue != 1)          {                   retvalue = ssl_connect(ssl);                  interpreteerror(retvalue);                 sleep(1);          }          printf("ok\n");  }  static void interpreteerror(int ierror) {     int iret = 0;     iret = ssl_get_error(ssl, ierror);     switch (iret)     {         case ssl_error_zero_return:             printf("error: tls/ssl connection has been closed!\n");             break;         case ssl_error_want_read:         case ssl_error_want_write:             printf("error: want read/write!\n");             break;         case ssl_error_want_connect:         case ssl_error_want_accept:             printf("error: socket not yet connect peer!\n");             break;         case ssl_error_want_x509_lookup:             printf("error: want x509 lookup!\n");             break;         case ssl_error_syscall:             perror("ssl_error_syscall");             break;         case ssl_error_ssl:                     printf("error: failure in ssl library!n");                     break;         default:             printf("no errors\n");     } } 

the socket non-blocking. i'm using while loop test purposes. loop substituted "switch" later on.

the code output following:

creating tls session...  ctx created...  ssl bound sockfd=9...  ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success ssl_error_syscall: success 

but never gets out of loop.

i managed connect device 2 managed switch , observe network traffic through wireshark. surprise, ssl_connect() has no effect. last thing shown wireshark "220 2.0.0 ready start tls":

no handshake

any idea how solve this?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -