summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorbeck <>2017-02-20 23:21:19 +0000
committerbeck <>2017-02-20 23:21:19 +0000
commit0179324cb8e49724e624c4a6c35de46c975416d4 (patch)
tree72f034bdca67cf5c4c20f03eb985bcaf9e3f89ef /src/lib
parent6cb36c9d835e1348d93099b63bcdaf2a02c38532 (diff)
downloadopenbsd-0179324cb8e49724e624c4a6c35de46c975416d4.tar.gz
openbsd-0179324cb8e49724e624c4a6c35de46c975416d4.tar.bz2
openbsd-0179324cb8e49724e624c4a6c35de46c975416d4.zip
Mark ERR_add_error_data and ERR_add_error_vdata as not for internal use,
and document ERR_asprintf_error_data as their replacement. ok jsing@, ingo@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/err/err.c19
-rw-r--r--src/lib/libcrypto/err/err.h4
-rw-r--r--src/lib/libcrypto/man/ERR_asprintf_error_data.355
-rw-r--r--src/lib/libcrypto/man/ERR_put_error.314
-rw-r--r--src/lib/libcrypto/man/Makefile3
5 files changed, 81 insertions, 14 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 1b235c1653..ffe25bf465 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.c,v 1.44 2017/02/07 15:52:33 jsing Exp $ */ 1/* $OpenBSD: err.c,v 1.45 2017/02/20 23:21:19 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1092,14 +1092,6 @@ ERR_asprintf_error_data(char * format, ...) {
1092 else 1092 else
1093 ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING); 1093 ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING);
1094} 1094}
1095void
1096ERR_add_error_data(int num, ...)
1097{
1098 va_list args;
1099 va_start(args, num);
1100 ERR_add_error_vdata(num, args);
1101 va_end(args);
1102}
1103 1095
1104void 1096void
1105ERR_add_error_vdata(int num, va_list args) 1097ERR_add_error_vdata(int num, va_list args)
@@ -1121,6 +1113,15 @@ ERR_add_error_vdata(int num, va_list args)
1121 ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING); 1113 ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING);
1122} 1114}
1123 1115
1116void
1117ERR_add_error_data(int num, ...)
1118{
1119 va_list args;
1120 va_start(args, num);
1121 ERR_add_error_vdata(num, args);
1122 va_end(args);
1123}
1124
1124int 1125int
1125ERR_set_mark(void) 1126ERR_set_mark(void)
1126{ 1127{
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index 672dead06b..22cdb2987f 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: err.h,v 1.24 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: err.h,v 1.25 2017/02/20 23:21:19 beck Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -378,8 +378,10 @@ void ERR_print_errors_fp(FILE *fp);
378void ERR_print_errors(BIO *bp); 378void ERR_print_errors(BIO *bp);
379#endif 379#endif
380void ERR_asprintf_error_data(char * format, ...); 380void ERR_asprintf_error_data(char * format, ...);
381#ifndef LIBRESSL_INTERNAL
381void ERR_add_error_data(int num, ...); 382void ERR_add_error_data(int num, ...);
382void ERR_add_error_vdata(int num, va_list args); 383void ERR_add_error_vdata(int num, va_list args);
384#endif
383void ERR_load_strings(int lib, ERR_STRING_DATA str[]); 385void ERR_load_strings(int lib, ERR_STRING_DATA str[]);
384void ERR_unload_strings(int lib, ERR_STRING_DATA str[]); 386void ERR_unload_strings(int lib, ERR_STRING_DATA str[]);
385void ERR_load_ERR_strings(void); 387void ERR_load_ERR_strings(void);
diff --git a/src/lib/libcrypto/man/ERR_asprintf_error_data.3 b/src/lib/libcrypto/man/ERR_asprintf_error_data.3
new file mode 100644
index 0000000000..6481da4750
--- /dev/null
+++ b/src/lib/libcrypto/man/ERR_asprintf_error_data.3
@@ -0,0 +1,55 @@
1.\" $OpenBSD: ERR_asprintf_error_data.3,v 1.1 2017/02/20 23:21:19 beck Exp $
2.\"
3.\" Copyright (c) 2017 Bob Beck <beck@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.Dd $Mdocdate: February 20 2017 $
17.Dt ERR_ASPRINTF_ERROR_DATA 3
18.Os
19.Sh NAME
20.Nm ERR_asprintf_error_data
21.Nd record a LibreSSL error using a formatted string.
22.Sh SYNOPSIS
23.In openssl/err.h
24.Ft void
25.Fo ERR_asprintf_error_data
26.Fa "char * format"
27.Fa ...
28.Fc
29.Sh DESCRIPTION
30.Nm
31builds a string using
32.Xr asprintf 3
33called with the provided
34.Ar format
35and arguments.
36The resulting string is then associated with the error code that was most
37recently added.
38If
39.Xr asprintf 3
40fails, the string "malloc failed" is associated instead.
41.Pp
42.Nm
43is intended to be used instead of the OpenSSL functions
44.Xr ERR_add_error_data 3
45and
46.Xr ERR_add_error_vdata 3 .
47.Sh SEE ALSO
48.Xr ERR 3 ,
49.Xr ERR_put_error 3 ,
50.Xr printf 3
51.Sh HISTORY
52.Nm
53appeared in
54.Ox 5.6
55and is available in all versions of LibreSSL.
diff --git a/src/lib/libcrypto/man/ERR_put_error.3 b/src/lib/libcrypto/man/ERR_put_error.3
index 2b41bedea3..3011e16df4 100644
--- a/src/lib/libcrypto/man/ERR_put_error.3
+++ b/src/lib/libcrypto/man/ERR_put_error.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ERR_put_error.3,v 1.4 2016/11/23 17:54:15 schwarze Exp $ 1.\" $OpenBSD: ERR_put_error.3,v 1.5 2017/02/20 23:21:19 beck Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3.\" 3.\"
4.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>.
@@ -48,12 +48,13 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: November 23 2016 $ 51.Dd $Mdocdate: February 20 2017 $
52.Dt ERR_PUT_ERROR 3 52.Dt ERR_PUT_ERROR 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm ERR_put_error , 55.Nm ERR_put_error ,
56.Nm ERR_add_error_data 56.Nm ERR_add_error_data ,
57.Nm ERR_add_error_vdata
57.Nd record an OpenSSL error 58.Nd record an OpenSSL error
58.Sh SYNOPSIS 59.Sh SYNOPSIS
59.In openssl/err.h 60.In openssl/err.h
@@ -97,6 +98,12 @@ string arguments with the error code added last.
97.Fn ERR_add_error_vdata 98.Fn ERR_add_error_vdata
98is similar except the argument is a 99is similar except the argument is a
99.Vt va_list . 100.Vt va_list .
101Use of
102.Fn ERR_add_error_data
103and
104.Fn ERR_add_error_vdata
105is deprecated inside of LibreSSL in favour of
106.Xr ERR_asprintf_error_data 3 .
100.Pp 107.Pp
101.Xr ERR_load_strings 3 108.Xr ERR_load_strings 3
102can be used to register error strings so that the application can 109can be used to register error strings so that the application can
@@ -136,6 +143,7 @@ which must use the
136macro. 143macro.
137.Sh SEE ALSO 144.Sh SEE ALSO
138.Xr ERR 3 , 145.Xr ERR 3 ,
146.Xr ERR_asprintf_error_data 3 ,
139.Xr ERR_load_strings 3 147.Xr ERR_load_strings 3
140.Sh HISTORY 148.Sh HISTORY
141.Fn ERR_put_error 149.Fn ERR_put_error
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 9a64837d31..75239dc387 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.114 2017/01/31 05:40:26 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.115 2017/02/20 23:21:19 beck Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -92,6 +92,7 @@ MAN= \
92 EC_POINT_new.3 \ 92 EC_POINT_new.3 \
93 ERR.3 \ 93 ERR.3 \
94 ERR_GET_LIB.3 \ 94 ERR_GET_LIB.3 \
95 ERR_asprintf_error_data.3 \
95 ERR_clear_error.3 \ 96 ERR_clear_error.3 \
96 ERR_error_string.3 \ 97 ERR_error_string.3 \
97 ERR_get_error.3 \ 98 ERR_get_error.3 \