summaryrefslogtreecommitdiffstats
path: root/crypto_openssl.c
diff options
context:
space:
mode:
authorAdriaan de Jong <dejong@fox-it.com>2011-06-22 17:16:03 +0200
committerDavid Sommerseth <davids@redhat.com>2011-10-19 22:05:44 +0200
commit6825182b8137c036afcdc0e48397c0ea5ffc2404 (patch)
treeb65554fcab08105f5d8ad2866270c7630ee366d1 /crypto_openssl.c
parent0a18017472edb52c5535bc814c2aceaa2b562222 (diff)
downloadopenvpn-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_openssl.c')
-rw-r--r--crypto_openssl.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/crypto_openssl.c b/crypto_openssl.c
new file mode 100644
index 0000000..cbe559a
--- /dev/null
+++ b/crypto_openssl.c
@@ -0,0 +1,53 @@
+/*
+ * 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 OpenSSL-specific backend interface
+ */
+
+#include "syshead.h"
+
+#include "basic.h"
+#include "buffer.h"
+#include "integer.h"
+#include "crypto_backend.h"
+#include <openssl/objects.h>
+#include <openssl/evp.h>
+#include <openssl/des.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.
+ *
+ */
+
+int rand_bytes(uint8_t *output, int len)
+{
+ return RAND_bytes (output, len);
+}
+