More portability tweaks.

Handle platform specific yasm parameters.
Resolve namespace conflict on OSX.
Do not build Skein ASM code on OSX.
This commit is contained in:
Moinak Ghosh 2014-04-30 22:46:24 +05:30
parent 6fba8aa8ac
commit f2da433188
6 changed files with 24 additions and 8 deletions

View file

@ -166,7 +166,7 @@ SHA2ASM_SRCS = crypto/sha2/intel/sha512_avx.asm crypto/sha2/intel/sha512_sse4.as
SHA2ASM_OBJS = $(SHA2ASM_SRCS:.asm=.o)
SHA2_OBJS = $(SHA2_SRCS:.c=.o)
YASM = @YASM@ -f x64 -f elf64 -X gnu -g dwarf2 -D LINUX
YASM = @YASM@
LIBBSCWRAP = libbsc_compress.c
LIBBSCWRAPOBJ = libbsc_compress.o
LIBBSCDIR = @LIBBSCDIR@

22
config
View file

@ -74,6 +74,8 @@ sha256asmobjs=
sha256objs=
keylen=
yasm=yasm
yasm_params_linux="-f x64 -f elf64 -X gnu -g dwarf2 -D LINUX"
yasm_params_osx="-f macho64 -X gnu -p gas"
keccak_srcs=
keccak_hdrs=
keccak_srcs_asm=
@ -274,7 +276,10 @@ fi
echo $plat | egrep 'x86_64|amd64' > /dev/null
if [ $? -eq 0 ]
then
skeinblock='\$\(SKEIN_BLOCK_ASM\)'
if [ "$OS" != "Darwin" ]
then
skeinblock='\$\(SKEIN_BLOCK_ASM\)'
fi
yasm=
#
@ -304,6 +309,17 @@ then
exit 1
fi
if [ "$OS" = "Linux" ]
then
yasm="${yasm} ${yasm_params_linux}"
elif [ "$OS" = "Darwin" ]
then
yasm="${yasm} ${yasm_params_osx}"
elif [ "$OS" = "SunOS" ]
then
yasm="${yasm} ${yasm_params_linux}"
fi
if [ $debug -eq 1 ]
then
keccak_srcs='\$\(KECCAK_SRC_OPT64\)'
@ -436,7 +452,7 @@ else
echo "Yes."
fi
rm -f tst*
rm -rf tst*
openssl_libdir="${openssl_libdir},--enable-new-dtags"
# Detect other library packages
@ -581,7 +597,7 @@ then
echo "Libarchive version 3.0 or newer is required."
exit 1
fi
rm -f tst tst.c
rm -rf tst* tst.c
echo "Generating Makefile ..."
linkvar="LINK"

View file

@ -130,7 +130,7 @@ static const uint64_t iv256[SHA512_HASH_WORDS] = {
static update_func_ptr sha512_update_func;
int
APS_NAMESPACE(Init_SHA512) (processor_info_t *pc)
APS_NAMESPACE(Init_SHA512) (processor_cap_t *pc)
{
if (pc->proc_type == PROC_X64_INTEL || pc->proc_type == PROC_X64_AMD) {
if (pc->avx_level > 0) {

View file

@ -97,7 +97,7 @@ extern "C" {
void APS_NAMESPACE(SHA512_Init) (SHA512_Context *sc);
void APS_NAMESPACE(SHA512_Update) (SHA512_Context *sc, const void *data, size_t len);
void APS_NAMESPACE(SHA512_Final) (SHA512_Context *sc, uint8_t hash[SHA512_HASH_SIZE]);
int APS_NAMESPACE(Init_SHA512) (processor_info_t *pc);
int APS_NAMESPACE(Init_SHA512) (processor_cap_t *pc);
/* As are SHA-512/256 and SHA-512/224 */
#define SHA512t256_Context SHA512_Context

View file

@ -247,7 +247,7 @@ read_config(char *configfile, archive_config_t *cfg)
}
} else if (strncmp(line, "ARCHIVESZ", 9) == 0) {
int ovr;
ssize_t arch_sz;
int64_t arch_sz;
ovr = parse_numeric(&arch_sz, pos);
if (ovr == 1) {
log_msg(LOG_ERR, 0, "ARCHIVESZ value too large.\n");

View file

@ -29,7 +29,7 @@
int
main(void)
{
processor_info_t pc;
processor_cap_t pc;
cpuid_basic_identify(&pc);
if (pc.sse_level == 3 && pc.sse_sub_level == 1) {
printf("ssse%d", pc.sse_level);