From b58ea5842aacd8519d2a462ab186e2df597667a6 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 18 Sep 2020 17:04:26 -0700 Subject: [PATCH] wolfSSL RC2 template. --- configure.ac | 14 ++++++++++++ src/include.am | 4 ++++ wolfcrypt/src/rc2.c | 43 ++++++++++++++++++++++++++++++++++++ wolfssl/wolfcrypt/include.am | 1 + wolfssl/wolfcrypt/rc2.h | 41 ++++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 wolfcrypt/src/rc2.c create mode 100644 wolfssl/wolfcrypt/rc2.h diff --git a/configure.ac b/configure.ac index 8ea7dc0b9..808da3ae3 100644 --- a/configure.ac +++ b/configure.ac @@ -2781,6 +2781,19 @@ else fi +# RC2 +AC_ARG_ENABLE([rc2], + [AS_HELP_STRING([--enable-rc2],[Enable RC2 encryption (default: disabled)])], + [ ENABLED_RC2=$enableval ], + [ ENABLED_RC2=no ] + ) + +if test "$ENABLED_RC2" = "yes" +then + AM_CFLAGS="$AM_CFLAGS -DWC_RC2" +fi + + # FIPS AS_CASE([$FIPS_VERSION], ["v2"],[ @@ -5751,6 +5764,7 @@ AM_CONDITIONAL([BUILD_HASHFLAGS],[test "x$ENABLED_HASHFLAGS" = "xyes"]) AM_CONDITIONAL([BUILD_LINUXKM],[test "$ENABLED_LINUXKM" = "yes"]) AM_CONDITIONAL([BUILD_NO_LIBRARY],[test "$ENABLED_NO_LIBRARY" = "yes"]) AM_CONDITIONAL([BUILD_DEBUG],[test "$ax_enable_debug" = "yes" || test "$ENABLED_STACKSIZE" = "yes"]) +AM_CONDITIONAL([BUILD_RC2],[test "x$ENABLED_RC2" = "xyes"]) CREATE_HEX_VERSION diff --git a/src/include.am b/src/include.am index c03d04b93..1a73a7536 100644 --- a/src/include.am +++ b/src/include.am @@ -208,6 +208,10 @@ endif endif endif +if BUILD_RC2 +src_libwolfssl_la_SOURCES += wolfcrypt/src/rc2.c +endif + if BUILD_SP if BUILD_SP_C src_libwolfssl_la_SOURCES += wolfcrypt/src/sp_c32.c diff --git a/wolfcrypt/src/rc2.c b/wolfcrypt/src/rc2.c new file mode 100644 index 000000000..920ab8db1 --- /dev/null +++ b/wolfcrypt/src/rc2.c @@ -0,0 +1,43 @@ +/* rc2.c + * + * Copyright (C) 2006-2020 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL 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; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* + +DESCRIPTION +This library provides the interface to the RC2 encryption algorithm. + +*/ +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#ifdef WC_RC2 + +#include +#include + + + + + +#endif /* WC_RC2 */ diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am index 81571b37d..8041a8bbc 100644 --- a/wolfssl/wolfcrypt/include.am +++ b/wolfssl/wolfcrypt/include.am @@ -43,6 +43,7 @@ nobase_include_HEADERS+= \ wolfssl/wolfcrypt/random.h \ wolfssl/wolfcrypt/ripemd.h \ wolfssl/wolfcrypt/rsa.h \ + wolfssl/wolfcrypt/rc2.h \ wolfssl/wolfcrypt/settings.h \ wolfssl/wolfcrypt/sha256.h \ wolfssl/wolfcrypt/sha512.h \ diff --git a/wolfssl/wolfcrypt/rc2.h b/wolfssl/wolfcrypt/rc2.h new file mode 100644 index 000000000..9d8581421 --- /dev/null +++ b/wolfssl/wolfcrypt/rc2.h @@ -0,0 +1,41 @@ +/* rc2.h + * + * Copyright (C) 2006-2020 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL 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; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifndef WOLF_CRYPT_RC2_H +#define WOLF_CRYPT_RC2_H + +#include + +#ifdef WC_RC2 + +#ifdef __cplusplus + extern "C" { +#endif + + + + +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* WC_RC2 */ +#endif /* WOLF_CRYPT_RC2_H */