[PATCH] twofish: add ARMv6 assembly implementation
jussi.kivilinna at iki.fi
Mon Oct 21 21:34:55 CEST 2013
On 21.10.2013 18:35, Dmitry Eremin-Solenikov wrote:
> On Mon, Oct 21, 2013 at 5:21 PM, Jussi Kivilinna <jussi.kivilinna at iki.fi> wrote:
>> * cipher/Makefile.am: Add 'twofish-armv6.S'.
>> * cipher/twofish-armv6.S: New.
>> * cipher/twofish.c (USE_ARMV6_ASM): New macro.
>> [USE_ARMV6_ASM] (_gcry_twofish_armv6_encrypt_block)
>> (_gcry_twofish_armv6_decrypt_block): New prototypes.
>> [USE_AMDV6_ASM] (twofish_encrypt, twofish_decrypt): Add.
>> [USE_AMD64_ASM] (do_twofish_encrypt, do_twofish_decrypt): Remove.
>> (_gcry_twofish_ctr_enc, _gcry_twofish_cfb_dec): Use 'twofish_encrypt'
>> instead of 'do_twofish_encrypt'.
>> (_gcry_twofish_cbc_dec): Use 'twofish_decrypt' instead of
>> * configure.ac [arm]: Add 'twofish-armv6.lo'.
> Some time ago I have looked into adapting asm optimizations to earlier
> ARM cores.
> The main problem was rev instruction, which I conditionally replaced
> with 4 insns.
> My current code is present at
> https://github.com/GostCrypt/libgcrypt/commits/arm-opt .
> The main remaining issue is HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS test
> in configure.ac. It is too restrictive. E.g. it fails if gcc is
> configured to default to armv4te.
> Also it has .thumb directive, however all assembler files are compiled
> in arm mode.
> If I comment out add.w and ,thumb/.code16 lines, I can build code even for armv4
> (no thumb), qemu-verified. Code built for armv4t/armv5te successfully
> verified on armv5te
> core (XScale). Would you have any suggestions on improving/adapting
> this configure test?
Well, what I try to do here is to check that '.syntax unified' works and
is not ignored by assembler. But if asm code works even if '.syntax unified'
is ignored, that part of check can be removed.
So following should/might be enough:
AC_CACHE_CHECK([whether GCC assembler is compatible for ARM assembly implementations],
"add %r0, %r4, %r8, ror #12;\n\t"
/* Test if '.type' and '.size' are supported. */
More information about the Gcrypt-devel