Skip to content

Commit 8599321

Browse files
committed
VDE Cryptcab: new version
- Removed dependency on OpenSSL - Using wolfSSL for crypto - Changed cipher to ChaCha - Using better IV rotation - Receiver now correctly verifies crc of incoming packets
1 parent d8b1ef0 commit 8599321

File tree

9 files changed

+294
-339
lines changed

9 files changed

+294
-339
lines changed

configure.ac

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdint.h \
4242

4343
AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
4444

45-
AC_CHECK_HEADERS([openssl/blowfish.h], [],
45+
AC_CHECK_HEADERS([wolfssl/wolfcrypt/chacha.h], [],
4646
[add_cryptcab_support=no ; warn_cryptcab=yes])
4747

4848
AC_CHECK_HEADERS([sysexits.h],
@@ -129,10 +129,10 @@ AC_ARG_ENABLE([experimental],
129129
[Enable experimental features (async notifies, plugin support, packet counter)]),
130130
[if test $enableval = "yes"; then enable_experimental=yes; fi])
131131

132-
# Disable vde_cryptcab? (depends on ssl, maybe unwanted)
132+
# Disable vde_cryptcab? (depends on wolfssl, maybe unwanted)
133133
AC_ARG_ENABLE([cryptcab],
134134
AS_HELP_STRING([--disable-cryptcab],
135-
[Disable libcrypto-dependend vde_cryptcab compilation]),
135+
[Disable vde_cryptcab compilation]),
136136
[if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
137137

138138
# Disable vde_over_ns? (not working on android, maybe unwanted)
@@ -347,9 +347,9 @@ AS_ECHO
347347
AS_ECHO
348348
if ! test x$add_cryptcab_support = "xyes" ; then
349349
if test x$warn_cryptcab = "xyes" ; then
350-
AC_MSG_WARN([VDE CryptCab support has been disabled because libcrypto is
351-
not installed on your system, or because openssl/blowfish.h could not be found.
352-
Please install them if you want CryptCab to be compiled and installed.])
350+
AC_MSG_WARN([VDE CryptCab support has been disabled because wolfSSL is
351+
not installed on your system, or because wolfssl/wolfcrypt/chacha.h could not be found.
352+
Please install libwolfssl if you want CryptCab to be compiled and installed.])
353353
AS_ECHO
354354
fi
355355
fi

man/vde_cryptcab.1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ A
3838
\fBvde_cryptcab\fP
3939
is a distributed cable manager for VDE switches.
4040
It allows two VDE switches on two machines to communicate
41-
using a blowfish encrypted channel.
41+
using a ChaCha encrypted channel.
4242

4343
When used in client mode (i.e., with -c option), it generates a random
44-
blowfish key, and uses
44+
ChaCha key, and uses
4545
.B scp (1)
4646
to transfer the key to the remote server.
4747

4848
On the client side, the environment variable SCP_EXTRA_OPTIONS may be set in order
4949
to append options to the scp command line (this is useful for example when dropbear or
50-
another non-standard ssh client is used to transfer the blowfish key).
50+
another non-standard ssh client is used to transfer the ChaCha key).
5151

5252
After a 4-way handshake phase to verify client credentials, server and
5353
client will exchange VDE datagrams encapsulating them into cryptograms

src/vde_cryptcab/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ bin_PROGRAMS = vde_cryptcab
33

44
# Avoid wrong optimizations due to strict aliasing rules when making casts
55
# between socket structs.
6-
AM_CFLAGS = -fno-strict-aliasing
6+
AM_CFLAGS = -fno-strict-aliasing -DHAVE_CHACHA -DTFM_TIMING_RESISTANT -DNO_ECC -DNO_RSA
77

88
if ENABLE_PROFILE
99
AM_CFLAGS += -pg --coverage
1010
AM_LDFLAGS = -pg --coverage
1111
endif
1212

1313
vde_cryptcab_SOURCES = crc32.c crc32.h cryptcab.h cryptcab.c vde_cryptcab_server.c vde_cryptcab_client.c
14-
vde_cryptcab_LDADD = $(top_builddir)/src/common/libvdecommon.la -lcrypto $(top_builddir)/src/lib/libvdeplug.la
14+
vde_cryptcab_LDADD = $(top_builddir)/src/common/libvdecommon.la -lwolfssl $(top_builddir)/src/lib/libvdeplug.la

src/vde_cryptcab/crc32.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
*
66
* Released under the terms of GNU GPL v.2
77
* (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
8-
* with the additional exemption that
9-
* compiling, linking, and/or using OpenSSL is allowed.
108
*
11-
* based on implementation by Finn Yannick Jacobs Krzysztof Dabrowski, ElysiuM deeZine
9+
* based on implementation by Finn Yannick Jacobs Krzysztof Dabrowski, ElysiuM deeZine
1210
*
1311
*/
1412

1513
#include <stdio.h>
1614
#include <stdlib.h>
15+
#include <stdint.h>
1716
#include <sys/types.h>
1817

1918
#include <config.h>
@@ -24,14 +23,14 @@
2423
* so make sure, you call it before using the other
2524
* functions!
2625
*/
27-
u_int32_t crc_tab[256];
26+
uint32_t crc_tab[256];
2827

2928
/* chksum_crc() -- to a given block, this one calculates the
3029
* crc32-checksum until the length is
3130
* reached. the crc32-checksum will be
3231
* the result.
3332
*/
34-
u_int32_t chksum_crc32 (unsigned char *block, unsigned int length)
33+
uint32_t chksum_crc32(unsigned char *block, unsigned int length)
3534
{
3635
unsigned long crc;
3736
unsigned long i;

src/vde_cryptcab/crc32.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
*
66
* Released under the terms of GNU GPL v.2
77
* (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
8-
* with the additional exemption that
9-
* compiling, linking, and/or using OpenSSL is allowed.
10-
*
11-
* based on implementation by Finn Yannick Jacobs Krzysztof Dabrowski, ElysiuM deeZine
128
*
139
*/
1410

1511
#ifndef _CRC32_H
1612
#define _CRC32_H
13+
#include <stdint.h>
1714

1815
void chksum_crc32gentab();
16+
uint32_t chksum_crc32(unsigned char *block, unsigned int length);
1917
unsigned char *crc32(unsigned char *block, unsigned int len);
2018

2119
#endif

0 commit comments

Comments
 (0)