2004-10-03 10:55:35

by Denis Vlasenko

[permalink] [raw]
Subject: [PATCH] sha512: use asm-optimized bit rotation

On top of 2.6.9-rc3 + "reduce sha512_transform() stack usage" +
+ "add rotate left/right ops to bitops.h" patches.

Switches sha512 to asm-optimized 64bit rotation.
Reduces sha512 code size by ~300 insns, ~1K:

# size sha512.o.old sha512.o
text data bss dec hex filename
6642 364 0 7006 1b5e sha512.o.old
5587 364 0 5951 173f sha512.o

Run-tested with tcrypt module.

I also looked into optimizing cast[56] and sha256 by replacing
their 32bit rotation functions/macros, but it had no measurable effect
on i386. gcc seems to be on par with asm there.
--
vda


Attachments:
(No filename) (613.00 B)
sha512.c.rot64.diff (1.18 kB)
Download all attachments