Skip to content

Commit

Permalink
openssl 3
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Jul 28, 2023
1 parent d89d237 commit d0d6bc6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions encryption/encryption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,23 @@ Status AESEncryptionProvider::ReadEncryptionHeader(
std::string GetOpenSSLErrors() {
std::ostringstream serr;
unsigned long l;
const char *file, *data, *func;
int line, flags;
const char *file, *data;
bool is_first = true;
while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
if (is_first) {
is_first = false;
} else {
serr << " ";
}

char buf[256];
ERR_error_string_n(l, buf, sizeof(buf));
serr << buf << ":" << file << ":" << line;
if (flags & ERR_TXT_STRING) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000
l = ERR_peek_last_error_all(&file, &line, &func, &data, &flags);
#else
l = ERR_peek_last_error_line_data(&file, &line, &data, &flags);
func = ERR_func_error_string(l);
#endif

if (l != 0) {
serr << l << ":" << ERR_lib_error_string(l) << ":" << func << ":" << file
<< ":" << line;
if ((flags & ERR_TXT_STRING) && data && *data) {
serr << ":" << data;
} else {
serr << ":" << ERR_reason_error_string(l);
}
}
return serr.str();
Expand Down

0 comments on commit d0d6bc6

Please sign in to comment.