Skip to content

Commit

Permalink
chacha20 poly1305
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Jun 5, 2020
1 parent 72c7541 commit e7c5081
Show file tree
Hide file tree
Showing 13 changed files with 1,279 additions and 17 deletions.
3 changes: 3 additions & 0 deletions config_in.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD

/* Define this to use CHACHA20-POLY1305. */
#undef CHAPOLY

/* Define if building for a CISC machine (e.g. Intel). */
#undef CPU_CISC

Expand Down
67 changes: 65 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -5885,14 +5885,74 @@ as_fn_error $? "can't find openssl >= 1.0.1 crypto lib
See \`config.log' for more details" "$LINENO" 5; }
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing EVP_chacha20_poly1305" >&5
$as_echo_n "checking for library containing EVP_chacha20_poly1305... " >&6; }
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char EVP_chacha20_poly1305 ();
int
main ()
{
return EVP_chacha20_poly1305 ();
;
return 0;
}
_ACEOF
for ac_lib in '' crypto; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_EVP_chacha20_poly1305=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :
break
fi
done
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :

else
ac_cv_search_EVP_chacha20_poly1305=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_EVP_chacha20_poly1305" >&5
$as_echo "$ac_cv_search_EVP_chacha20_poly1305" >&6; }
ac_res=$ac_cv_search_EVP_chacha20_poly1305
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"


$as_echo "#define CHAPOLY 1" >>confdefs.h

CHAPOLY_OBJ="crypto/cipher/chacha20_poly1305_ossl.o"
fi



$as_echo "#define GCM 1" >>confdefs.h


$as_echo "#define OPENSSL 1" >>confdefs.h

AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o"
AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o $CHAPOLY_OBJ"
HMAC_OBJS=crypto/hash/hmac_ossl.o
USE_EXTERNAL_CRYPTO=1

Expand Down Expand Up @@ -6285,9 +6345,12 @@ fi
$as_echo "#define GCM 1" >>confdefs.h


$as_echo "#define CHAPOLY 1" >>confdefs.h


$as_echo "#define NSS 1" >>confdefs.h

AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o"
AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o crypto/cipher/chacha20_poly1305_nss.o"

# TODO(RLB): Use NSS for HMAC
HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o"
Expand Down
8 changes: 6 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,13 @@ if test "$enable_openssl" = "yes"; then
[], [AC_MSG_FAILURE([can't find openssl >= 1.0.1 crypto lib])])
AC_SEARCH_LIBS([EVP_aes_128_gcm], [crypto],
[], [AC_MSG_FAILURE([can't find openssl >= 1.0.1 crypto lib])])
AC_SEARCH_LIBS([EVP_chacha20_poly1305], [crypto], [
AC_DEFINE([CHAPOLY], [1], [Define this to use CHACHA20-POLY1305.])
CHAPOLY_OBJ="crypto/cipher/chacha20_poly1305_ossl.o"])

AC_DEFINE([GCM], [1], [Define this to use AES-GCM.])
AC_DEFINE([OPENSSL], [1], [Define this to use OpenSSL crypto.])
AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o"
AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o $CHAPOLY_OBJ"
HMAC_OBJS=crypto/hash/hmac_ossl.o
AC_SUBST([USE_EXTERNAL_CRYPTO], [1])

Expand Down Expand Up @@ -344,8 +347,9 @@ elif test "$enable_nss" = "yes"; then
fi

AC_DEFINE([GCM], [1], [Define this to use AES-GCM.])
AC_DEFINE([CHAPOLY], [1], [Define this to use CHACHA20-POLY1305.])
AC_DEFINE([NSS], [1], [Define this to use NSS crypto.])
AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o"
AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o crypto/cipher/chacha20_poly1305_nss.o"

# TODO(RLB): Use NSS for HMAC
HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o"
Expand Down
Loading

0 comments on commit e7c5081

Please sign in to comment.