williamr@2
|
1 |
/* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */
|
williamr@2
|
2 |
/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project 2000.
|
williamr@2
|
3 |
* project 2000.
|
williamr@2
|
4 |
*/
|
williamr@2
|
5 |
/* ====================================================================
|
williamr@2
|
6 |
* Copyright (c) 2000 The OpenSSL Project. All rights reserved.
|
williamr@2
|
7 |
*
|
williamr@2
|
8 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
9 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
10 |
* are met:
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* 1. Redistributions of source code must retain the above copyright
|
williamr@2
|
13 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
14 |
*
|
williamr@2
|
15 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
16 |
* notice, this list of conditions and the following disclaimer in
|
williamr@2
|
17 |
* the documentation and/or other materials provided with the
|
williamr@2
|
18 |
* distribution.
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
* 3. All advertising materials mentioning features or use of this
|
williamr@2
|
21 |
* software must display the following acknowledgment:
|
williamr@2
|
22 |
* "This product includes software developed by the OpenSSL Project
|
williamr@2
|
23 |
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
williamr@2
|
24 |
*
|
williamr@2
|
25 |
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
williamr@2
|
26 |
* endorse or promote products derived from this software without
|
williamr@2
|
27 |
* prior written permission. For written permission, please contact
|
williamr@2
|
28 |
* licensing@OpenSSL.org.
|
williamr@2
|
29 |
*
|
williamr@2
|
30 |
* 5. Products derived from this software may not be called "OpenSSL"
|
williamr@2
|
31 |
* nor may "OpenSSL" appear in their names without prior written
|
williamr@2
|
32 |
* permission of the OpenSSL Project.
|
williamr@2
|
33 |
*
|
williamr@2
|
34 |
* 6. Redistributions of any form whatsoever must retain the following
|
williamr@2
|
35 |
* acknowledgment:
|
williamr@2
|
36 |
* "This product includes software developed by the OpenSSL Project
|
williamr@2
|
37 |
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
williamr@2
|
38 |
*
|
williamr@2
|
39 |
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
williamr@2
|
40 |
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
41 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
williamr@2
|
42 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
williamr@2
|
43 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
williamr@2
|
44 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
williamr@2
|
45 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
williamr@2
|
46 |
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
47 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
williamr@2
|
48 |
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
williamr@2
|
49 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
williamr@2
|
50 |
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
williamr@2
|
51 |
* ====================================================================
|
williamr@2
|
52 |
*
|
williamr@2
|
53 |
* This product includes cryptographic software written by Eric Young
|
williamr@2
|
54 |
* (eay@cryptsoft.com). This product includes software written by Tim
|
williamr@2
|
55 |
* Hudson (tjh@cryptsoft.com).
|
williamr@2
|
56 |
*
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/*
|
williamr@2
|
60 |
** 19990701 VRS Started.
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
|
williamr@2
|
63 |
#ifndef KSSL_H
|
williamr@2
|
64 |
#define KSSL_H
|
williamr@2
|
65 |
|
williamr@2
|
66 |
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
|
williamr@2
|
67 |
#define SYMBIAN
|
williamr@2
|
68 |
#endif
|
williamr@2
|
69 |
|
williamr@2
|
70 |
|
williamr@2
|
71 |
#include <openssl/opensslconf.h>
|
williamr@2
|
72 |
|
williamr@2
|
73 |
#ifndef OPENSSL_NO_KRB5
|
williamr@2
|
74 |
|
williamr@2
|
75 |
#include <stdio.h>
|
williamr@2
|
76 |
#include <ctype.h>
|
williamr@2
|
77 |
#include <krb5.h>
|
williamr@2
|
78 |
|
williamr@2
|
79 |
#ifdef __cplusplus
|
williamr@2
|
80 |
extern "C" {
|
williamr@2
|
81 |
#endif
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/*
|
williamr@2
|
84 |
** Depending on which KRB5 implementation used, some types from
|
williamr@2
|
85 |
** the other may be missing. Resolve that here and now
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
#ifdef KRB5_HEIMDAL
|
williamr@2
|
88 |
typedef unsigned char krb5_octet;
|
williamr@2
|
89 |
#define FAR
|
williamr@2
|
90 |
#else
|
williamr@2
|
91 |
|
williamr@2
|
92 |
#ifndef FAR
|
williamr@2
|
93 |
#define FAR
|
williamr@2
|
94 |
#endif
|
williamr@2
|
95 |
|
williamr@2
|
96 |
#endif
|
williamr@2
|
97 |
|
williamr@2
|
98 |
/* Uncomment this to debug kssl problems or
|
williamr@2
|
99 |
** to trace usage of the Kerberos session key
|
williamr@2
|
100 |
**
|
williamr@2
|
101 |
** #define KSSL_DEBUG
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
|
williamr@2
|
104 |
#ifndef KRB5SVC
|
williamr@2
|
105 |
#define KRB5SVC "host"
|
williamr@2
|
106 |
#endif
|
williamr@2
|
107 |
|
williamr@2
|
108 |
#ifndef KRB5KEYTAB
|
williamr@2
|
109 |
#define KRB5KEYTAB "/etc/krb5.keytab"
|
williamr@2
|
110 |
#endif
|
williamr@2
|
111 |
|
williamr@2
|
112 |
#ifndef KRB5SENDAUTH
|
williamr@2
|
113 |
#define KRB5SENDAUTH 1
|
williamr@2
|
114 |
#endif
|
williamr@2
|
115 |
|
williamr@2
|
116 |
#ifndef KRB5CHECKAUTH
|
williamr@2
|
117 |
#define KRB5CHECKAUTH 1
|
williamr@2
|
118 |
#endif
|
williamr@2
|
119 |
|
williamr@2
|
120 |
#ifndef KSSL_CLOCKSKEW
|
williamr@2
|
121 |
#define KSSL_CLOCKSKEW 300;
|
williamr@2
|
122 |
#endif
|
williamr@2
|
123 |
|
williamr@2
|
124 |
#define KSSL_ERR_MAX 255
|
williamr@2
|
125 |
typedef struct kssl_err_st {
|
williamr@2
|
126 |
int reason;
|
williamr@2
|
127 |
char text[KSSL_ERR_MAX+1];
|
williamr@2
|
128 |
} KSSL_ERR;
|
williamr@2
|
129 |
|
williamr@2
|
130 |
|
williamr@2
|
131 |
/* Context for passing
|
williamr@2
|
132 |
** (1) Kerberos session key to SSL, and
|
williamr@2
|
133 |
** (2) Config data between application and SSL lib
|
williamr@2
|
134 |
*/
|
williamr@2
|
135 |
typedef struct kssl_ctx_st
|
williamr@2
|
136 |
{
|
williamr@2
|
137 |
/* used by: disposition: */
|
williamr@2
|
138 |
char *service_name; /* C,S default ok (kssl) */
|
williamr@2
|
139 |
char *service_host; /* C input, REQUIRED */
|
williamr@2
|
140 |
char *client_princ; /* S output from krb5 ticket */
|
williamr@2
|
141 |
char *keytab_file; /* S NULL (/etc/krb5.keytab) */
|
williamr@2
|
142 |
char *cred_cache; /* C NULL (default) */
|
williamr@2
|
143 |
krb5_enctype enctype;
|
williamr@2
|
144 |
int length;
|
williamr@2
|
145 |
krb5_octet FAR *key;
|
williamr@2
|
146 |
} KSSL_CTX;
|
williamr@2
|
147 |
|
williamr@2
|
148 |
#define KSSL_CLIENT 1
|
williamr@2
|
149 |
#define KSSL_SERVER 2
|
williamr@2
|
150 |
#define KSSL_SERVICE 3
|
williamr@2
|
151 |
#define KSSL_KEYTAB 4
|
williamr@2
|
152 |
|
williamr@2
|
153 |
#define KSSL_CTX_OK 0
|
williamr@2
|
154 |
#define KSSL_CTX_ERR 1
|
williamr@2
|
155 |
#define KSSL_NOMEM 2
|
williamr@2
|
156 |
|
williamr@2
|
157 |
#ifdef __cplusplus
|
williamr@2
|
158 |
}
|
williamr@2
|
159 |
#endif
|
williamr@2
|
160 |
#endif /* OPENSSL_NO_KRB5 */
|
williamr@2
|
161 |
#endif /* KSSL_H */
|