mirror of
https://github.com/openssh/openssh-portable.git
synced 2026-11-06 05:16:43 +00:00
ERR_load_crypto_strings() Follow regress and use unchecked OPENSSL_init_crypto() because ERR_load_crypto_strings() has been deprecated in OpenSSL 1.1.0. This call can in principle fail, in which case there's a fallback to generic error strings. There is still use of OpenSSL 3.x-deprecated API in here. That's a problem for someone else to solve. ok djm OpenBSD-Commit-ID: 3e9dc94caa83b361775b83a92425e858f8680c05
60 lines
1.7 KiB
C
60 lines
1.7 KiB
C
/* $OpenBSD: ssherr-libcrypto.c,v 1.2 2026/06/30 03:42:53 tb Exp $ */
|
|
/*
|
|
* Copyright (c) 2026 Darren Tucker
|
|
*
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#include "includes.h"
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
|
|
#include "log.h"
|
|
|
|
#ifdef WITH_OPENSSL
|
|
#include <openssl/err.h>
|
|
|
|
const char *
|
|
ssherr_libcrypto(void)
|
|
{
|
|
unsigned long e;
|
|
static char buf[512];
|
|
char msg[4096];
|
|
const char *reason = NULL, *file, *data;
|
|
int ln, fl;
|
|
|
|
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
|
|
while ((e = ERR_get_error_line_data(&file, &ln, &data, &fl)) != 0) {
|
|
ERR_error_string_n(e, buf, sizeof(buf));
|
|
snprintf(msg, sizeof(msg), "%s:%s:%d:%s", buf, file, ln,
|
|
(fl & ERR_TXT_STRING) ? data : "");
|
|
debug("libcrypto: '%s'", msg);
|
|
if ((reason = ERR_reason_error_string(e)) != NULL)
|
|
snprintf(buf, sizeof(buf), "error in libcrypto: %s",
|
|
reason);
|
|
}
|
|
if (reason == NULL)
|
|
return NULL;
|
|
return buf;
|
|
}
|
|
#else
|
|
const char *
|
|
ssherr_libcrypto(void)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif
|