• Dave Martin's avatar
    ARM: 7626/1: arm/crypto: Make asm SHA-1 and AES code Thumb-2 compatible · 638591cd
    Dave Martin authored
    This patch fixes aes-armv4.S and sha1-armv4-large.S to work
    natively in Thumb.  This allows ARM/Thumb interworking workarounds
    to be removed.
    
    I also take the opportunity to convert some explicit assembler
    directives for exported functions to the standard
    ENTRY()/ENDPROC().
    
    For the code itself:
    
      * In sha1_block_data_order, use of TEQ with sp is deprecated in
        ARMv7 and not supported in Thumb.  For the branches back to
        .L_00_15 and .L_40_59, the TEQ is converted to a CMP, under the
        assumption that clobbering the C flag here will not cause
        incorrect behaviour.
    
        For the first branch back to .L_20_39_or_60_79 the C flag is
        important, so sp is moved temporarily into another register so
        that TEQ can be used for the comparison.
    
      * In the AES code, most forms of register-indexed addressing with
        shifts and rotates are not permitted for loads and stores in
        Thumb, so the address calculation is done using a separate
        instruction for the Thumb case.
    
    The resulting code is unlikely to be optimally scheduled, but it
    should not have a large impact given the overall size of the code.
    I haven't run any benchmarks.
    Signed-off-by: default avatarDave Martin <dave.martin@linaro.org>
    Tested-by: David McCullough <ucdevel@gmail.com> (ARM only)
    Acked-by: default avatarDavid McCullough <ucdevel@gmail.com>
    Acked-by: default avatarNicolas Pitre <nico@linaro.org>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    638591cd
sha1-armv4-large.S 13 KB