summaryrefslogtreecommitdiffstats
path: root/crypto/ui
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-02-26 00:17:43 +0100
committerRichard Levitte <levitte@openssl.org>2017-02-26 01:00:26 +0100
commit57d0d048a85d641181ac5aec2792109e15630f96 (patch)
treedc6ef6c24bd11d6900c16a4726d663f0ff0f53f1 /crypto/ui
parentfd910ef9593d4e16dabf4686ecabb351830045b6 (diff)
Add a null UI method
There are cases when, if you pass a NULL UI_METHOD, the called function will use an internal default. This is well and good, but there may be cases when this is undesirable and one would rather send in a UI that does absolutely nothing (sort of a /dev/null). UI_null() is the UI_METHOD for this purpose. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2744)
Diffstat (limited to 'crypto/ui')
-rw-r--r--crypto/ui/build.info2
-rw-r--r--crypto/ui/ui_null.c26
2 files changed, 27 insertions, 1 deletions
diff --git a/crypto/ui/build.info b/crypto/ui/build.info
index fcb45af7eb..c5d17fb744 100644
--- a/crypto/ui/build.info
+++ b/crypto/ui/build.info
@@ -1,3 +1,3 @@
LIBS=../../libcrypto
SOURCE[../../libcrypto]=\
- ui_err.c ui_lib.c ui_openssl.c ui_util.c
+ ui_err.c ui_lib.c ui_openssl.c ui_null.c ui_util.c
diff --git a/crypto/ui/ui_null.c b/crypto/ui/ui_null.c
new file mode 100644
index 0000000000..9e5f6fca59
--- /dev/null
+++ b/crypto/ui/ui_null.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include "ui_locl.h"
+
+static const UI_METHOD ui_null = {
+ "OpenSSL NULL UI",
+ NULL, /* opener */
+ NULL, /* writer */
+ NULL, /* flusher */
+ NULL, /* reader */
+ NULL, /* closer */
+ NULL
+};
+
+/* The method with all the built-in thingies */
+const UI_METHOD *UI_null(void)
+{
+ return &ui_null;
+}