bn_ops not being used in Android recipes

Jeffrey Walton noloader at gmail.com
Sun Mar 8 11:20:34 UTC 2020


Hi Everyone,

I have a custom 15-android.conf that is used with a custom
setenv-android.sh. setenv-android.sh sets the environment and exports
the necessary variables for a cross-compile. 15-android.conf was
copied from the OpenSSL library, and then modified to avoid some
problems with the one supplied with the library that leads to a failed
compile under NDK-r20.

#### Android...
my %targets = (
    "android" => {
        inherit_from     => [ "linux-generic32" ],
        template         => 1,
        bin_cflags       => add("-fPIE"),
        bin_lflags       => add("-pie"),
        enable           => [ ],
    },

    "android-arm" => {
        inherit_from     => [ "android", asm("armv4_asm") ],
        bn_ops           => add("BN_LLONG RC4_CHAR"),
    },
    "android-arm64" => {
        inherit_from     => [ "android", asm("aarch64_asm") ],
        bn_ops           => add("SIXTY_FOUR_BIT_LONG RC4_CHAR"),
        perlasm_scheme   => "linux64",
    },

    "android-x86" => {
        inherit_from     => [ "android", asm("x86_asm") ],
        CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
        bn_ops           => add("BN_LLONG RC4_INT"),
        perlasm_scheme   => "android",
    },
    "android-x86_64" => {
        inherit_from     => [ "android", asm("x86_64_asm") ],
        bn_ops           => add("SIXTY_FOUR_BIT_LONG RC4_INT"),
        perlasm_scheme   => "elf",
    },
);

It looks like bn_ops are not being honored. For example, OpenSSL was
configured for android-x86_64, but SIXTY_FOUR_BIT_LONG and RC4_INT are
missing:

x86_64-linux-android23-clang -I. -Icrypto/include -Iinclude -fPIC
-pthread -march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables
-fexceptions --sysroot=/home/travis/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
-DOPENSSL_USE_NODELETE -DOPENSSL_PIC
-DOPENSSLDIR="\"/home/travis/android23-x86_64\""
-DENGINESDIR="\"/home/travis/android23-x86_64/lib/engines-1.1\""
-DNDEBUG -D__ANDROID_API__=23 -MMD -MF crypto/bn/bn_add.d.tmp -MT
crypto/bn/bn_add.o -c -o crypto/bn/bn_add.o crypto/bn/bn_add.c

x86_64-linux-android23-clang  -I. -Icrypto/include -Iinclude -fPIC
-pthread -march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables
-fexceptions --sysroot=/home/travis/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot
-DOPENSSL_USE_NODELETE -DOPENSSL_PIC
-DOPENSSLDIR="\"/home/travis/android23-x86_64\""
-DENGINESDIR="\"/home/travis/android23-x86_64/lib/engines-1.1\""
-DNDEBUG -D__ANDROID_API__=23 -MMD -MF crypto/bn/bn_asm.d.tmp -MT
crypto/bn/bn_asm.o -c -o crypto/bn/bn_asm.o crypto/bn/bn_asm.c
crypto/bn/bn_asm.c:28:9: warning: shift count >= width of type
      [-Wshift-count-overflow]
        mul_add(rp[0], ap[0], w, c1);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
crypto/bn/bn_lcl.h:475:14: note: expanded from macro 'mul_add'

        (c)= Hw(t); \
             ^~~~~
crypto/bn/bn_lcl.h:469:36: note: expanded from macro 'Hw'
#  define Hw(t)    (((BN_ULONG)((t)>>BN_BITS2))&BN_MASK2)

The full build is available at
https://travis-ci.org/noloader/unbound/jobs/659771319.

How do I get the machinery to use bn_ops?

Jeff


More information about the openssl-users mailing list