1/*
2 *  OpenVPN -- An application to securely tunnel IP networks
3 *             over a single TCP/UDP port, with support for SSL/TLS-based
4 *             session authentication and key exchange,
5 *             packet encryption, packet authentication, and
6 *             packet compression.
7 *
8 *  Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
9 *  Copyright (C) 2010 Fox Crypto B.V. <openvpn@fox-it.com>
10 *
11 *  This program is free software; you can redistribute it and/or modify
12 *  it under the terms of the GNU General Public License version 2
13 *  as published by the Free Software Foundation.
14 *
15 *  This program is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *  GNU General Public License for more details.
19 *
20 *  You should have received a copy of the GNU General Public License
21 *  along with this program (see the file COPYING included with this
22 *  distribution); if not, write to the Free Software Foundation, Inc.,
23 *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 */
25
26/**
27 * @file Data Channel Cryptography OpenSSL-specific backend interface
28 */
29
30#ifndef CRYPTO_OPENSSL_H_
31#define CRYPTO_OPENSSL_H_
32
33#include <openssl/evp.h>
34#include <openssl/hmac.h>
35#include <openssl/md5.h>
36
37/** Generic cipher key type %context. */
38typedef EVP_CIPHER cipher_kt_t;
39
40/** Generic message digest key type %context. */
41typedef EVP_MD md_kt_t;
42
43/** Generic cipher %context. */
44typedef EVP_CIPHER_CTX cipher_ctx_t;
45
46/** Generic message digest %context. */
47typedef EVP_MD_CTX md_ctx_t;
48
49/** Generic HMAC %context. */
50typedef HMAC_CTX hmac_ctx_t;
51
52/** Maximum length of an IV */
53#define OPENVPN_MAX_IV_LENGTH 	EVP_MAX_IV_LENGTH
54
55/** Cipher is in CBC mode */
56#define OPENVPN_MODE_CBC 	EVP_CIPH_CBC_MODE
57
58/** Cipher is in OFB mode */
59#define OPENVPN_MODE_OFB	EVP_CIPH_OFB_MODE
60
61/** Cipher is in CFB mode */
62#define OPENVPN_MODE_CFB 	EVP_CIPH_CFB_MODE
63
64/** Cipher should encrypt */
65#define OPENVPN_OP_ENCRYPT 	1
66
67/** Cipher should decrypt */
68#define OPENVPN_OP_DECRYPT 	0
69
70#define DES_KEY_LENGTH 8
71#define MD4_DIGEST_LENGTH 	16
72
73#endif /* CRYPTO_OPENSSL_H_ */
74