| 1 |
include_directories(../../include) |
| 2 |
option(ENABLE_NDK_ARM_WORKAROUND "Enable workaround for clang compiler in NDK r18+ failing to compile aes-armv4.S" OFF) |
| 3 |
|
| 4 |
if (${ARCH} STREQUAL "x86_64") |
| 5 |
set( |
| 6 |
AES_ARCH_SOURCES |
| 7 |
|
| 8 |
aes-x86_64.${ASM_EXT} |
| 9 |
aesni-x86_64.${ASM_EXT} |
| 10 |
bsaes-x86_64.${ASM_EXT} |
| 11 |
vpaes-x86_64.${ASM_EXT} |
| 12 |
) |
| 13 |
endif() |
| 14 |
|
| 15 |
if (${ARCH} STREQUAL "x86") |
| 16 |
set( |
| 17 |
AES_ARCH_SOURCES |
| 18 |
|
| 19 |
aes-586.${ASM_EXT} |
| 20 |
vpaes-x86.${ASM_EXT} |
| 21 |
aesni-x86.${ASM_EXT} |
| 22 |
) |
| 23 |
endif() |
| 24 |
|
| 25 |
if (${ARCH} STREQUAL "arm") |
| 26 |
set( |
| 27 |
AES_ARCH_SOURCES |
| 28 |
|
| 29 |
aes-armv4.${ASM_EXT} |
| 30 |
bsaes-armv7.${ASM_EXT} |
| 31 |
aesv8-armx.${ASM_EXT} |
| 32 |
) |
| 33 |
if (ENABLE_NDK_ARM_WORKAROUND) |
| 34 |
# |
| 35 |
# This isn't really *for* Apple, it's for clang in general, but somebody sometime |
| 36 |
# ago chose to use __APPLE__ because back then clang was used by default only on |
| 37 |
# macOS. Android NDK r18 and newer dropped gcc and uses only clang, thus the need |
| 38 |
# to work around the build issue if the symbol is not defined: |
| 39 |
# |
| 40 |
# [...]sdks/builds/android-armeabi-v7a-debug/mono/btls/build-shared/boringssl/crypto/aes/aes-armv4.S:363:2: error: out of range immediate fixup value |
| 41 |
# sub r10,r3,#asm_AES_encrypt-AES_Te @ Te |
| 42 |
# ^ |
| 43 |
# [...]sdks/builds/android-armeabi-v7a-debug/mono/btls/build-shared/boringssl/crypto/aes/aes-armv4.S:1010:2: error: out of range immediate fixup value |
| 44 |
# sub r10,r3,#asm_AES_decrypt-AES_Td @ Td |
| 45 |
# ^ |
| 46 |
# |
| 47 |
add_definitions(-D__APPLE__) |
| 48 |
endif() |
| 49 |
endif() |
| 50 |
|
| 51 |
if (${ARCH} STREQUAL "aarch64") |
| 52 |
set( |
| 53 |
AES_ARCH_SOURCES |
| 54 |
|
| 55 |
aesv8-armx.${ASM_EXT} |
| 56 |
) |
| 57 |
endif() |
| 58 |
|
| 59 |
add_library( |
| 60 |
aes |
| 61 |
|
| 62 |
OBJECT |
| 63 |
|
| 64 |
aes.c |
| 65 |
mode_wrappers.c |
| 66 |
|
| 67 |
${AES_ARCH_SOURCES} |
| 68 |
) |
| 69 |
|
| 70 |
perlasm(aes-x86_64.${ASM_EXT} asm/aes-x86_64.pl) |
| 71 |
perlasm(aesni-x86_64.${ASM_EXT} asm/aesni-x86_64.pl) |
| 72 |
perlasm(bsaes-x86_64.${ASM_EXT} asm/bsaes-x86_64.pl) |
| 73 |
perlasm(vpaes-x86_64.${ASM_EXT} asm/vpaes-x86_64.pl) |
| 74 |
perlasm(aes-586.${ASM_EXT} asm/aes-586.pl) |
| 75 |
perlasm(vpaes-x86.${ASM_EXT} asm/vpaes-x86.pl) |
| 76 |
perlasm(aesni-x86.${ASM_EXT} asm/aesni-x86.pl) |
| 77 |
perlasm(aes-armv4.${ASM_EXT} asm/aes-armv4.pl) |
| 78 |
perlasm(bsaes-armv7.${ASM_EXT} asm/bsaes-armv7.pl) |
| 79 |
perlasm(aesv8-armx.${ASM_EXT} asm/aesv8-armx.pl) |
| 80 |
|
| 81 |
if(ENABLE_TESTS) |
| 82 |
add_executable( |
| 83 |
aes_test |
| 84 |
|
| 85 |
aes_test.cc |
| 86 |
$<TARGET_OBJECTS:test_support> |
| 87 |
) |
| 88 |
|
| 89 |
target_link_libraries(aes_test crypto) |
| 90 |
add_dependencies(all_tests aes_test) |
| 91 |
endif() |