TrenchBoot / landing-zone

An open source implementation of an AMD-V Secure Loader.
GNU General Public License v2.0
23 stars 7 forks source link

sha1: Roll iterations inside transform() into loop #27

Closed andyhhp closed 4 years ago

andyhhp commented 4 years ago

Use 5-round unrolled loops to keep the a..e variables consistent with before. The change in key schedule at round 16 is awkward, so leave that block as it was previously.

Passing a non-constant into M() requires more brackets to produce the correct logic, so take the opportunity to simplify it, by pulling out the logic look up in x mod 16, and drop the temporary variable entirely.

64: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2458 (-2458) Function old new delta transform 4433 1975 -2458 Total: Before=55933, After=53475, chg -4.39%

32: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2140 (-2140) Function old new delta transform 4048 1908 -2140 Total: Before=27030, After=24890, chg -7.92%

lto.64: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2458 (-2458) Function old new delta transform 4433 1975 -2458 Total: Before=55466, After=53008, chg -4.43%

lto.32: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-2140 (-2140) Function old new delta transform 4048 1908 -2140 Total: Before=26298, After=24158, chg -8.14%

Signed-off-by: Andrew Cooper andrew.cooper3@citrix.com