summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorderaadt <>2019-01-26 11:30:32 +0000
committerderaadt <>2019-01-26 11:30:32 +0000
commit1618a68362353d3601eb0795604f0f319e466550 (patch)
treeddf1007f5651a79307c50ef4c4eec9691ef78723 /src/lib
parenta5c782352212f5764a2c39a67e8a12546d4b2699 (diff)
downloadopenbsd-1618a68362353d3601eb0795604f0f319e466550.tar.gz
openbsd-1618a68362353d3601eb0795604f0f319e466550.tar.bz2
openbsd-1618a68362353d3601eb0795604f0f319e466550.zip
Recent discussions about abort() potentially leaving key material in
core files (which can depend upon various file layouts) have resonated with my hate for this function outside a purely debugging context. I also dislike how the report goes to stderr which may get lost or ignored. Increase the noise (with syslog_r) and use _exit(1) to gaurantee termination. ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/cryptlib.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/libcrypto/cryptlib.c b/src/lib/libcrypto/cryptlib.c
index 5518c66c46..38d31e7ac2 100644
--- a/src/lib/libcrypto/cryptlib.c
+++ b/src/lib/libcrypto/cryptlib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cryptlib.c,v 1.44 2018/11/24 04:11:47 jsing Exp $ */ 1/* $OpenBSD: cryptlib.c,v 1.45 2019/01/26 11:30:32 deraadt Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -118,6 +118,8 @@
118#include <stdarg.h> 118#include <stdarg.h>
119#include <stdio.h> 119#include <stdio.h>
120#include <string.h> 120#include <string.h>
121#include <syslog.h>
122#include <unistd.h>
121 123
122#include <openssl/opensslconf.h> 124#include <openssl/opensslconf.h>
123#include <openssl/crypto.h> 125#include <openssl/crypto.h>
@@ -343,10 +345,11 @@ OPENSSL_cpuid_setup(void)
343static void 345static void
344OPENSSL_showfatal(const char *fmta, ...) 346OPENSSL_showfatal(const char *fmta, ...)
345{ 347{
348 struct syslog_data sdata = SYSLOG_DATA_INIT;
346 va_list ap; 349 va_list ap;
347 350
348 va_start(ap, fmta); 351 va_start(ap, fmta);
349 vfprintf(stderr, fmta, ap); 352 vsyslog_r(LOG_INFO|LOG_LOCAL2, &sdata, fmta, ap);
350 va_end(ap); 353 va_end(ap);
351} 354}
352 355
@@ -354,9 +357,9 @@ void
354OpenSSLDie(const char *file, int line, const char *assertion) 357OpenSSLDie(const char *file, int line, const char *assertion)
355{ 358{
356 OPENSSL_showfatal( 359 OPENSSL_showfatal(
357 "%s(%d): OpenSSL internal error, assertion failed: %s\n", 360 "uid %u cmd %s %s(%d): OpenSSL internal error, assertion failed: %s\n",
358 file, line, assertion); 361 getuid(), getprogname(), file, line, assertion);
359 abort(); 362 _exit(1);
360} 363}
361 364
362int 365int