summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/ui
diff options
context:
space:
mode:
authorsimon <simon@FreeBSD.org>2006-07-29 19:10:21 +0000
committersimon <simon@FreeBSD.org>2006-07-29 19:10:21 +0000
commitfb3c70eda88d3175627edc6a3316b4508b3d29c5 (patch)
tree213a0c4d5ba3869f66ecf970819532048fed4a9d /crypto/openssl/crypto/ui
parent3c8d7d9993705e30bc69e55cd19d8a298e582292 (diff)
downloadFreeBSD-src-fb3c70eda88d3175627edc6a3316b4508b3d29c5.zip
FreeBSD-src-fb3c70eda88d3175627edc6a3316b4508b3d29c5.tar.gz
Vendor import of OpenSSL 0.9.8b
Diffstat (limited to 'crypto/openssl/crypto/ui')
-rw-r--r--crypto/openssl/crypto/ui/Makefile40
-rw-r--r--crypto/openssl/crypto/ui/ui.h20
-rw-r--r--crypto/openssl/crypto/ui/ui_err.c48
-rw-r--r--crypto/openssl/crypto/ui/ui_lib.c8
-rw-r--r--crypto/openssl/crypto/ui/ui_locl.h5
-rw-r--r--crypto/openssl/crypto/ui/ui_openssl.c48
-rw-r--r--crypto/openssl/crypto/ui/ui_util.c2
7 files changed, 102 insertions, 69 deletions
diff --git a/crypto/openssl/crypto/ui/Makefile b/crypto/openssl/crypto/ui/Makefile
index 0045931..a685659 100644
--- a/crypto/openssl/crypto/ui/Makefile
+++ b/crypto/openssl/crypto/ui/Makefile
@@ -7,11 +7,6 @@ TOP= ../..
CC= cc
INCLUDES= -I.. -I$(TOP) -I../../include
CFLAG=-g
-INSTALL_PREFIX=
-OPENSSLDIR= /usr/local/ssl
-INSTALLTOP=/usr/local/ssl
-MAKEDEPPROG= makedepend
-MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
MAKEFILE= Makefile
AR= ar r
@@ -55,7 +50,8 @@ links:
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
install:
- @for i in $(EXHEADER) ; \
+ @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
@@ -70,6 +66,7 @@ lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
+ @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
dclean:
@@ -81,35 +78,34 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
-ui_compat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
-ui_compat.o: ../../include/openssl/opensslconf.h
-ui_compat.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
-ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ui_compat.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
-ui_compat.o: ui_compat.c
+ui_compat.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
+ui_compat.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+ui_compat.o: ../../include/openssl/stack.h ../../include/openssl/ui.h
+ui_compat.o: ../../include/openssl/ui_compat.h ui_compat.c
ui_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
ui_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
ui_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
-ui_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ui_err.o: ../../include/openssl/ui.h ui_err.c
+ui_err.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ui_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ui_err.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h ui_err.c
ui_lib.o: ../../e_os.h ../../include/openssl/bio.h
ui_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
ui_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
ui_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
-ui_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-ui_lib.o: ../../include/openssl/ui.h ../cryptlib.h ui_lib.c ui_locl.h
+ui_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+ui_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
+ui_lib.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
+ui_lib.o: ../cryptlib.h ui_lib.c ui_locl.h
ui_openssl.o: ../../e_os.h ../../include/openssl/bio.h
ui_openssl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
ui_openssl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
ui_openssl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
-ui_openssl.o: ../../include/openssl/opensslv.h
+ui_openssl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
ui_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
ui_openssl.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
ui_openssl.o: ../cryptlib.h ui_locl.h ui_openssl.c
ui_util.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
ui_util.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-ui_util.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-ui_util.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h
-ui_util.o: ui_util.c
+ui_util.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
+ui_util.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+ui_util.o: ../../include/openssl/ui.h ui_locl.h ui_util.c
diff --git a/crypto/openssl/crypto/ui/ui.h b/crypto/openssl/crypto/ui/ui.h
index 735a2d9..0182964 100644
--- a/crypto/openssl/crypto/ui/ui.h
+++ b/crypto/openssl/crypto/ui/ui.h
@@ -59,25 +59,19 @@
#ifndef HEADER_UI_H
#define HEADER_UI_H
+#ifndef OPENSSL_NO_DEPRECATED
#include <openssl/crypto.h>
+#endif
#include <openssl/safestack.h>
+#include <openssl/ossl_typ.h>
#ifdef __cplusplus
extern "C" {
#endif
-/* The UI type is a holder for a specific user interface session. It can
- contain an illimited number of informational or error strings as well
- as things to prompt for, both passwords (noecho mode) and others (echo
- mode), and verification of the same. All of these are called strings,
- and are further described below. */
-typedef struct ui_st UI;
-
-/* All instances of UI have a reference to a method structure, which is a
- ordered vector of functions that implement the lower level things to do.
- There is an instruction on the implementation further down, in the section
- for method implementors. */
-typedef struct ui_method_st UI_METHOD;
+/* Declared already in ossl_typ.h */
+/* typedef struct ui_st UI; */
+/* typedef struct ui_method_st UI_METHOD; */
/* All the following functions return -1 or NULL on error and in some cases
@@ -217,7 +211,7 @@ int UI_process(UI *ui);
/* Give a user interface parametrised control commands. This can be used to
send down an integer, a data pointer or a function pointer, as well as
be used to get information from a UI. */
-int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());
+int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
/* The commands */
/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
diff --git a/crypto/openssl/crypto/ui/ui_err.c b/crypto/openssl/crypto/ui/ui_err.c
index 39a62ae..d983cdd 100644
--- a/crypto/openssl/crypto/ui/ui_err.c
+++ b/crypto/openssl/crypto/ui/ui_err.c
@@ -1,6 +1,6 @@
/* crypto/ui/ui_err.c */
/* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,32 +64,36 @@
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
+
+#define ERR_FUNC(func) ERR_PACK(ERR_LIB_UI,func,0)
+#define ERR_REASON(reason) ERR_PACK(ERR_LIB_UI,0,reason)
+
static ERR_STRING_DATA UI_str_functs[]=
{
-{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_BOOLEAN,0), "GENERAL_ALLOCATE_BOOLEAN"},
-{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_PROMPT,0), "GENERAL_ALLOCATE_PROMPT"},
-{ERR_PACK(0,UI_F_GENERAL_ALLOCATE_STRING,0), "GENERAL_ALLOCATE_STRING"},
-{ERR_PACK(0,UI_F_UI_CTRL,0), "UI_ctrl"},
-{ERR_PACK(0,UI_F_UI_DUP_ERROR_STRING,0), "UI_dup_error_string"},
-{ERR_PACK(0,UI_F_UI_DUP_INFO_STRING,0), "UI_dup_info_string"},
-{ERR_PACK(0,UI_F_UI_DUP_INPUT_BOOLEAN,0), "UI_dup_input_boolean"},
-{ERR_PACK(0,UI_F_UI_DUP_INPUT_STRING,0), "UI_dup_input_string"},
-{ERR_PACK(0,UI_F_UI_DUP_VERIFY_STRING,0), "UI_dup_verify_string"},
-{ERR_PACK(0,UI_F_UI_GET0_RESULT,0), "UI_get0_result"},
-{ERR_PACK(0,UI_F_UI_NEW_METHOD,0), "UI_new_method"},
-{ERR_PACK(0,UI_F_UI_SET_RESULT,0), "UI_set_result"},
+{ERR_FUNC(UI_F_GENERAL_ALLOCATE_BOOLEAN), "GENERAL_ALLOCATE_BOOLEAN"},
+{ERR_FUNC(UI_F_GENERAL_ALLOCATE_PROMPT), "GENERAL_ALLOCATE_PROMPT"},
+{ERR_FUNC(UI_F_GENERAL_ALLOCATE_STRING), "GENERAL_ALLOCATE_STRING"},
+{ERR_FUNC(UI_F_UI_CTRL), "UI_ctrl"},
+{ERR_FUNC(UI_F_UI_DUP_ERROR_STRING), "UI_dup_error_string"},
+{ERR_FUNC(UI_F_UI_DUP_INFO_STRING), "UI_dup_info_string"},
+{ERR_FUNC(UI_F_UI_DUP_INPUT_BOOLEAN), "UI_dup_input_boolean"},
+{ERR_FUNC(UI_F_UI_DUP_INPUT_STRING), "UI_dup_input_string"},
+{ERR_FUNC(UI_F_UI_DUP_VERIFY_STRING), "UI_dup_verify_string"},
+{ERR_FUNC(UI_F_UI_GET0_RESULT), "UI_get0_result"},
+{ERR_FUNC(UI_F_UI_NEW_METHOD), "UI_new_method"},
+{ERR_FUNC(UI_F_UI_SET_RESULT), "UI_set_result"},
{0,NULL}
};
static ERR_STRING_DATA UI_str_reasons[]=
{
-{UI_R_COMMON_OK_AND_CANCEL_CHARACTERS ,"common ok and cancel characters"},
-{UI_R_INDEX_TOO_LARGE ,"index too large"},
-{UI_R_INDEX_TOO_SMALL ,"index too small"},
-{UI_R_NO_RESULT_BUFFER ,"no result buffer"},
-{UI_R_RESULT_TOO_LARGE ,"result too large"},
-{UI_R_RESULT_TOO_SMALL ,"result too small"},
-{UI_R_UNKNOWN_CONTROL_COMMAND ,"unknown control command"},
+{ERR_REASON(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS),"common ok and cancel characters"},
+{ERR_REASON(UI_R_INDEX_TOO_LARGE) ,"index too large"},
+{ERR_REASON(UI_R_INDEX_TOO_SMALL) ,"index too small"},
+{ERR_REASON(UI_R_NO_RESULT_BUFFER) ,"no result buffer"},
+{ERR_REASON(UI_R_RESULT_TOO_LARGE) ,"result too large"},
+{ERR_REASON(UI_R_RESULT_TOO_SMALL) ,"result too small"},
+{ERR_REASON(UI_R_UNKNOWN_CONTROL_COMMAND),"unknown control command"},
{0,NULL}
};
@@ -103,8 +107,8 @@ void ERR_load_UI_strings(void)
{
init=0;
#ifndef OPENSSL_NO_ERR
- ERR_load_strings(ERR_LIB_UI,UI_str_functs);
- ERR_load_strings(ERR_LIB_UI,UI_str_reasons);
+ ERR_load_strings(0,UI_str_functs);
+ ERR_load_strings(0,UI_str_reasons);
#endif
}
diff --git a/crypto/openssl/crypto/ui/ui_lib.c b/crypto/openssl/crypto/ui/ui_lib.c
index dbc9711..7ab249c 100644
--- a/crypto/openssl/crypto/ui/ui_lib.c
+++ b/crypto/openssl/crypto/ui/ui_lib.c
@@ -57,12 +57,12 @@
*/
#include <string.h>
+#include "cryptlib.h"
#include <openssl/e_os2.h>
#include <openssl/buffer.h>
#include <openssl/ui.h>
#include <openssl/err.h>
#include "ui_locl.h"
-#include "cryptlib.h"
IMPLEMENT_STACK_OF(UI_STRING_ST)
@@ -545,7 +545,7 @@ int UI_process(UI *ui)
return ok;
}
-int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)())
+int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void))
{
if (ui == NULL)
{
@@ -620,8 +620,10 @@ UI_METHOD *UI_create_method(char *name)
UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD));
if (ui_method)
+ {
memset(ui_method, 0, sizeof(*ui_method));
- ui_method->name = BUF_strdup(name);
+ ui_method->name = BUF_strdup(name);
+ }
return ui_method;
}
diff --git a/crypto/openssl/crypto/ui/ui_locl.h b/crypto/openssl/crypto/ui/ui_locl.h
index 7d3a75a..aa4a556 100644
--- a/crypto/openssl/crypto/ui/ui_locl.h
+++ b/crypto/openssl/crypto/ui/ui_locl.h
@@ -60,6 +60,11 @@
#define HEADER_UI_LOCL_H
#include <openssl/ui.h>
+#include <openssl/crypto.h>
+
+#ifdef _
+#undef _
+#endif
struct ui_method_st
{
diff --git a/crypto/openssl/crypto/ui/ui_openssl.c b/crypto/openssl/crypto/ui/ui_openssl.c
index 75318d4..1f23a45 100644
--- a/crypto/openssl/crypto/ui/ui_openssl.c
+++ b/crypto/openssl/crypto/ui/ui_openssl.c
@@ -117,6 +117,17 @@
#include <openssl/e_os2.h>
+/* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc
+ * [maybe others?], because it masks interfaces not discussed in standard,
+ * sigaction and fileno included. -pedantic would be more appropriate for
+ * the intended purposes, but we can't prevent users from adding -ansi.
+ */
+#define _POSIX_C_SOURCE 1
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
#if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS)
# ifdef OPENSSL_UNISTD
# include OPENSSL_UNISTD
@@ -145,10 +156,6 @@
/* 06-Apr-92 Luke Brennan Support for VMS */
#include "ui_locl.h"
#include "cryptlib.h"
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
#ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */
# include <starlet.h>
@@ -199,6 +206,12 @@
#undef SGTTY
#endif
+#if defined(OPENSSL_SYS_NETWARE)
+#undef TERMIOS
+#undef TERMIO
+#undef SGTTY
+#endif
+
#ifdef TERMIOS
# include <termios.h>
# define TTY_STRUCT struct termios
@@ -247,7 +260,7 @@ struct IOSB {
typedef int sig_atomic_t;
#endif
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) || defined(OPENSSL_SYS_NETWARE)
/*
* This one needs work. As a matter of fact the code is unoperational
* and this is only a trick to get it compiled.
@@ -460,7 +473,7 @@ static int open_console(UI *ui)
CRYPTO_w_lock(CRYPTO_LOCK_UI);
is_a_tty = 1;
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)
tty_in=stdin;
tty_out=stderr;
#else
@@ -476,7 +489,7 @@ static int open_console(UI *ui)
#endif
#if defined(TTY_get) && !defined(OPENSSL_SYS_VMS)
- if (TTY_get(fileno(tty_in),&tty_orig) == -1)
+ if (TTY_get(fileno(tty_in),&tty_orig) == -1)
{
#ifdef ENOTTY
if (errno == ENOTTY)
@@ -565,7 +578,9 @@ static int close_console(UI *ui)
/* Internal functions to handle signals and act on them */
static void pushsig(void)
{
+#ifndef OPENSSL_SYS_WIN32
int i;
+#endif
#ifdef SIGACTION
struct sigaction sa;
@@ -573,6 +588,14 @@ static void pushsig(void)
sa.sa_handler=recsig;
#endif
+#ifdef OPENSSL_SYS_WIN32
+ savsig[SIGABRT]=signal(SIGABRT,recsig);
+ savsig[SIGFPE]=signal(SIGFPE,recsig);
+ savsig[SIGILL]=signal(SIGILL,recsig);
+ savsig[SIGINT]=signal(SIGINT,recsig);
+ savsig[SIGSEGV]=signal(SIGSEGV,recsig);
+ savsig[SIGTERM]=signal(SIGTERM,recsig);
+#else
for (i=1; i<NX509_SIG; i++)
{
#ifdef SIGUSR1
@@ -593,6 +616,7 @@ static void pushsig(void)
savsig[i]=signal(i,recsig);
#endif
}
+#endif
#ifdef SIGWINCH
signal(SIGWINCH,SIG_DFL);
@@ -601,8 +625,15 @@ static void pushsig(void)
static void popsig(void)
{
+#ifdef OPENSSL_SYS_WIN32
+ signal(SIGABRT,savsig[SIGABRT]);
+ signal(SIGFPE,savsig[SIGFPE]);
+ signal(SIGILL,savsig[SIGILL]);
+ signal(SIGINT,savsig[SIGINT]);
+ signal(SIGSEGV,savsig[SIGSEGV]);
+ signal(SIGTERM,savsig[SIGTERM]);
+#else
int i;
-
for (i=1; i<NX509_SIG; i++)
{
#ifdef SIGUSR1
@@ -619,6 +650,7 @@ static void popsig(void)
signal(i,savsig[i]);
#endif
}
+#endif
}
static void recsig(int i)
diff --git a/crypto/openssl/crypto/ui/ui_util.c b/crypto/openssl/crypto/ui/ui_util.c
index 46bc8c1..5d9760b 100644
--- a/crypto/openssl/crypto/ui/ui_util.c
+++ b/crypto/openssl/crypto/ui/ui_util.c
@@ -54,7 +54,7 @@
*/
#include <string.h>
-#include <openssl/ui.h>
+#include "ui_locl.h"
int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify)
{
OpenPOWER on IntegriCloud