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 #include <openssl/opensslconf.h>
29 #include <openssl/evp.h>
30 #include <openssl/rand.h>
31 #include <openssl/hmac.h>
33 /* special asymmetric crypto systems */
34 #ifndef OPENSSL_NO_RSA
35 #include <openssl/rsa.h>
38 #ifndef OPENSSL_NO_DSA
39 #include <openssl/dsa.h>
43 #include <openssl/ec.h>
46 #ifndef OPENSSL_NO_ECDH
47 #include <openssl/ecdh.h>
50 #ifndef OPENSSL_NO_ECDSA
51 #include <openssl/ecdsa.h>
55 #include <openssl/dh.h>
58 #if defined HAVE_OPENSSL_X509_H
59 # include <openssl/x509.h>
61 #if defined HAVE_OPENSSL_PEM_H
62 # include <openssl/pem.h>
64 #if defined HAVE_OPENSSL_SSL_H
65 # include <openssl/ssl.h>
67 #if defined HAVE_OPENSSL_BIO_H
68 # include <openssl/bio.h>
71 /* opaque EVP_PKEY object structure */
72 struct Lisp_EVP_PKEY {
73 struct lcrecord_header header;
77 typedef struct Lisp_EVP_PKEY Lisp_EVP_PKEY;
79 DECLARE_LRECORD(evp_pkey, Lisp_EVP_PKEY);
81 #define XEVPPKEY(x) XRECORD (x, evp_pkey, Lisp_EVP_PKEY)
82 #define XSETEVPPKEY(x, p) XSETRECORD (x, p, evp_pkey)
83 #define EVPPKEYP(x) RECORDP (x, evp_pkey)
84 #define CHECK_EVPPKEY(x) CHECK_RECORD (x, evp_pkey)
85 #define wrap_evppkey(p) wrap_object(p)
88 #if !defined(OPENSSL_NO_SSL2) || !defined(OPENSSL_NO_SSL3)
89 /* opaque SSL_CONN object structure
90 * this is just an ssl-ish wrap around the process object
92 struct Lisp_SSL_CONN {
93 struct lcrecord_header header;
103 /* Low level streams used in input and output,
104 backup streams if network stream is proselytised */
105 Lisp_Object pipe_instream;
106 Lisp_Object pipe_outstream;
108 /* Data end streams, decoding and encoding pipe_* streams */
109 Lisp_Object coding_instream;
110 Lisp_Object coding_outstream;
111 #endif /* FILE_CODING */
113 typedef struct Lisp_SSL_CONN Lisp_SSL_CONN;
115 Lisp_Object make_ssl_conn(Lisp_SSL_CONN *ssl_conn);
116 Lisp_SSL_CONN *allocate_ssl_conn(void);
117 void finalize_ssl_conn(void *header, int for_disksave);
118 Lisp_Object ossl_ssl_handshake(Lisp_Object, Lisp_Object);
120 extern Lisp_Object make_ssl_input_stream(SSL*, int);
121 extern Lisp_Object make_ssl_output_stream(SSL*, int);
122 EXFUN(Fset_process_coding_system, 3);
123 extern void ssl_verify_cert_chain(SSL*, void*);
125 DECLARE_LRECORD(ssl_conn, Lisp_SSL_CONN);
127 #define XSSLCONN(x) XRECORD (x, ssl_conn, Lisp_SSL_CONN)
128 #define XSETSSLCONN(x, p) XSETRECORD (x, p, ssl_conn)
129 #define SSLCONNP(x) RECORDP (x, ssl_conn)
130 #define CHECK_SSLCONN(x) CHECK_RECORD (x, ssl_conn)
131 #define wrap_sslconn(p) wrap_object(p)
133 #ifdef ALL_DEBUG_FLAGS
134 #undef OSSL_DEBUG_FLAG
135 #define OSSL_DEBUG_FLAG
138 #endif /* !OPENSSL_NO_SSL2 || !OPENSSL_NO_SSL3 */
139 #endif /* INCLUDED_openssl_h_ */