• Andrew Morton's avatar
    [CRYPTO]: reduce sha512_transform() stack usage, speedup · e0abaeba
    Andrew Morton authored
    Patch moves large temporary u64 W[80] from stack to ctx struct:
    
    * reduces stack usage by 640 bytes
    * saves one 640-byte memset() per sha512_transform()
      (we still do it after *all* iterations are done)
    * quite unexpectedly saves 1.6k of code on i386
      because stack offsets now fit into 8bits
      and many stack addressing insns got 3 bytes smaller:
    
    # size sha512.o.org sha512.o
    text       data     bss     dec     hex filename
    8281        372       0    8653    21cd sha512.o.org
    6649        372       0    7021    1b6d sha512.o
    
    # objdump -d sha512.o.org | cut -b9- >sha512.d.org
    # objdump -d sha512.o | cut -b9- >sha512.d
    # diff -u sha512.d.org sha512.d
    [snip]
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e0abaeba
sha512.c 10.8 KB