Hi
 
I'm using BIO in async mode. When writing or reading data with SSL_write or SSL_read, in some parts of the code, after receive some data
I use EVPs functions. In some cases, due key problems, my EVP_DecryptFinalEx fails and call

EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);

That set internal error control data.
 
Then when I call SSL_write after the EVP error to inform the peer about the error, BIOs is set to write pending. After BIO operation, SSL_write check that BIO has
returned -1, and call

SSL_get_error() that call ERR_peek_error()

and ERR_peek_error return error, but not SSL generated error, the error was set due my previous failed EVP_DecryptFinalEx in my code, and SSL conection is dropped returning

SSL_ERROR_SSL

What is the best way to avoid this? Clear the error after EVP_DecryptFinalEx return 0?

I think that when a new operation is started in SSL, the last error should be automatically cleared don't be?

Leandro Gustavo Biss Becker 
Engenheiro Eletrônico / Electronic Engineer

eSysTech - Embedded Systems Technologies
Travessa da Lapa, 96 conjunto 73
Curitiba - Paraná - Brasil
http://www.esystech.com.br
Telefone: +55 (41) 3029-2960

Esta mensagem e seus anexos podem conter informações confidenciais ou privilegiadas. Se você não é o destinatário dos mesmos você não está autorizado a utilizar o material para qualquer fim. Solicitamos que você apague a mensagem e avise imediatamente ao remetente. O conteúdo desta mensagem e seus anexos não representam necessariamente a opinião e a intenção da empresa, não implicando em qualquer obrigação ou responsabilidade da parte da mesma.

This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. The contents of this message and its attachments do not necessarily express the opinion or the intention of the company, and do not implies any legal obligation or  responsabilities from this company.
 

Reply via email to