How to clear bad OpenSSL connection

If the SSL_accept call fails, I just want to help out.

I am currently calling SSL_shutdown and then SSL_free, but after implementing this, two clients crashed in OpenSSL (when calling SSL_accept at a later time), so I guess this is not the best way to clean up.

The docs say that SSL_shutdown is used for the proper cleanup, and it might have to be called twice (although if SSL_accept failed, I would not have thought it would be so). SSL_clear is another option, but it is more like a reset connection.

SSL_free decreases the link count and removes the connection if the number of links reaches 0. I know that my code has no links, but maybe? session?

Is there a final way to completely close / close / free an SSL object using OpenSSL?

+3
source share
1 answer

Once you have called SSL_free()in an object SSL, you should not use it again. You need to make sure that the new SSL is created using SSL_new()for later SSL_accept().

+3
source

Source: https://habr.com/ru/post/1762476/


All Articles