Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 22 Aug 2012 23:24:57 +0200
From: Knug Carl Gustf <erik.andersson1980@...il.com>
To: john-dev@...ts.openwall.com
Subject: [PATCH] Speed up RACF encryption with a pre-computed lookup table

Dearest computer friends,

The attached patch speeds up RACF encryption by about 15% on my 64-bit
Apple and Dell devices.

I originally set out to see if I was able to get DES BS going for this
format but it turns out I'm too dumb to get a grip of the, as usual,
clever code written by the Solar Designer.  I've therefore choosen the
micro optimization path instead.

The original code translated the ASCII key to EBCDIC with
ascii2ebcdic(), did some IBMish bit twiddling in process_key() and
finally called two OpenSSL routines, DES_set_odd_parity() and
DES_set_key_checked() to prepare and expand the key.

This patch saves a few instructions by replacing the calls to
ascii2ebcdic(), process_key() and DES_set_odd_parity(), which btw is
also using a lookup table, with a single pre-computed lookup table.

I also noticed DES_set_key_checked() internally do two checks using
DES_check_key_parity() and DES_is_weak_key() before eventually calling
DES_set_key_unchecked().  This is unnecessary and further wastes a few
cycles so I opted for calling DES_set_key_unchecked() directly.

-- 
With love and respect,
Knug Carl Gustf
(email is borrowed, please call +46-(0)20-795611 for inquires)

Download attachment "racf-precomputed-table.patch" of type "application/octet-stream" (3738 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.