Remove std::string to_string(const errinfo_openssl_error& e)

The function was never used and it's implementation contains a bug where
a buffer of too small size is used as a paramter to ERR_error_string.
According to the `man 3 ERR_error_info`, the buffer has to be at least
256 bytes in size.

Also the function seems of limited use as it allows to output the tag
object used with additional error information for exceptions in Boost.
However, you boost::get_error_info<>() just returns the value type but
not the full tag object from the exception.
This commit is contained in:
Julian Brost 2020-12-09 12:22:52 +01:00
parent c0ad8bdb9a
commit 64a49ee3a1
2 changed files with 0 additions and 17 deletions

View File

@ -809,19 +809,4 @@ bool VerifyCertificate(const std::shared_ptr<X509>& caCertificate, const std::sh
return rc == 1;
}
std::string to_string(const errinfo_openssl_error& e)
{
std::ostringstream tmp;
int code = e.value();
char errbuf[120];
const char *message = ERR_error_string(code, errbuf);
if (!message)
message = "Unknown error.";
tmp << code << ", \"" << message << "\"";
return "[errinfo_openssl_error]" + tmp.str() + "\n";
}
}

View File

@ -52,8 +52,6 @@ class openssl_error : virtual public std::exception, virtual public boost::excep
struct errinfo_openssl_error_;
typedef boost::error_info<struct errinfo_openssl_error_, unsigned long> errinfo_openssl_error;
std::string to_string(const errinfo_openssl_error& e);
}
#endif /* TLSUTILITY_H */