Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/crypto/OCSP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ void OCSP::verifyResponse(const X509Cert &cert) const
(ERR_GET_REASON(err) == OCSP_R_CERTIFICATE_VERIFY_ERROR ||
ERR_GET_REASON(err) == OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND))
{
Exception e(EXCEPTION_PARAMS("Failed to verify OCSP Responder certificate"));
OpenSSLException e(EXCEPTION_PARAMS("Failed to verify OCSP Responder certificate"), err);
e.setCode(Exception::CertificateUnknown);
throw e;
}
THROW_OPENSSLEXCEPTION("Failed to verify OCSP response.");
throw OpenSSLException(EXCEPTION_PARAMS("Failed to verify OCSP response."), err);
}

// Find issuer before OCSP validation to activate region TSL
Expand Down
5 changes: 2 additions & 3 deletions src/crypto/OpenSSLHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ std::vector<unsigned char> i2d(T *obj, Func func)
class OpenSSLException : public Exception
{
public:
OpenSSLException(const std::string &file, int line, const std::string &msg)
OpenSSLException(const std::string &file, int line, const std::string &msg, unsigned long error = ERR_get_error())
: Exception(file, line, msg)
{
unsigned long error = 0;
while((error = ERR_get_error()) != 0)
for(; error != 0; error = ERR_get_error())
{
Exception e(ERR_lib_error_string(error), 0, ERR_error_string(error, nullptr));
#ifndef LIBRESSL_VERSION_NUMBER
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/TS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ void TS::verify(const Digest &digest)
unsigned long err = ERR_get_error();
if(ERR_GET_LIB(err) == ERR_LIB_TS && ERR_GET_REASON(err) == TS_R_CERTIFICATE_VERIFY_ERROR)
{
Exception e(EXCEPTION_PARAMS("Certificate status: unknown"));
OpenSSLException e(EXCEPTION_PARAMS("Certificate status: unknown"), err);
e.setCode( Exception::CertificateUnknown );
throw e;
}
THROW_OPENSSLEXCEPTION("Failed to verify TS response.");
throw OpenSSLException(EXCEPTION_PARAMS("Failed to verify TS response."), err);
}
}
#ifndef OPENSSL_NO_CMS
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/X509CertStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ bool X509CertStore::verify(const X509Cert &cert, bool noqscd) const
if(X509_verify_cert(csc.get()) <= 0)
{
int err = X509_STORE_CTX_get_error(csc.get());
OpenSSLException e(EXCEPTION_PARAMS(X509_verify_cert_error_string(err)));
OpenSSLException e(EXCEPTION_PARAMS("%s", X509_verify_cert_error_string(err)));
switch(err)
{
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
Expand Down