Skip to content

Commit e7c5081

Browse files
author
unknown
committed
chacha20 poly1305
1 parent 72c7541 commit e7c5081

13 files changed

+1279
-17
lines changed

config_in.h

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
/* Define if building universal (internal helper macro) */
44
#undef AC_APPLE_UNIVERSAL_BUILD
55

6+
/* Define this to use CHACHA20-POLY1305. */
7+
#undef CHAPOLY
8+
69
/* Define if building for a CISC machine (e.g. Intel). */
710
#undef CPU_CISC
811

configure

+65-2
Original file line numberDiff line numberDiff line change
@@ -5885,14 +5885,74 @@ as_fn_error $? "can't find openssl >= 1.0.1 crypto lib
58855885
See \`config.log' for more details" "$LINENO" 5; }
58865886
fi
58875887

5888+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing EVP_chacha20_poly1305" >&5
5889+
$as_echo_n "checking for library containing EVP_chacha20_poly1305... " >&6; }
5890+
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :
5891+
$as_echo_n "(cached) " >&6
5892+
else
5893+
ac_func_search_save_LIBS=$LIBS
5894+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5895+
/* end confdefs.h. */
5896+
5897+
/* Override any GCC internal prototype to avoid an error.
5898+
Use char because int might match the return type of a GCC
5899+
builtin and then its argument prototype would still apply. */
5900+
#ifdef __cplusplus
5901+
extern "C"
5902+
#endif
5903+
char EVP_chacha20_poly1305 ();
5904+
int
5905+
main ()
5906+
{
5907+
return EVP_chacha20_poly1305 ();
5908+
;
5909+
return 0;
5910+
}
5911+
_ACEOF
5912+
for ac_lib in '' crypto; do
5913+
if test -z "$ac_lib"; then
5914+
ac_res="none required"
5915+
else
5916+
ac_res=-l$ac_lib
5917+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
5918+
fi
5919+
if ac_fn_c_try_link "$LINENO"; then :
5920+
ac_cv_search_EVP_chacha20_poly1305=$ac_res
5921+
fi
5922+
rm -f core conftest.err conftest.$ac_objext \
5923+
conftest$ac_exeext
5924+
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :
5925+
break
5926+
fi
5927+
done
5928+
if ${ac_cv_search_EVP_chacha20_poly1305+:} false; then :
5929+
5930+
else
5931+
ac_cv_search_EVP_chacha20_poly1305=no
5932+
fi
5933+
rm conftest.$ac_ext
5934+
LIBS=$ac_func_search_save_LIBS
5935+
fi
5936+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_EVP_chacha20_poly1305" >&5
5937+
$as_echo "$ac_cv_search_EVP_chacha20_poly1305" >&6; }
5938+
ac_res=$ac_cv_search_EVP_chacha20_poly1305
5939+
if test "$ac_res" != no; then :
5940+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
5941+
5942+
5943+
$as_echo "#define CHAPOLY 1" >>confdefs.h
5944+
5945+
CHAPOLY_OBJ="crypto/cipher/chacha20_poly1305_ossl.o"
5946+
fi
5947+
58885948

58895949

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

58925952

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

5895-
AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o"
5955+
AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o $CHAPOLY_OBJ"
58965956
HMAC_OBJS=crypto/hash/hmac_ossl.o
58975957
USE_EXTERNAL_CRYPTO=1
58985958

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

62876347

6348+
$as_echo "#define CHAPOLY 1" >>confdefs.h
6349+
6350+
62886351
$as_echo "#define NSS 1" >>confdefs.h
62896352

6290-
AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o"
6353+
AES_ICM_OBJS="crypto/cipher/aes_icm_nss.o crypto/cipher/aes_gcm_nss.o crypto/cipher/chacha20_poly1305_nss.o"
62916354

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

configure.ac

+6-2
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,13 @@ if test "$enable_openssl" = "yes"; then
256256
[], [AC_MSG_FAILURE([can't find openssl >= 1.0.1 crypto lib])])
257257
AC_SEARCH_LIBS([EVP_aes_128_gcm], [crypto],
258258
[], [AC_MSG_FAILURE([can't find openssl >= 1.0.1 crypto lib])])
259+
AC_SEARCH_LIBS([EVP_chacha20_poly1305], [crypto], [
260+
AC_DEFINE([CHAPOLY], [1], [Define this to use CHACHA20-POLY1305.])
261+
CHAPOLY_OBJ="crypto/cipher/chacha20_poly1305_ossl.o"])
259262

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

@@ -344,8 +347,9 @@ elif test "$enable_nss" = "yes"; then
344347
fi
345348

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

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

0 commit comments

Comments
 (0)