• Dave Martin's avatar
    ARM: 7626/1: arm/crypto: Make asm SHA-1 and AES code Thumb-2 compatible · 6111b520
    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.
    
    Change-Id: I8b015aa239e5513d43680d82aeb93db07c5adf9f
    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>
    6111b520
aes-armv4.S 27.8 KB