Configure: add framework for ChaCha and Poly1305 assembly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Andy Polyakov 2015-12-12 12:29:37 +01:00
parent 0c14d44254
commit 22c2e80f89
4 changed files with 27 additions and 6 deletions

View File

@ -215,6 +215,8 @@ my $BSDthreads="-pthread -D_THREAD_SAFE -D_REENTRANT";
# cmll_obj => $cmll_obj,
# modes_obj => $modes_obj,
# engines_obj => $engines_obj,
# chacha_obj => $wp_obj,
# poly1305_obj => $cmll_obj,
# dso_scheme => $dso_scheme,
# shared_target => $shared_target,
# shared_cflag => $shared_cflag,
@ -796,6 +798,7 @@ my $cast_enc="c_enc.o";
my $rc4_enc="rc4_enc.o rc4_skey.o";
my $rc5_enc="rc5_enc.o";
my $cmll_enc="camellia.o cmll_misc.o cmll_cbc.o";
my $chacha_enc="chacha_enc.o";
my $processor="";
my $default_ranlib;
my $perl;
@ -1382,6 +1385,8 @@ my $wp_obj = $table{$target}->{wp_obj};
my $cmll_obj = $table{$target}->{cmll_obj};
my $modes_obj = $table{$target}->{modes_obj};
my $engines_obj = $table{$target}->{engines_obj};
my $chacha_obj = $table{$target}->{chacha_obj};
my $poly1305_obj = $table{$target}->{poly1305_obj};
my $perlasm_scheme = $table{$target}->{perlasm_scheme};
my $dso_scheme = $table{$target}->{dso_scheme};
my $shared_target = $table{$target}->{shared_target};
@ -1492,7 +1497,8 @@ if ($no_asm)
{
$cpuid_obj=$bn_obj=$ec_obj=
$des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
$modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj=
$chacha_obj=$poly1305_obj="";
$cflags=~s/\-D[BL]_ENDIAN// if ($fips);
$thread_cflags=~s/\-D[BL]_ENDIAN// if ($fips);
}
@ -1711,6 +1717,11 @@ if ($ec_obj =~ /ecp_nistz256/)
{
$cflags.=" -DECP_NISTZ256_ASM";
}
$chacha_obj=$chacha_enc unless ($chacha_obj =~ /\.o$/);
if ($poly1305_obj =~ /\.o$/)
{
$cflags.=" -DPOLY1305_ASM";
}
# "Stringify" the C flags string. This permits it to be made part of a string
# and works as well on command lines.
@ -1850,6 +1861,8 @@ while (<IN>)
s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
s/^CHACHA_ENC=.*$/CHACHA_ENC= $chacha_obj/;
s/^POLY1305_ASM_OBJ=.*$/POLY1305_ASM_OBJ= $poly1305_obj/;
s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
s/^PROCESSOR=.*/PROCESSOR= $processor/;
@ -1909,6 +1922,8 @@ print "RMD160_OBJ_ASM=$rmd160_obj\n";
print "CMLL_ENC =$cmll_obj\n";
print "MODES_OBJ =$modes_obj\n";
print "ENGINES_OBJ =$engines_obj\n";
print "CHACHA_ENC =$chacha_obj\n";
print "POLY1305_OBJ =$poly1305_obj\n";
print "PROCESSOR =$processor\n";
print "RANLIB =$ranlib\n";
print "ARFLAGS =$arflags\n";
@ -2337,6 +2352,8 @@ sub print_table_entry
\$cmll_obj = $table{$target}->{cmll_obj}
\$modes_obj = $table{$target}->{modes_obj}
\$engines_obj = $table{$target}->{engines_obj}
\$chacha_obj = $table{$target}->{chacha_obj}
\$poly1305_obj = $table{$target}->{poly1305_obj}
\$perlasm_scheme = $table{$target}->{perlasm_scheme}
\$dso_scheme = $table{$target}->{dso_scheme}
\$shared_target= $table{$target}->{shared_target}
@ -2376,6 +2393,8 @@ EOF
"cmll_obj",
"modes_obj",
"engines_obj",
"chacha_obj",
"poly1305_obj",
"perlasm_scheme",
"dso_scheme",
"shared_target",

View File

@ -104,6 +104,8 @@ WP_ASM_OBJ=
CMLL_ENC=
MODES_ASM_OBJ=
ENGINES_ASM_OBJ=
CHACHA_ENC= chacha_enc.o
POLY1305_ASM_OBJ=
PERLASM_SCHEME=
# Zlib stuff
@ -235,6 +237,8 @@ BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
WP_ASM_OBJ='$(WP_ASM_OBJ)' \
MODES_ASM_OBJ='$(MODES_ASM_OBJ)' \
ENGINES_ASM_OBJ='$(ENGINES_ASM_OBJ)' \
CHACHA_ENC='$(CHACHA_ENC)' \
POLY1305_ASM_OBJ='$(POLY1305_ASM_OBJ)' \
PERLASM_SCHEME='$(PERLASM_SCHEME)' \
FIPSLIBDIR='${FIPSLIBDIR}' \
FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}" \

View File

@ -17,8 +17,6 @@ ASFLAGS= $(INCLUDES) $(ASFLAG)
AFLAGS= $(ASFLAGS)
GENERAL=Makefile
TEST=chachatest.c
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC=chacha_enc.c

View File

@ -10,17 +10,17 @@ INCLUDES=
CFLAG=-g
AR= ar r
POLY1305_ASM_OBJ=
CFLAGS= $(INCLUDES) $(CFLAG)
ASFLAGS= $(INCLUDES) $(ASFLAG)
AFLAGS= $(ASFLAGS)
GENERAL=Makefile
TEST=
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC=poly1305.c
LIBOBJ=poly1305.o
LIBOBJ=poly1305.o $(POLY1305_ASM_OBJ)
SRC= $(LIBSRC)