2 openssl.h -- Emacs Lisp binding to OpenSSL ciphers and digests
3 Copyright (C) 2005 Sebastian Freundt
5 Author: Sebastian Freundt <hroptatyr@sxemacs.org>
7 This file is part of SXEmacs
9 SXEmacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 SXEmacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #ifndef INCLUDED_openssl_h_
24 #define INCLUDED_openssl_h_ 1
26 /* this is to determine what has been configured */
27 #ifdef HAVE_OPENSSL_OPENSSLCONF_H
28 #include <openssl/opensslconf.h>
31 #ifdef HAVE_OPENSSL_EVP_H
32 #include <openssl/evp.h>
35 #ifdef HAVE_OPENSSL_RAND_H
36 #include <openssl/rand.h>
39 #ifdef HAVE_OPENSSL_HMAC_H
40 #include <openssl/hmac.h>
43 /* special asymmetric crypto systems */
44 #ifdef HAVE_OPENSSL_RSA_H
45 #ifndef OPENSSL_NO_RSA
46 #include <openssl/rsa.h>
50 #ifdef HAVE_OPENSSL_DSA_H
51 #ifndef OPENSSL_NO_DSA
52 #include <openssl/dsa.h>
56 #ifdef HAVE_OPENSSL_EC_H
58 #include <openssl/ec.h>
62 #ifdef HAVE_OPENSSL_ECDH_H
63 #ifndef OPENSSL_NO_ECDH
64 #include <openssl/ecdh.h>
68 #ifdef HAVE_OPENSSL_ECDSA_H
69 #ifndef OPENSSL_NO_ECDSA
70 #include <openssl/ecdsa.h>
74 #ifdef HAVE_OPENSSL_DH
76 #include <openssl/dh.h>
80 #if defined HAVE_OPENSSL_X509_H
81 # include <openssl/x509.h>
83 #if defined HAVE_OPENSSL_PEM_H
84 # include <openssl/pem.h>
86 #if defined HAVE_OPENSSL_SSL_H
87 # include <openssl/ssl.h>
89 #if defined HAVE_OPENSSL_BIO_H
90 # include <openssl/bio.h>
93 /* opaque EVP_PKEY object structure */
94 struct Lisp_EVP_PKEY {
95 struct lcrecord_header header;
99 typedef struct Lisp_EVP_PKEY Lisp_EVP_PKEY;
101 DECLARE_LRECORD(evp_pkey, Lisp_EVP_PKEY);
103 #define XEVPPKEY(x) XRECORD (x, evp_pkey, Lisp_EVP_PKEY)
104 #define XSETEVPPKEY(x, p) XSETRECORD (x, p, evp_pkey)
105 #define EVPPKEYP(x) RECORDP (x, evp_pkey)
106 #define CHECK_EVPPKEY(x) CHECK_RECORD (x, evp_pkey)
107 #define wrap_evppkey(p) wrap_object(p)
109 /* opaque SSL_CONN object structure
110 * this is just an ssl-ish wrap around the process object
112 struct Lisp_SSL_CONN {
113 struct lcrecord_header header;
114 SSL_METHOD *ssl_meth;
123 /* Low level streams used in input and output,
124 backup streams if network stream is proselytised */
125 Lisp_Object pipe_instream;
126 Lisp_Object pipe_outstream;
128 /* Data end streams, decoding and encoding pipe_* streams */
129 Lisp_Object coding_instream;
130 Lisp_Object coding_outstream;
131 #endif /* FILE_CODING */
133 typedef struct Lisp_SSL_CONN Lisp_SSL_CONN;
135 Lisp_Object make_ssl_conn(Lisp_SSL_CONN *ssl_conn);
136 Lisp_SSL_CONN *allocate_ssl_conn(void);
137 void finalize_ssl_conn(void *header, int for_disksave);
138 Lisp_Object ossl_ssl_handshake(Lisp_Object, Lisp_Object);
140 extern Lisp_Object make_ssl_input_stream(SSL*, int);
141 extern Lisp_Object make_ssl_output_stream(SSL*, int);
142 EXFUN(Fset_process_coding_system, 3);
143 extern void ssl_verify_cert_chain(SSL*, void*);
145 DECLARE_LRECORD(ssl_conn, Lisp_SSL_CONN);
147 #define XSSLCONN(x) XRECORD (x, ssl_conn, Lisp_SSL_CONN)
148 #define XSETSSLCONN(x, p) XSETRECORD (x, p, ssl_conn)
149 #define SSLCONNP(x) RECORDP (x, ssl_conn)
150 #define CHECK_SSLCONN(x) CHECK_RECORD (x, ssl_conn)
151 #define wrap_sslconn(p) wrap_object(p)
153 #ifdef ALL_DEBUG_FLAGS
154 #undef OSSL_DEBUG_FLAG
155 #define OSSL_DEBUG_FLAG
158 #endif /* INCLUDED_openssl_h_ */