ssl client write / server accept seems broken

Embedded Devel lists at optimcloud.com
Wed Mar 24 14:53:33 UTC 2021


On 3/23/21 11:06 PM, Matt Caswell wrote:
>
>
> On 23/03/2021 15:47, Embedded Devel wrote:
>>> Do you know if your application is statically linked or dynamically 
>>> linked to OpenSSL?
>> Ive attached the code in question if it helps

original code was deprecated, and changed from

/*      if ((ssl_con->ctx = SSL_CTX_new(TLSv1_server_method())) == NULL) 
{ */
         if ((ssl_con->ctx = SSL_CTX_new(TLS_server_method())) == NULL) {

which also got added to the client side yet should have been

client should be

if ((ssl_con->ctx = SSL_CTX_new(TLS_client_method())) == NULL) {

not

if ((ssl_con->ctx = SSL_CTX_new(TLS_server_method())) == NULL) {


>
> Looks like the original developer already tried to print the contents 
> of the OpenSSL error stack:
>
>         case SSL_ERROR_SSL:
>             LOG(LOG_ERR, "%s: Error SSL_ERROR_SSL - return code: %d. 
> %s\n", custom_prefix, ret_val, custom_msg);
>             break;
>     }
>
>     ERR_print_errors_fp(stderr);fflush(stderr);
>
> The errors seem to be going to "stderr" rather than via your "LOG" 
> function. You don't show what "LOG" does but if it goes somewhere 
> other than stderr then the errors are going somewhere different to 
> your log file. Are you able to show us the stderr output from running 
> your application?
>
>
>> just compiled with gcc, i see no -lstatic in the makefile ... ive 
>> attached the ssl .c and .h files in question if you want to see them
>
> What does "ldd" show you for the application binary? i.e.
>
> ldd name-of-you-binary-here
>
>
> Matt


More information about the openssl-users mailing list