summaryrefslogtreecommitdiff
path: root/Cryptlib/OpenSSL/crypto/err/err_prn.c
diff options
context:
space:
mode:
authorGary Ching-Pang Lin <glin@suse.com>2015-07-13 11:58:44 +0800
committerPeter Jones <pjones@redhat.com>2015-07-28 11:46:38 -0400
commit4ac84f8673eb7f3e5b98226aabe21f3e3111c7db (patch)
tree2fb3d9dd667c772fae5f87fa61e1501cf12da0ce /Cryptlib/OpenSSL/crypto/err/err_prn.c
parentdb142ce288a63db2e8f7858ba7564158cc7a64e5 (diff)
downloadefi-boot-shim-4ac84f8673eb7f3e5b98226aabe21f3e3111c7db.tar.gz
efi-boot-shim-4ac84f8673eb7f3e5b98226aabe21f3e3111c7db.zip
Update openssl to 1.0.2d
Also update Cryptlib to edk2 r17731 Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/err/err_prn.c')
-rw-r--r--Cryptlib/OpenSSL/crypto/err/err_prn.c67
1 files changed, 7 insertions, 60 deletions
diff --git a/Cryptlib/OpenSSL/crypto/err/err_prn.c b/Cryptlib/OpenSSL/crypto/err/err_prn.c
index 060853a2..6e352eff 100644
--- a/Cryptlib/OpenSSL/crypto/err/err_prn.c
+++ b/Cryptlib/OpenSSL/crypto/err/err_prn.c
@@ -72,8 +72,10 @@ void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
const char *file, *data;
int line, flags;
unsigned long es;
+ CRYPTO_THREADID cur;
- es = CRYPTO_thread_id();
+ CRYPTO_THREADID_current(&cur);
+ es = CRYPTO_THREADID_hash(&cur);
while ((l = ERR_get_error_line_data(&file, &line, &data, &flags)) != 0) {
ERR_error_string_n(l, buf, sizeof buf);
BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf,
@@ -100,67 +102,12 @@ void ERR_print_errors_fp(FILE *fp)
}
#endif
-void ERR_error_string_n(unsigned long e, char *buf, size_t len)
+static int print_bio(const char *str, size_t len, void *bp)
{
- char lsbuf[64], fsbuf[64], rsbuf[64];
- const char *ls, *fs, *rs;
- unsigned long l, f, r;
-
- l = ERR_GET_LIB(e);
- f = ERR_GET_FUNC(e);
- r = ERR_GET_REASON(e);
-
- ls = ERR_lib_error_string(e);
- fs = ERR_func_error_string(e);
- rs = ERR_reason_error_string(e);
-
- if (ls == NULL)
- BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
- if (fs == NULL)
- BIO_snprintf(fsbuf, sizeof(fsbuf), "func(%lu)", f);
- if (rs == NULL)
- BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", r);
-
- BIO_snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls ? ls : lsbuf,
- fs ? fs : fsbuf, rs ? rs : rsbuf);
- if (strlen(buf) == len - 1) {
- /*
- * output may be truncated; make sure we always have 5
- * colon-separated fields, i.e. 4 colons ...
- */
-#define NUM_COLONS 4
- if (len > NUM_COLONS) { /* ... if possible */
- int i;
- char *s = buf;
-
- for (i = 0; i < NUM_COLONS; i++) {
- char *colon = strchr(s, ':');
- if (colon == NULL || colon > &buf[len - 1] - NUM_COLONS + i) {
- /*
- * set colon no. i at last possible position (buf[len-1]
- * is the terminating 0)
- */
- colon = &buf[len - 1] - NUM_COLONS + i;
- *colon = ':';
- }
- s = colon + 1;
- }
- }
- }
+ return BIO_write((BIO *)bp, str, len);
}
-/* BAD for multi-threading: uses a local buffer if ret == NULL */
-/*
- * ERR_error_string_n should be used instead for ret != NULL as
- * ERR_error_string cannot know how large the buffer is
- */
-char *ERR_error_string(unsigned long e, char *ret)
+void ERR_print_errors(BIO *bp)
{
- static char buf[256];
-
- if (ret == NULL)
- ret = buf;
- ERR_error_string_n(e, ret, 256);
-
- return ret;
+ ERR_print_errors_cb(print_bio, bp);
}