mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
Backport aarch64 support for aes256-gcm
This commit is contained in:
parent
a12afb7b9d
commit
3a6a6025cc
@ -271,6 +271,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -150,6 +150,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
455
configure
vendored
455
configure
vendored
@ -693,6 +693,7 @@ CFLAGS_SSSE3
|
||||
CFLAGS_SSE3
|
||||
CFLAGS_SSE2
|
||||
CFLAGS_MMX
|
||||
CFLAGS_ARMCRYPTO
|
||||
LIBTOOL_DEPS
|
||||
LT_SYS_LIBRARY_PATH
|
||||
OTOOL64
|
||||
@ -1570,7 +1571,7 @@ Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
|
||||
--with-pthreads use pthreads library, or --without-pthreads to
|
||||
disable threading support.
|
||||
disable threading support
|
||||
--with-safecode For maintainers only - please do not use
|
||||
--with-ctgrind For maintainers only - please do not use
|
||||
--with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
|
||||
@ -8598,82 +8599,6 @@ fi
|
||||
;;
|
||||
esac
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a broken Xcode version" >&5
|
||||
printf %s "checking for a broken Xcode version... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
#if !defined(__APPLE_CC__) || __APPLE_CC__ != 6000
|
||||
#error Not Apple
|
||||
#endif
|
||||
#if !defined(__clang_major__) || __clang_major__ != 11
|
||||
#error Not Xcode 11
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Using unsupported Xcode version" >&5
|
||||
printf "%s\n" "$as_me: WARNING: Using unsupported Xcode version" >&2;}
|
||||
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$CFLAGS -fno-stack-check" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS -fno-stack-check" >&5
|
||||
printf %s "checking whether C compiler accepts $CFLAGS -fno-stack-check... " >&6; }
|
||||
if eval test \${$as_CACHEVAR+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS $CFLAGS -fno-stack-check"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <time.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
eval "$as_CACHEVAR=yes"
|
||||
else $as_nop
|
||||
eval "$as_CACHEVAR=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags
|
||||
fi
|
||||
eval ac_res=\$$as_CACHEVAR
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
printf "%s\n" "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_CACHEVAR"\" = x"yes"
|
||||
then :
|
||||
CFLAGS="$CFLAGS -fno-stack-check"
|
||||
else $as_nop
|
||||
:
|
||||
fi
|
||||
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
|
||||
if test "x$enable_ssp" != "xno"
|
||||
then :
|
||||
|
||||
@ -8813,6 +8738,48 @@ else $as_nop
|
||||
:
|
||||
fi
|
||||
|
||||
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$CFLAGS -Wno-deprecated-declarations" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS -Wno-deprecated-declarations" >&5
|
||||
printf %s "checking whether C compiler accepts $CFLAGS -Wno-deprecated-declarations... " >&6; }
|
||||
if eval test \${$as_CACHEVAR+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS $CFLAGS -Wno-deprecated-declarations"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <time.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
eval "$as_CACHEVAR=yes"
|
||||
else $as_nop
|
||||
eval "$as_CACHEVAR=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags
|
||||
fi
|
||||
eval ac_res=\$$as_CACHEVAR
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
printf "%s\n" "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_CACHEVAR"\" = x"yes"
|
||||
then :
|
||||
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
|
||||
else $as_nop
|
||||
:
|
||||
fi
|
||||
|
||||
as_CACHEVAR=`printf "%s\n" "ax_cv_check_cflags__$CFLAGS -Wno-unknown-pragmas" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS -Wno-unknown-pragmas" >&5
|
||||
printf %s "checking whether C compiler accepts $CFLAGS -Wno-unknown-pragmas... " >&6; }
|
||||
@ -18542,10 +18509,154 @@ fi
|
||||
|
||||
|
||||
|
||||
target_cpu_aarch64=no
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM64 target" >&5
|
||||
printf %s "checking for ARM64 target... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef __aarch64__
|
||||
#error Not aarch64
|
||||
#endif
|
||||
#include <arm_neon.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
(void) 0
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
target_cpu_aarch64=yes
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
target_cpu_aarch64=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
if test "x$EMSCRIPTEN" = "x"
|
||||
then :
|
||||
|
||||
|
||||
if test "x$target_cpu_aarch64" = "xyes"
|
||||
then :
|
||||
|
||||
have_armcrypto=no
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM crypto instructions set" >&5
|
||||
printf %s "checking for ARM crypto instructions set... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <arm_neon.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO))
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
have_armcrypto=yes
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
oldcflags="$CFLAGS"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -march=armv8-a+crypto+aes" >&5
|
||||
printf %s "checking whether C compiler accepts -march=armv8-a+crypto+aes... " >&6; }
|
||||
if test ${ax_cv_check_cflags___march_armv8_apcryptopaes+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -march=armv8-a+crypto+aes"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <time.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
ax_cv_check_cflags___march_armv8_apcryptopaes=yes
|
||||
else $as_nop
|
||||
ax_cv_check_cflags___march_armv8_apcryptopaes=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___march_armv8_apcryptopaes" >&5
|
||||
printf "%s\n" "$ax_cv_check_cflags___march_armv8_apcryptopaes" >&6; }
|
||||
if test "x$ax_cv_check_cflags___march_armv8_apcryptopaes" = xyes
|
||||
then :
|
||||
|
||||
CFLAGS="$CFLAGS -march=armv8-a+crypto+aes"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM crypto instructions set with -march=armv8-a+crypto+aes" >&5
|
||||
printf %s "checking for ARM crypto instructions set with -march=armv8-a+crypto+aes... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <arm_neon.h>
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO))
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes - with addition of -march=armv8-a+crypto+aes" >&5
|
||||
printf "%s\n" "yes - with addition of -march=armv8-a+crypto+aes" >&6; }
|
||||
have_armcrypto=yes
|
||||
CFLAGS_ARMCRYPTO="-march=armv8-a+crypto+aes"
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
else $as_nop
|
||||
:
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
if test "$have_armcrypto" = "yes"
|
||||
then :
|
||||
|
||||
printf "%s\n" "#define HAVE_ARMCRYPTO 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mmmx" >&5
|
||||
printf %s "checking whether C compiler accepts -mmmx... " >&6; }
|
||||
@ -18603,7 +18714,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -18654,7 +18765,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -18718,7 +18830,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -18769,7 +18881,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -18830,7 +18943,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -18881,7 +18994,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -18941,7 +19055,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -18992,7 +19106,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19052,7 +19167,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19103,7 +19218,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19163,7 +19279,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19214,7 +19330,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19278,7 +19395,7 @@ return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ));
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19341,7 +19458,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19352,13 +19469,15 @@ printf "%s\n" "no" >&6; }
|
||||
printf "%s\n" "#define _mm256_broadcastsi128_si256 _mm_broadcastsi128_si256" >>confdefs.h
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19434,7 +19553,7 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7),
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19528,7 +19647,8 @@ fi
|
||||
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19630,7 +19750,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19722,7 +19842,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
@ -19782,7 +19903,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
@ -19834,7 +19955,8 @@ else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$oldcflags"
|
||||
|
||||
|
||||
@ -19852,6 +19974,7 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_mman_h" = xyes
|
||||
then :
|
||||
@ -19875,6 +19998,19 @@ if test "x$ac_cv_header_intrin_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_INTRIN_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
ac_fn_c_check_header_compile "$LINENO" "sys/auxv.h" "ac_cv_header_sys_auxv_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_sys_auxv_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_SYS_AUXV_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "CommonCrypto/CommonRandom.h" "ac_cv_header_CommonCrypto_CommonRandom_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_CommonCrypto_CommonRandom_h" = xyes
|
||||
then :
|
||||
printf "%s\n" "#define HAVE_COMMONCRYPTO_COMMONRANDOM_H 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_header_compile "$LINENO" "cet.h" "ac_cv_header_cet_h" "$ac_includes_default"
|
||||
@ -20218,7 +20354,7 @@ main (void)
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
@ -20228,7 +20364,8 @@ printf "%s\n" "yes" >&6; }
|
||||
CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we can use inline asm code" >&5
|
||||
printf %s "checking whether we can use inline asm code... " >&6; }
|
||||
@ -20606,49 +20743,6 @@ fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if data alignment is required" >&5
|
||||
printf %s "checking if data alignment is required... " >&6; }
|
||||
aligned_access_required=yes
|
||||
case $host_cpu in #(
|
||||
i?86|amd64|x86_64|powerpc*|s390*) :
|
||||
aligned_access_required=no ;; #(
|
||||
arm*) :
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef __ARM_FEATURE_UNALIGNED
|
||||
# error data alignment is required
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
aligned_access_required=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
if test "x$aligned_access_required" = "xyes"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
|
||||
printf "%s\n" "#define CPU_UNALIGNED_ACCESS 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if atomic operations are supported" >&5
|
||||
printf %s "checking if atomic operations are supported... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
@ -20674,6 +20768,68 @@ printf "%s\n" "yes" >&6; }
|
||||
|
||||
printf "%s\n" "#define HAVE_ATOMIC_OPS 1" >>confdefs.h
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if C11 memory fences are supported" >&5
|
||||
printf %s "checking if C11 memory fences are supported... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <stdatomic.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
atomic_thread_fence(memory_order_acquire);
|
||||
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
printf "%s\n" "#define HAVE_C11_MEMORY_FENCES 1" >>confdefs.h
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if gcc memory fences are supported" >&5
|
||||
printf %s "checking if gcc memory fences are supported... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
printf "%s\n" "#define HAVE_GCC_MEMORY_FENCES 1" >>confdefs.h
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
@ -20913,16 +21069,15 @@ printf %s "checking for getrandom with a standard API... " >&6; }
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# error A recent libasan version on an old system may intercept nonexistent functions
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
unsigned char buf;
|
||||
(void) getrandom((void *) &buf, 1U, 0U);
|
||||
if (&getrandom != NULL) {
|
||||
(void) getrandom((void *) &buf, 1U, 0U);
|
||||
}
|
||||
|
||||
;
|
||||
return 0;
|
||||
@ -20959,16 +21114,12 @@ printf %s "checking for getentropy with a standard API... " >&6; }
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# error A recent libasan version on an old system may intercept nonexistent functions
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
unsigned char buf;
|
||||
|
||||
if (&getentropy != NULL) {
|
||||
(void) getentropy((void *) &buf, 1U);
|
||||
}
|
||||
|
139
configure.ac
139
configure.ac
@ -131,7 +131,7 @@ AM_CONDITIONAL([MINIMAL], [test x$enable_minimal = xyes])
|
||||
AC_SUBST(SODIUM_LIBRARY_MINIMAL_DEF)
|
||||
|
||||
AC_ARG_WITH(pthreads, AS_HELP_STRING([--with-pthreads],
|
||||
[use pthreads library, or --without-pthreads to disable threading support.]),
|
||||
[use pthreads library, or --without-pthreads to disable threading support]),
|
||||
[ ], [withval="yes"])
|
||||
|
||||
AS_IF([test "x$withval" = "xyes"], [
|
||||
@ -293,23 +293,6 @@ AS_CASE([$host_os],
|
||||
])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for a broken Xcode version)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
#if !defined(__APPLE_CC__) || __APPLE_CC__ != 6000
|
||||
#error Not Apple
|
||||
#endif
|
||||
#if !defined(__clang_major__) || __clang_major__ != 11
|
||||
#error Not Xcode 11
|
||||
#endif
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_MSG_WARN([Using unsupported Xcode version])
|
||||
AX_CHECK_COMPILE_FLAG([$CFLAGS -fno-stack-check],
|
||||
[CFLAGS="$CFLAGS -fno-stack-check"])
|
||||
],
|
||||
[AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AS_IF([test "x$enable_ssp" != "xno"],[
|
||||
|
||||
AS_CASE([$host_os],
|
||||
@ -324,6 +307,7 @@ AS_CASE([$host_os],
|
||||
])
|
||||
|
||||
AX_CHECK_COMPILE_FLAG([$CFLAGS -Wall], [CWFLAGS="$CFLAGS -Wall"])
|
||||
AX_CHECK_COMPILE_FLAG([$CFLAGS -Wno-deprecated-declarations], [CFLAGS="$CFLAGS -Wno-deprecated-declarations"])
|
||||
AX_CHECK_COMPILE_FLAG([$CFLAGS -Wno-unknown-pragmas], [CFLAGS="$CFLAGS -Wno-unknown-pragmas"])
|
||||
|
||||
AC_ARG_VAR([CWFLAGS], [compilation flags for generating extra warnings])
|
||||
@ -392,14 +376,55 @@ AC_SUBST(LIBTOOL_DEPS)
|
||||
AC_ARG_VAR([AR], [path to the ar utility])
|
||||
AC_CHECK_TOOL([AR], [ar], [ar])
|
||||
|
||||
dnl Checks for headers
|
||||
dnl Checks for headers and codegen feature flags
|
||||
|
||||
target_cpu_aarch64=no
|
||||
AC_MSG_CHECKING(for ARM64 target)
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([
|
||||
#ifndef __aarch64__
|
||||
#error Not aarch64
|
||||
#endif
|
||||
#include <arm_neon.h>
|
||||
], [(void) 0])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
target_cpu_aarch64=yes],
|
||||
[AC_MSG_RESULT(no)
|
||||
target_cpu_aarch64=no])
|
||||
|
||||
AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
|
||||
AS_IF([test "x$target_cpu_aarch64" = "xyes"], [
|
||||
have_armcrypto=no
|
||||
AC_MSG_CHECKING(for ARM crypto instructions set)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_neon.h>]], [[ vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO)) ]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
have_armcrypto=yes
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-march=armv8-a+crypto+aes], [
|
||||
CFLAGS="$CFLAGS -march=armv8-a+crypto+aes"
|
||||
AC_MSG_CHECKING(for ARM crypto instructions set with -march=armv8-a+crypto+aes)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <arm_neon.h>]], [[ vaeseq_u8(vmovq_n_u8(0), vmovq_n_u8(__ARM_FEATURE_CRYPTO)) ]])],
|
||||
[
|
||||
AC_MSG_RESULT(yes - with addition of -march=armv8-a+crypto+aes)
|
||||
have_armcrypto=yes
|
||||
CFLAGS_ARMCRYPTO="-march=armv8-a+crypto+aes"
|
||||
],
|
||||
[AC_MSG_RESULT(no)])
|
||||
CFLAGS="$oldcflags"
|
||||
])
|
||||
])
|
||||
AS_IF([test "$have_armcrypto" = "yes"],[AC_DEFINE([HAVE_ARMCRYPTO], [1], [ARM crypto extensions are available])])
|
||||
])
|
||||
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mmmx], [CFLAGS="$CFLAGS -mmmx"])
|
||||
AC_MSG_CHECKING(for MMX instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("mmx")
|
||||
#include <mmintrin.h>
|
||||
]], [[ __m64 x = _mm_setzero_si64(); ]])],
|
||||
@ -412,7 +437,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-msse2], [CFLAGS="$CFLAGS -msse2"])
|
||||
AC_MSG_CHECKING(for SSE2 instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("sse2")
|
||||
#ifndef __SSE2__
|
||||
# define __SSE2__
|
||||
@ -429,7 +454,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-msse3], [CFLAGS="$CFLAGS -msse3"])
|
||||
AC_MSG_CHECKING(for SSE3 instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("sse3")
|
||||
#include <pmmintrin.h>
|
||||
]], [[ __m128 x = _mm_addsub_ps(_mm_cvtpd_ps(_mm_setzero_pd()),
|
||||
@ -443,7 +468,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mssse3], [CFLAGS="$CFLAGS -mssse3"])
|
||||
AC_MSG_CHECKING(for SSSE3 instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("ssse3")
|
||||
#include <tmmintrin.h>
|
||||
]], [[ __m64 x = _mm_abs_pi32(_m_from_int(0)); ]])],
|
||||
@ -456,7 +481,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-msse4.1], [CFLAGS="$CFLAGS -msse4.1"])
|
||||
AC_MSG_CHECKING(for SSE4.1 instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("sse4.1")
|
||||
#include <smmintrin.h>
|
||||
]], [[ __m128i x = _mm_minpos_epu16(_mm_setzero_si128()); ]])],
|
||||
@ -469,7 +494,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mavx], [CFLAGS="$CFLAGS -mavx"])
|
||||
AC_MSG_CHECKING(for AVX instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("avx")
|
||||
#include <immintrin.h>
|
||||
]], [[ _mm256_zeroall(); ]])],
|
||||
@ -482,7 +507,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"], [
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS="$CFLAGS -mavx2"])
|
||||
AC_MSG_CHECKING(for AVX2 instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("avx2")
|
||||
#include <immintrin.h>
|
||||
]], [[
|
||||
@ -494,7 +519,7 @@ return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ));
|
||||
AC_DEFINE([HAVE_AVX2INTRIN_H], [1], [AVX2 is available])
|
||||
AX_CHECK_COMPILE_FLAG([-mavx2], [CFLAGS_AVX2="-mavx2"])
|
||||
AC_MSG_CHECKING(if _mm256_broadcastsi128_si256 is correctly defined)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("avx2")
|
||||
#include <immintrin.h>
|
||||
]], [[ __m256i y = _mm256_broadcastsi128_si256(_mm_setzero_si128()); ]])],
|
||||
@ -509,7 +534,7 @@ return _mm256_movemask_ps(_mm256_cmp_ps(x, y, _CMP_NEQ_OQ));
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mavx512f], [CFLAGS="$CFLAGS -mavx512f"])
|
||||
AC_MSG_CHECKING(for AVX512F instructions set)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("avx512f")
|
||||
#include <immintrin.h>
|
||||
]], [[
|
||||
@ -542,7 +567,7 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7),
|
||||
AX_CHECK_COMPILE_FLAG([-maes], [CFLAGS="$CFLAGS -maes"])
|
||||
AX_CHECK_COMPILE_FLAG([-mpclmul], [CFLAGS="$CFLAGS -mpclmul"])
|
||||
AC_MSG_CHECKING(for AESNI instructions set and PCLMULQDQ)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("aes")
|
||||
#pragma GCC target("pclmul")
|
||||
#include <wmmintrin.h>
|
||||
@ -559,7 +584,7 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7),
|
||||
oldcflags="$CFLAGS"
|
||||
AX_CHECK_COMPILE_FLAG([-mrdrnd], [CFLAGS="$CFLAGS -mrdrnd"])
|
||||
AC_MSG_CHECKING(for RDRAND)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#pragma GCC target("rdrnd")
|
||||
#include <immintrin.h>
|
||||
]], [[ unsigned long long x; _rdrand64_step(&x); ]])],
|
||||
@ -572,6 +597,7 @@ __m512i y = _mm512_permutexvar_epi64(_mm512_setr_epi64(0, 1, 4, 5, 2, 3, 6, 7),
|
||||
|
||||
])
|
||||
|
||||
AC_SUBST(CFLAGS_ARMCRYPTO)
|
||||
AC_SUBST(CFLAGS_MMX)
|
||||
AC_SUBST(CFLAGS_SSE2)
|
||||
AC_SUBST(CFLAGS_SSE3)
|
||||
@ -584,7 +610,8 @@ AC_SUBST(CFLAGS_AESNI)
|
||||
AC_SUBST(CFLAGS_PCLMUL)
|
||||
AC_SUBST(CFLAGS_RDRAND)
|
||||
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/random.h intrin.h])
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/random.h intrin.h sys/auxv.h])
|
||||
AC_CHECK_HEADERS([CommonCrypto/CommonRandom.h])
|
||||
AC_CHECK_HEADERS([cet.h])
|
||||
|
||||
AC_MSG_CHECKING([if _xgetbv() is available])
|
||||
@ -609,7 +636,7 @@ AC_C_BIGENDIAN(
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(whether __STDC_LIMIT_MACROS is required)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
]], [[
|
||||
@ -793,23 +820,6 @@ void f(void *x) { __dummy(x); }
|
||||
AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(if data alignment is required)
|
||||
aligned_access_required=yes
|
||||
AS_CASE([$host_cpu],
|
||||
[i?86|amd64|x86_64|powerpc*|s390*],
|
||||
[aligned_access_required=no],
|
||||
[arm*],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#ifndef __ARM_FEATURE_UNALIGNED
|
||||
# error data alignment is required
|
||||
#endif
|
||||
]], [[]])], [aligned_access_required=no], [])]
|
||||
)
|
||||
AS_IF([test "x$aligned_access_required" = "xyes"],
|
||||
[AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_DEFINE([CPU_UNALIGNED_ACCESS], [1], [unaligned memory access is supported])])
|
||||
|
||||
AC_MSG_CHECKING(if atomic operations are supported)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
|
||||
static volatile int _sodium_lock;
|
||||
@ -821,6 +831,26 @@ __sync_lock_release(&_sodium_lock);
|
||||
AC_DEFINE([HAVE_ATOMIC_OPS], [1], [atomic operations are supported])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(if C11 memory fences are supported)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdatomic.h>
|
||||
]], [[
|
||||
atomic_thread_fence(memory_order_acquire);
|
||||
]]
|
||||
)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_C11_MEMORY_FENCES], [1], [C11 memory fences are supported])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(if gcc memory fences are supported)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]], [[
|
||||
__atomic_thread_fence(__ATOMIC_ACQUIRE);
|
||||
]]
|
||||
)],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE_GCC_MEMORY_FENCES], [1], [GCC memory fences are supported])],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions and headers
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
@ -840,12 +870,11 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# error A recent libasan version on an old system may intercept nonexistent functions
|
||||
#endif
|
||||
]], [[
|
||||
unsigned char buf;
|
||||
(void) getrandom((void *) &buf, 1U, 0U);
|
||||
if (&getrandom != NULL) {
|
||||
(void) getrandom((void *) &buf, 1U, 0U);
|
||||
}
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_CHECK_FUNCS([getrandom])],
|
||||
@ -861,12 +890,8 @@ unsigned char buf;
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
# error A recent libasan version on an old system may intercept nonexistent functions
|
||||
#endif
|
||||
]], [[
|
||||
unsigned char buf;
|
||||
|
||||
if (&getentropy != NULL) {
|
||||
(void) getentropy((void *) &buf, 1U);
|
||||
}
|
||||
|
@ -150,6 +150,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -150,6 +150,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -150,6 +150,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -208,6 +208,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -2,6 +2,7 @@ lib_LTLIBRARIES = \
|
||||
libsodium.la
|
||||
|
||||
libsodium_la_SOURCES = \
|
||||
crypto_aead/aes256gcm/aead_aes256gcm.c \
|
||||
crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
|
||||
crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
|
||||
crypto_auth/crypto_auth.c \
|
||||
@ -195,8 +196,8 @@ endif
|
||||
SUBDIRS = \
|
||||
include
|
||||
|
||||
libsodium_la_LIBADD = libaesni.la libsse2.la libssse3.la libsse41.la libavx2.la libavx512f.la
|
||||
noinst_LTLIBRARIES = libaesni.la libsse2.la libssse3.la libsse41.la libavx2.la libavx512f.la
|
||||
libsodium_la_LIBADD = libaesni.la libarmcrypto.la libsse2.la libssse3.la libsse41.la libavx2.la libavx512f.la
|
||||
noinst_LTLIBRARIES = libaesni.la libarmcrypto.la libsse2.la libssse3.la libsse41.la libavx2.la libavx512f.la
|
||||
|
||||
librdrand_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
librdrand_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@ -212,6 +213,12 @@ libsodium_la_SOURCES += \
|
||||
randombytes/sysrandom/randombytes_sysrandom.c
|
||||
endif
|
||||
|
||||
libarmcrypto_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
libarmcrypto_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@CFLAGS_ARMCRYPTO@
|
||||
libarmcrypto_la_SOURCES = \
|
||||
crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
|
||||
|
||||
libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@CFLAGS_SSE2@ @CFLAGS_SSSE3@ @CFLAGS_AVX@ @CFLAGS_AESNI@ @CFLAGS_PCLMUL@
|
||||
|
@ -228,6 +228,13 @@ am__v_lt_1 =
|
||||
libaesni_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libaesni_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
libarmcrypto_la_LIBADD =
|
||||
am_libarmcrypto_la_OBJECTS = crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo
|
||||
libarmcrypto_la_OBJECTS = $(am_libarmcrypto_la_OBJECTS)
|
||||
libarmcrypto_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
|
||||
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
|
||||
$(AM_CFLAGS) $(CFLAGS) $(libarmcrypto_la_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
libavx2_la_LIBADD =
|
||||
am_libavx2_la_OBJECTS = crypto_generichash/blake2b/ref/libavx2_la-blake2b-compress-avx2.lo \
|
||||
crypto_pwhash/argon2/libavx2_la-argon2-fill-block-avx2.lo \
|
||||
@ -250,9 +257,11 @@ librdrand_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(librdrand_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
@EMSCRIPTEN_FALSE@am_librdrand_la_rpath =
|
||||
libsodium_la_DEPENDENCIES = libaesni.la libsse2.la libssse3.la \
|
||||
libsse41.la libavx2.la libavx512f.la $(am__append_8)
|
||||
libsodium_la_DEPENDENCIES = libaesni.la libarmcrypto.la libsse2.la \
|
||||
libssse3.la libsse41.la libavx2.la libavx512f.la \
|
||||
$(am__append_8)
|
||||
am__libsodium_la_SOURCES_DIST = \
|
||||
crypto_aead/aes256gcm/aead_aes256gcm.c \
|
||||
crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
|
||||
crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
|
||||
crypto_auth/crypto_auth.c \
|
||||
@ -412,7 +421,9 @@ am__objects_1 =
|
||||
@MINIMAL_FALSE@ crypto_stream/salsa208/libsodium_la-stream_salsa208.lo \
|
||||
@MINIMAL_FALSE@ crypto_stream/xchacha20/libsodium_la-stream_xchacha20.lo
|
||||
@EMSCRIPTEN_FALSE@am__objects_6 = randombytes/sysrandom/libsodium_la-randombytes_sysrandom.lo
|
||||
am_libsodium_la_OBJECTS = crypto_aead/chacha20poly1305/sodium/libsodium_la-aead_chacha20poly1305.lo \
|
||||
am_libsodium_la_OBJECTS = \
|
||||
crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo \
|
||||
crypto_aead/chacha20poly1305/sodium/libsodium_la-aead_chacha20poly1305.lo \
|
||||
crypto_aead/xchacha20poly1305/sodium/libsodium_la-aead_xchacha20poly1305.lo \
|
||||
crypto_auth/libsodium_la-crypto_auth.lo \
|
||||
crypto_auth/hmacsha256/libsodium_la-auth_hmacsha256.lo \
|
||||
@ -530,7 +541,9 @@ am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
am__maybe_remake_depfiles = depfiles
|
||||
am__depfiles_remade = crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo \
|
||||
am__depfiles_remade = crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Plo \
|
||||
crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo \
|
||||
crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Plo \
|
||||
crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Plo \
|
||||
crypto_aead/xchacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_xchacha20poly1305.Plo \
|
||||
crypto_auth/$(DEPDIR)/libsodium_la-crypto_auth.Plo \
|
||||
@ -667,13 +680,14 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libaesni_la_SOURCES) $(libavx2_la_SOURCES) \
|
||||
$(libavx512f_la_SOURCES) $(librdrand_la_SOURCES) \
|
||||
$(libsodium_la_SOURCES) $(libsse2_la_SOURCES) \
|
||||
$(libsse41_la_SOURCES) $(libssse3_la_SOURCES)
|
||||
DIST_SOURCES = $(libaesni_la_SOURCES) $(libavx2_la_SOURCES) \
|
||||
$(libavx512f_la_SOURCES) $(librdrand_la_SOURCES) \
|
||||
$(am__libsodium_la_SOURCES_DIST) \
|
||||
SOURCES = $(libaesni_la_SOURCES) $(libarmcrypto_la_SOURCES) \
|
||||
$(libavx2_la_SOURCES) $(libavx512f_la_SOURCES) \
|
||||
$(librdrand_la_SOURCES) $(libsodium_la_SOURCES) \
|
||||
$(libsse2_la_SOURCES) $(libsse41_la_SOURCES) \
|
||||
$(libssse3_la_SOURCES)
|
||||
DIST_SOURCES = $(libaesni_la_SOURCES) $(libarmcrypto_la_SOURCES) \
|
||||
$(libavx2_la_SOURCES) $(libavx512f_la_SOURCES) \
|
||||
$(librdrand_la_SOURCES) $(am__libsodium_la_SOURCES_DIST) \
|
||||
$(am__libsse2_la_SOURCES_DIST) $(libsse41_la_SOURCES) \
|
||||
$(libssse3_la_SOURCES)
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
@ -765,6 +779,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
@ -920,7 +935,7 @@ valgrind_tools = @valgrind_tools@
|
||||
lib_LTLIBRARIES = \
|
||||
libsodium.la
|
||||
|
||||
libsodium_la_SOURCES = \
|
||||
libsodium_la_SOURCES = crypto_aead/aes256gcm/aead_aes256gcm.c \
|
||||
crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c \
|
||||
crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c \
|
||||
crypto_auth/crypto_auth.c \
|
||||
@ -1026,10 +1041,12 @@ libsodium_la_CPPFLAGS = \
|
||||
SUBDIRS = \
|
||||
include
|
||||
|
||||
libsodium_la_LIBADD = libaesni.la libsse2.la libssse3.la libsse41.la \
|
||||
libavx2.la libavx512f.la $(am__append_8)
|
||||
noinst_LTLIBRARIES = libaesni.la libsse2.la libssse3.la libsse41.la \
|
||||
libavx2.la libavx512f.la $(am__append_9)
|
||||
libsodium_la_LIBADD = libaesni.la libarmcrypto.la libsse2.la \
|
||||
libssse3.la libsse41.la libavx2.la libavx512f.la \
|
||||
$(am__append_8)
|
||||
noinst_LTLIBRARIES = libaesni.la libarmcrypto.la libsse2.la \
|
||||
libssse3.la libsse41.la libavx2.la libavx512f.la \
|
||||
$(am__append_9)
|
||||
librdrand_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
librdrand_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@CFLAGS_RDRAND@
|
||||
@ -1037,6 +1054,13 @@ librdrand_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
librdrand_la_SOURCES = \
|
||||
randombytes/internal/randombytes_internal_random.c
|
||||
|
||||
libarmcrypto_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
libarmcrypto_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@CFLAGS_ARMCRYPTO@
|
||||
|
||||
libarmcrypto_la_SOURCES = \
|
||||
crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
|
||||
|
||||
libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS)
|
||||
libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
|
||||
@CFLAGS_SSE2@ @CFLAGS_SSSE3@ @CFLAGS_AVX@ @CFLAGS_AESNI@ @CFLAGS_PCLMUL@
|
||||
@ -1192,6 +1216,18 @@ crypto_aead/aes256gcm/aesni/libaesni_la-aead_aes256gcm_aesni.lo: \
|
||||
|
||||
libaesni.la: $(libaesni_la_OBJECTS) $(libaesni_la_DEPENDENCIES) $(EXTRA_libaesni_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libaesni_la_LINK) $(libaesni_la_OBJECTS) $(libaesni_la_LIBADD) $(LIBS)
|
||||
crypto_aead/aes256gcm/armcrypto/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_aead/aes256gcm/armcrypto
|
||||
@: > crypto_aead/aes256gcm/armcrypto/$(am__dirstamp)
|
||||
crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_aead/aes256gcm/armcrypto/$(DEPDIR)
|
||||
@: > crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/$(am__dirstamp)
|
||||
crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo: \
|
||||
crypto_aead/aes256gcm/armcrypto/$(am__dirstamp) \
|
||||
crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/$(am__dirstamp)
|
||||
|
||||
libarmcrypto.la: $(libarmcrypto_la_OBJECTS) $(libarmcrypto_la_DEPENDENCIES) $(EXTRA_libarmcrypto_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libarmcrypto_la_LINK) $(libarmcrypto_la_OBJECTS) $(libarmcrypto_la_LIBADD) $(LIBS)
|
||||
crypto_generichash/blake2b/ref/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_generichash/blake2b/ref
|
||||
@: > crypto_generichash/blake2b/ref/$(am__dirstamp)
|
||||
@ -1249,6 +1285,15 @@ randombytes/internal/librdrand_la-randombytes_internal_random.lo: \
|
||||
|
||||
librdrand.la: $(librdrand_la_OBJECTS) $(librdrand_la_DEPENDENCIES) $(EXTRA_librdrand_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(librdrand_la_LINK) $(am_librdrand_la_rpath) $(librdrand_la_OBJECTS) $(librdrand_la_LIBADD) $(LIBS)
|
||||
crypto_aead/aes256gcm/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_aead/aes256gcm
|
||||
@: > crypto_aead/aes256gcm/$(am__dirstamp)
|
||||
crypto_aead/aes256gcm/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_aead/aes256gcm/$(DEPDIR)
|
||||
@: > crypto_aead/aes256gcm/$(DEPDIR)/$(am__dirstamp)
|
||||
crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo: \
|
||||
crypto_aead/aes256gcm/$(am__dirstamp) \
|
||||
crypto_aead/aes256gcm/$(DEPDIR)/$(am__dirstamp)
|
||||
crypto_aead/chacha20poly1305/sodium/$(am__dirstamp):
|
||||
@$(MKDIR_P) crypto_aead/chacha20poly1305/sodium
|
||||
@: > crypto_aead/chacha20poly1305/sodium/$(am__dirstamp)
|
||||
@ -1945,8 +1990,12 @@ libssse3.la: $(libssse3_la_OBJECTS) $(libssse3_la_DEPENDENCIES) $(EXTRA_libssse3
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
-rm -f crypto_aead/aes256gcm/*.$(OBJEXT)
|
||||
-rm -f crypto_aead/aes256gcm/*.lo
|
||||
-rm -f crypto_aead/aes256gcm/aesni/*.$(OBJEXT)
|
||||
-rm -f crypto_aead/aes256gcm/aesni/*.lo
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/*.$(OBJEXT)
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/*.lo
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/*.$(OBJEXT)
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/*.lo
|
||||
-rm -f crypto_aead/xchacha20poly1305/sodium/*.$(OBJEXT)
|
||||
@ -2091,7 +2140,9 @@ mostlyclean-compile:
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_aead/xchacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_xchacha20poly1305.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@crypto_auth/$(DEPDIR)/libsodium_la-crypto_auth.Plo@am__quote@ # am--include-marker
|
||||
@ -2275,6 +2326,13 @@ crypto_aead/aes256gcm/aesni/libaesni_la-aead_aes256gcm_aesni.lo: crypto_aead/aes
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libaesni_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crypto_aead/aes256gcm/aesni/libaesni_la-aead_aes256gcm_aesni.lo `test -f 'crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c' || echo '$(srcdir)/'`crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c
|
||||
|
||||
crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo: crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarmcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo -MD -MP -MF crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Tpo -c -o crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo `test -f 'crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c' || echo '$(srcdir)/'`crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Tpo crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c' object='crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarmcrypto_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crypto_aead/aes256gcm/armcrypto/libarmcrypto_la-aead_aes256gcm_armcrypto.lo `test -f 'crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c' || echo '$(srcdir)/'`crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c
|
||||
|
||||
crypto_generichash/blake2b/ref/libavx2_la-blake2b-compress-avx2.lo: crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libavx2_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crypto_generichash/blake2b/ref/libavx2_la-blake2b-compress-avx2.lo -MD -MP -MF crypto_generichash/blake2b/ref/$(DEPDIR)/libavx2_la-blake2b-compress-avx2.Tpo -c -o crypto_generichash/blake2b/ref/libavx2_la-blake2b-compress-avx2.lo `test -f 'crypto_generichash/blake2b/ref/blake2b-compress-avx2.c' || echo '$(srcdir)/'`crypto_generichash/blake2b/ref/blake2b-compress-avx2.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crypto_generichash/blake2b/ref/$(DEPDIR)/libavx2_la-blake2b-compress-avx2.Tpo crypto_generichash/blake2b/ref/$(DEPDIR)/libavx2_la-blake2b-compress-avx2.Plo
|
||||
@ -2317,6 +2375,13 @@ randombytes/internal/librdrand_la-randombytes_internal_random.lo: randombytes/in
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(librdrand_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o randombytes/internal/librdrand_la-randombytes_internal_random.lo `test -f 'randombytes/internal/randombytes_internal_random.c' || echo '$(srcdir)/'`randombytes/internal/randombytes_internal_random.c
|
||||
|
||||
crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo: crypto_aead/aes256gcm/aead_aes256gcm.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsodium_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo -MD -MP -MF crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Tpo -c -o crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo `test -f 'crypto_aead/aes256gcm/aead_aes256gcm.c' || echo '$(srcdir)/'`crypto_aead/aes256gcm/aead_aes256gcm.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Tpo crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto_aead/aes256gcm/aead_aes256gcm.c' object='crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsodium_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crypto_aead/aes256gcm/libsodium_la-aead_aes256gcm.lo `test -f 'crypto_aead/aes256gcm/aead_aes256gcm.c' || echo '$(srcdir)/'`crypto_aead/aes256gcm/aead_aes256gcm.c
|
||||
|
||||
crypto_aead/chacha20poly1305/sodium/libsodium_la-aead_chacha20poly1305.lo: crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsodium_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crypto_aead/chacha20poly1305/sodium/libsodium_la-aead_chacha20poly1305.lo -MD -MP -MF crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Tpo -c -o crypto_aead/chacha20poly1305/sodium/libsodium_la-aead_chacha20poly1305.lo `test -f 'crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c' || echo '$(srcdir)/'`crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Tpo crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Plo
|
||||
@ -3015,7 +3080,9 @@ mostlyclean-libtool:
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
-rm -rf crypto_aead/aes256gcm/.libs crypto_aead/aes256gcm/_libs
|
||||
-rm -rf crypto_aead/aes256gcm/aesni/.libs crypto_aead/aes256gcm/aesni/_libs
|
||||
-rm -rf crypto_aead/aes256gcm/armcrypto/.libs crypto_aead/aes256gcm/armcrypto/_libs
|
||||
-rm -rf crypto_aead/chacha20poly1305/sodium/.libs crypto_aead/chacha20poly1305/sodium/_libs
|
||||
-rm -rf crypto_aead/xchacha20poly1305/sodium/.libs crypto_aead/xchacha20poly1305/sodium/_libs
|
||||
-rm -rf crypto_auth/.libs crypto_auth/_libs
|
||||
@ -3304,8 +3371,12 @@ clean-generic:
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-rm -f crypto_aead/aes256gcm/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f crypto_aead/aes256gcm/$(am__dirstamp)
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(am__dirstamp)
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/$(am__dirstamp)
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/$(am__dirstamp)
|
||||
-rm -f crypto_aead/xchacha20poly1305/sodium/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -3476,7 +3547,9 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
clean-noinstLTLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo
|
||||
-rm -f crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Plo
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Plo
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Plo
|
||||
-rm -f crypto_aead/xchacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_xchacha20poly1305.Plo
|
||||
-rm -f crypto_auth/$(DEPDIR)/libsodium_la-crypto_auth.Plo
|
||||
@ -3629,7 +3702,9 @@ install-ps-am:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo
|
||||
-rm -f crypto_aead/aes256gcm/$(DEPDIR)/libsodium_la-aead_aes256gcm.Plo
|
||||
-rm -f crypto_aead/aes256gcm/aesni/$(DEPDIR)/libaesni_la-aead_aes256gcm_aesni.Plo
|
||||
-rm -f crypto_aead/aes256gcm/armcrypto/$(DEPDIR)/libarmcrypto_la-aead_aes256gcm_armcrypto.Plo
|
||||
-rm -f crypto_aead/chacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_chacha20poly1305.Plo
|
||||
-rm -f crypto_aead/xchacha20poly1305/sodium/$(DEPDIR)/libsodium_la-aead_xchacha20poly1305.Plo
|
||||
-rm -f crypto_auth/$(DEPDIR)/libsodium_la-crypto_auth.Plo
|
||||
|
157
src/libsodium/crypto_aead/aes256gcm/aead_aes256gcm.c
Normal file
157
src/libsodium/crypto_aead/aes256gcm/aead_aes256gcm.c
Normal file
@ -0,0 +1,157 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "crypto_aead_aes256gcm.h"
|
||||
#include "private/common.h"
|
||||
#include "randombytes.h"
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_keybytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_KEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_nsecbytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_NSECBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_npubbytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_NPUBBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_abytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_ABYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_statebytes(void)
|
||||
{
|
||||
return (sizeof(crypto_aead_aes256gcm_state) + (size_t) 15U) & ~(size_t) 15U;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_messagebytes_max(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_MESSAGEBYTES_MAX;
|
||||
}
|
||||
|
||||
void
|
||||
crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
|
||||
{
|
||||
randombytes_buf(k, crypto_aead_aes256gcm_KEYBYTES);
|
||||
}
|
||||
|
||||
#if !((defined(HAVE_ARMCRYPTO) && defined(__clang__) && defined(NATIVE_LITTLE_ENDIAN)) || \
|
||||
(defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)))
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS ENXIO
|
||||
#endif
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_detached(unsigned char *c, unsigned char *mac,
|
||||
unsigned long long *maclen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_detached(unsigned char *m, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *mac, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt(unsigned char *m, unsigned long long *mlen_p, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *ad, unsigned long long adlen,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *st_, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c, unsigned char *mac,
|
||||
unsigned long long *maclen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c, unsigned long long *clen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *ad, unsigned long long adlen,
|
||||
const unsigned char *nsec, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *mac, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m, unsigned long long *mlen_p,
|
||||
unsigned char *nsec, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_is_available(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -17,7 +17,7 @@
|
||||
#if defined(HAVE_TMMINTRIN_H) && defined(HAVE_WMMINTRIN_H)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC target("aes,pclmul,avx")
|
||||
#pragma GCC target("avx,aes,pclmul")
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER < 1800
|
||||
@ -442,6 +442,11 @@ aes_gcm_encrypt_generic(const State *st, GHash *sth, unsigned char mac[ABYTES],
|
||||
counter = incr_counters(rev_counters, counter, PARALLEL_BLOCKS);
|
||||
encrypt_xor_wide(st, dst + i, src + i, rev_counters);
|
||||
|
||||
PREFETCH_READ(src + i + PARALLEL_BLOCKS * 16);
|
||||
#if PARALLEL_BLOCKS >= 64 / 16
|
||||
PREFETCH_READ(src + i + PARALLEL_BLOCKS * 16 + 64);
|
||||
#endif
|
||||
|
||||
pi = i - PARALLEL_BLOCKS * 16;
|
||||
u = gh_update0(sth, dst + pi, st->hx[2 * PARALLEL_BLOCKS - 1 - 0]);
|
||||
for (j = 1; j < PARALLEL_BLOCKS; j += 1) {
|
||||
@ -452,6 +457,10 @@ aes_gcm_encrypt_generic(const State *st, GHash *sth, unsigned char mac[ABYTES],
|
||||
encrypt_xor_wide(st, dst + i + PARALLEL_BLOCKS * 16, src + i + PARALLEL_BLOCKS * 16,
|
||||
rev_counters);
|
||||
|
||||
PREFETCH_READ(src + i + 2 * PARALLEL_BLOCKS * 16);
|
||||
#if PARALLEL_BLOCKS >= 64 / 16
|
||||
PREFETCH_READ(src + i + 2 * PARALLEL_BLOCKS * 16 + 64);
|
||||
#endif
|
||||
pi = i;
|
||||
for (j = 0; j < PARALLEL_BLOCKS; j += 1) {
|
||||
gh_update(&u, dst + pi + j * 16, st->hx[PARALLEL_BLOCKS - 1 - j]);
|
||||
@ -746,7 +755,7 @@ crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c, unsigned char *
|
||||
}
|
||||
gh_required_blocks = required_blocks(ad_len, m_len);
|
||||
if (gh_required_blocks == 0) {
|
||||
memset(mac, 0x00, ABYTES);
|
||||
memset(mac, 0xd0, ABYTES);
|
||||
memset(c, 0, m_len);
|
||||
return -1;
|
||||
}
|
||||
@ -921,7 +930,7 @@ crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m, unsigned char *
|
||||
|
||||
if (crypto_verify_16(mac, computed_mac) != 0) {
|
||||
sodium_memzero(computed_mac, sizeof computed_mac);
|
||||
memset(m, 0x00, m_len);
|
||||
memset(m, 0xd0, m_len);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -997,152 +1006,4 @@ crypto_aead_aes256gcm_is_available(void)
|
||||
return sodium_runtime_has_pclmul() & sodium_runtime_has_aesni() & sodium_runtime_has_avx();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifndef ENOSYS
|
||||
#define ENOSYS ENXIO
|
||||
#endif
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_detached(unsigned char *c, unsigned char *mac,
|
||||
unsigned long long *maclen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt(unsigned char *c, unsigned long long *clen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_detached(unsigned char *m, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *mac, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt(unsigned char *m, unsigned long long *mlen_p, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *ad, unsigned long long adlen,
|
||||
const unsigned char *npub, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state *st_, const unsigned char *k)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_detached_afternm(unsigned char *c, unsigned char *mac,
|
||||
unsigned long long *maclen_p, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *nsec,
|
||||
const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_encrypt_afternm(unsigned char *c, unsigned long long *clen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *ad, unsigned long long adlen,
|
||||
const unsigned char *nsec, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_detached_afternm(unsigned char *m, unsigned char *nsec,
|
||||
const unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *mac, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_decrypt_afternm(unsigned char *m, unsigned long long *mlen_p,
|
||||
unsigned char *nsec, const unsigned char *c,
|
||||
unsigned long long clen, const unsigned char *ad,
|
||||
unsigned long long adlen, const unsigned char *npub,
|
||||
const crypto_aead_aes256gcm_state *st_)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
crypto_aead_aes256gcm_is_available(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_keybytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_KEYBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_nsecbytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_NSECBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_npubbytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_NPUBBYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_abytes(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_ABYTES;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_statebytes(void)
|
||||
{
|
||||
return (sizeof(crypto_aead_aes256gcm_state) + (size_t) 15U) & ~(size_t) 15U;
|
||||
}
|
||||
|
||||
size_t
|
||||
crypto_aead_aes256gcm_messagebytes_max(void)
|
||||
{
|
||||
return crypto_aead_aes256gcm_MESSAGEBYTES_MAX;
|
||||
}
|
||||
|
||||
void
|
||||
crypto_aead_aes256gcm_keygen(unsigned char k[crypto_aead_aes256gcm_KEYBYTES])
|
||||
{
|
||||
randombytes_buf(k, crypto_aead_aes256gcm_KEYBYTES);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -197,6 +197,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -11,6 +11,9 @@ extern "C" {
|
||||
SODIUM_EXPORT_WEAK
|
||||
int sodium_runtime_has_neon(void);
|
||||
|
||||
SODIUM_EXPORT_WEAK
|
||||
int sodium_runtime_has_armcrypto(void);
|
||||
|
||||
SODIUM_EXPORT_WEAK
|
||||
int sodium_runtime_has_sse2(void);
|
||||
|
||||
|
@ -3,6 +3,14 @@
|
||||
#ifdef HAVE_ANDROID_GETCPUFEATURES
|
||||
# include <cpu-features.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
# include <sys/types.h>
|
||||
# include <sys/sysctl.h>
|
||||
# include <mach/machine.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_AUXV_H
|
||||
# include <sys/auxv.h>
|
||||
#endif
|
||||
|
||||
#include "private/common.h"
|
||||
#include "runtime.h"
|
||||
@ -10,6 +18,7 @@
|
||||
typedef struct CPUFeatures_ {
|
||||
int initialized;
|
||||
int has_neon;
|
||||
int has_armcrypto;
|
||||
int has_sse2;
|
||||
int has_sse3;
|
||||
int has_ssse3;
|
||||
@ -48,25 +57,94 @@ static CPUFeatures _cpu_features;
|
||||
static int
|
||||
_sodium_runtime_arm_cpu_features(CPUFeatures * const cpu_features)
|
||||
{
|
||||
#ifndef __arm__
|
||||
cpu_features->has_neon = 0;
|
||||
return -1;
|
||||
#else
|
||||
# ifdef __APPLE__
|
||||
# ifdef __ARM_NEON__
|
||||
cpu_features->has_armcrypto = 0;
|
||||
|
||||
#ifndef __ARM_ARCH
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64)
|
||||
cpu_features->has_neon = 1;
|
||||
# else
|
||||
cpu_features->has_neon = 0;
|
||||
# endif
|
||||
# elif defined(HAVE_ANDROID_GETCPUFEATURES) && \
|
||||
defined(ANDROID_CPU_ARM_FEATURE_NEON)
|
||||
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_NEON)
|
||||
cpu_features->has_neon =
|
||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0x0;
|
||||
# else
|
||||
cpu_features->has_neon = 0;
|
||||
#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 1)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_neon = (buf & (1L << 1)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#elif defined(__arm__) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_neon = (getauxval(AT_HWCAP) & (1L << 12)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_neon = (buf & (1L << 12)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (cpu_features->has_neon == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if __ARM_FEATURE_CRYPTO
|
||||
cpu_features->has_armcrypto = 1;
|
||||
#elif defined(_M_ARM64)
|
||||
cpu_features->has_armcrypto = 1; /* assuming all CPUs supported by ARM Windows have the crypto extensions */
|
||||
#elif defined(__APPLE__) && defined(CPU_TYPE_ARM64) && defined(CPU_SUBTYPE_ARM64E)
|
||||
{
|
||||
cpu_type_t cpu_type;
|
||||
cpu_subtype_t cpu_subtype;
|
||||
size_t cpu_type_len = sizeof cpu_type;
|
||||
size_t cpu_subtype_len = sizeof cpu_subtype;
|
||||
|
||||
if (sysctlbyname("hw.cputype", &cpu_type, &cpu_type_len,
|
||||
NULL, 0) == 0 && cpu_type == CPU_TYPE_ARM64 &&
|
||||
sysctlbyname("hw.cpusubtype", &cpu_subtype, &cpu_subtype_len,
|
||||
NULL, 0) == 0 &&
|
||||
(cpu_subtype == CPU_SUBTYPE_ARM64E ||
|
||||
cpu_subtype == CPU_SUBTYPE_ARM64_V8)) {
|
||||
cpu_features->has_armcrypto = 1;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_ANDROID_GETCPUFEATURES) && defined(ANDROID_CPU_ARM_FEATURE_AES)
|
||||
cpu_features->has_armcrypto =
|
||||
(android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_AES) != 0x0;
|
||||
#elif (defined(__aarch64__) || defined(_M_ARM64)) && defined(AT_HWCAP)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_armcrypto = (getauxval(AT_HWCAP) & (1L << 3)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_armcrypto = (buf & (1L << 3)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#elif defined(__arm__) && defined(AT_HWCAP2)
|
||||
# ifdef HAVE_GETAUXVAL
|
||||
cpu_features->has_armcrypto = (getauxval(AT_HWCAP2) & (1L << 0)) != 0;
|
||||
# elif defined(HAVE_ELF_AUX_INFO)
|
||||
{
|
||||
unsigned long buf;
|
||||
if (elf_aux_info(AT_HWCAP2, (void *) &buf, (int) sizeof buf) == 0) {
|
||||
cpu_features->has_armcrypto = (buf & (1L << 0)) != 0;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -116,11 +194,10 @@ static int
|
||||
_sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features)
|
||||
{
|
||||
unsigned int cpu_info[4];
|
||||
unsigned int id;
|
||||
uint32_t xcr0 = 0U;
|
||||
|
||||
_cpuid(cpu_info, 0x0);
|
||||
if ((id = cpu_info[0]) == 0U) {
|
||||
if (cpu_info[0] == 0U) {
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
_cpuid(cpu_info, 0x00000001);
|
||||
@ -248,6 +325,12 @@ sodium_runtime_has_neon(void)
|
||||
return _cpu_features.has_neon;
|
||||
}
|
||||
|
||||
int
|
||||
sodium_runtime_has_armcrypto(void)
|
||||
{
|
||||
return _cpu_features.has_armcrypto;
|
||||
}
|
||||
|
||||
int
|
||||
sodium_runtime_has_sse2(void)
|
||||
{
|
||||
|
@ -208,6 +208,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
@ -752,6 +752,7 @@ CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CFLAGS_AESNI = @CFLAGS_AESNI@
|
||||
CFLAGS_ARMCRYPTO = @CFLAGS_ARMCRYPTO@
|
||||
CFLAGS_AVX = @CFLAGS_AVX@
|
||||
CFLAGS_AVX2 = @CFLAGS_AVX2@
|
||||
CFLAGS_AVX512F = @CFLAGS_AVX512F@
|
||||
|
Loading…
Reference in New Issue
Block a user