diff options
author | Adriaan de Jong <dejong@fox-it.com> | 2011-06-22 17:16:03 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2011-10-19 22:05:44 +0200 |
commit | 6825182b8137c036afcdc0e48397c0ea5ffc2404 (patch) | |
tree | b65554fcab08105f5d8ad2866270c7630ee366d1 /crypto_backend.h | |
parent | 0a18017472edb52c5535bc814c2aceaa2b562222 (diff) | |
download | openvpn-6825182b8137c036afcdc0e48397c0ea5ffc2404.tar.gz openvpn-6825182b8137c036afcdc0e48397c0ea5ffc2404.tar.xz openvpn-6825182b8137c036afcdc0e48397c0ea5ffc2404.zip |
Refactored to rand_bytes for OpenSSL-independency
Signed-off-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'crypto_backend.h')
-rw-r--r-- | crypto_backend.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/crypto_backend.h b/crypto_backend.h new file mode 100644 index 0000000..9f8eb04 --- /dev/null +++ b/crypto_backend.h @@ -0,0 +1,61 @@ +/* + * OpenVPN -- An application to securely tunnel IP networks + * over a single TCP/UDP port, with support for SSL/TLS-based + * session authentication and key exchange, + * packet encryption, packet authentication, and + * packet compression. + * + * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net> + * Copyright (C) 2010 Fox Crypto B.V. <openvpn@fox-it.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program (see the file COPYING included with this + * distribution); if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/** + * @file Data Channel Cryptography SSL library-specific backend interface + */ + +#ifndef CRYPTO_BACKEND_H_ +#define CRYPTO_BACKEND_H_ + +#include "config.h" + +#ifdef USE_OPENSSL +#include "crypto_openssl.h" +#endif + +#include "basic.h" + +/* + * + * Random number functions, used in cases where we want + * reasonably strong cryptographic random number generation + * without depleting our entropy pool. Used for random + * IV values and a number of other miscellaneous tasks. + * + */ + +/** + * Wrapper for secure random number generator. Retrieves len bytes of random + * data, and places it in output. + * + * @param output Output buffer + * @param len Length of the output buffer, in bytes + * + * @return \c 1 on success, \c 0 on failure + */ +int rand_bytes (uint8_t *output, int len); + +#endif /* CRYPTO_BACKEND_H_ */ |