Skip to content

Latest commit

 

History

History
67 lines (59 loc) · 1.97 KB

ssl_ui.c

File metadata and controls

67 lines (59 loc) · 1.97 KB
 
1
/*
Nov 20, 2008
Nov 20, 2008
2
* OpenConnect (SSL + DTLS) VPN client
3
*
Jan 1, 2010
Jan 1, 2010
4
* Copyright © 2008-2010 Intel Corporation.
5
*
Nov 20, 2008
Nov 20, 2008
6
7
8
* Author: David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public License
Nov 20, 2008
Nov 20, 2008
10
* version 2.1, as published by the Free Software Foundation.
11
*
Nov 20, 2008
Nov 20, 2008
12
* This program is distributed in the hope that it will be useful, but
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to:
*
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include <openssl/ssl.h>
#include <openssl/ui.h>
/* OpenSSL UI method calls. These are just stubs, to show how it's done */
/* While we can set user data on the calls from the TPM setup, we can't
set it on the calls for PEM certificate passphrases, AFAICT. */
static int ui_open(UI *ui)
{
/* Fall through to default OpenSSL UI */
return UI_method_get_opener(UI_OpenSSL())(ui);
}
static int ui_read(UI *ui, UI_STRING *uis)
{
/* Fall through to default OpenSSL UI */
return UI_method_get_reader(UI_OpenSSL())(ui, uis);
}
static int ui_write(UI *ui, UI_STRING *uis)
{
/* Fall through to default OpenSSL UI */
return UI_method_get_writer(UI_OpenSSL())(ui, uis);
}
static int ui_close(UI *ui)
{
/* Fall through to default OpenSSL UI */
return UI_method_get_closer(UI_OpenSSL())(ui);
}
int set_openssl_ui(void)
{
UI_METHOD *ui_method = UI_create_method("AnyConnect VPN UI");
/* Set up a UI method of our own for password/passphrase requests */
UI_method_set_opener(ui_method, ui_open);
UI_method_set_reader(ui_method, ui_read);
UI_method_set_writer(ui_method, ui_write);
UI_method_set_closer(ui_method, ui_close);
UI_set_default_method(ui_method);
return 0;
}