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-08 12:19:12 +01:00
parent f2a532de32
commit 61d7ec4bf7
2 changed files with 0 additions and 17 deletions

View File

@ -899,19 +899,4 @@ Array::Ptr GetSubjectAltNames(const std::shared_ptr<X509>& cert)
return sans;
}
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

@ -62,8 +62,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 */