Commit Graph

56 Commits

Author SHA1 Message Date
Stephen Heumann 458e769212 Add initialization function to permit computation of SHA-224 hashes.
SHA-224 uses the exact same computation as SHA-256, just with different initial values.
2017-07-03 23:40:36 -05:00
Stephen Heumann 11148c78d1 Remove unused macros. 2017-07-03 23:05:51 -05:00
Stephen Heumann bcc0efc327 Add zero bytes around SHA-256 state variables to optimize rotates. 2017-07-03 22:58:58 -05:00
Stephen Heumann 239024c3ce Remove unneeded instruction. 2017-07-03 20:46:26 -05:00
Stephen Heumann 7034be04fb Use more efficient approach for addressing into k array in SHA-256 computation. 2017-07-03 20:41:53 -05:00
Stephen Heumann f0f034760b Optimize SHA-256 computations to save instructions in various places. 2017-07-03 20:03:45 -05:00
Stephen Heumann d2bf9a782e Use shifts when called for, rather than more expensive rotates. 2017-07-03 17:12:13 -05:00
Stephen Heumann 011628d3ce More rotate optimizations for SHA-256. 2017-07-03 15:50:20 -05:00
Stephen Heumann 6891b77fbc Additional small rotate optimizations in SHA-256. 2017-07-03 15:30:46 -05:00
Stephen Heumann 6940f1fef4 Use operations on bytes to rotate by multiples of 8 in SHA-256. 2017-07-03 15:15:18 -05:00
Stephen Heumann 64fc1e62bb Do some optimization of the rotates in SHA-256. 2017-07-03 14:46:46 -05:00
Stephen Heumann 61bc8f8b4f Reduce duplicated code in SHA-256 implementation. 2017-07-03 14:33:17 -05:00
Stephen Heumann 91c107eb98 Add initial implementation of the basic block-processing function for SHA-256. 2017-07-03 14:27:19 -05:00
Stephen Heumann 2c34d17925 Typos 2017-07-02 22:54:18 -05:00
Stephen Heumann 58a3945d53 Add basic makefile. 2017-07-02 20:26:20 -05:00
Stephen Heumann a04d36eb6c Add copyright notices and comments. 2017-07-02 18:41:21 -05:00
Stephen Heumann cfadee23bb Add implementation and test for AES CTR mode. 2017-07-02 18:25:43 -05:00
Stephen Heumann 924789510b Optimize AES CBC operations a bit. 2017-07-02 16:24:00 -05:00
Stephen Heumann 6532a3abc4 Add timing tests for AES CBC encryption and decryption. 2017-07-02 15:56:22 -05:00
Stephen Heumann c8b0fb904b Add .gitignore file. 2017-07-02 15:29:51 -05:00
Stephen Heumann 4e0903a708 Add simple toy program for encrypting/decrypting files with AES. 2017-07-02 15:24:49 -05:00
Stephen Heumann 60a7aec49c Add functions for AES CBC mode encryption and decryption. 2017-07-01 23:29:17 -05:00
Stephen Heumann 0386f928ff Add comments and copyright notices, and rename chunk to block. 2017-07-01 17:53:49 -05:00
Stephen Heumann b2d3d3ffa8 Add sha1sum program as a test/application of the SHA-1 computation. 2017-07-01 15:11:13 -05:00
Stephen Heumann 0ad5d39f07 Tweaks to SHA-1 update and finalization code. 2017-07-01 14:27:25 -05:00
Stephen Heumann 8b17a15ada Add implementations of the SHA-1 update and finalize operations.
The definition of the context structure is also cleaned up a bit.
2017-06-30 23:55:03 -05:00
Stephen Heumann 3aa0d1b89f Update SHA-1 test program. 2017-06-30 13:35:33 -05:00
Stephen Heumann 97fc1ce981 Small cleanups in SHA-1. 2017-06-30 13:23:29 -05:00
Stephen Heumann 6c1d703b84 Don't duplicate identical code for the last three schedule computation phases.
This shrinks code size and is probably faster with accelerators due to caching.
2017-06-30 12:49:51 -05:00
Stephen Heumann d97e0c0153 Don't update index value in each unrolled loop iteration. 2017-06-30 00:52:25 -05:00
Stephen Heumann 2d8c85bd98 Unroll SHA-1 loop with variables substituted to avoid cycling values around.
SHA-1 has five state variables (a,b,c,d,e), and each iteration of the core loop cycles their values around (e.g. a->b), in some cases with modifications. By unrolling the loop by a factor of five and appropriately substituting the values operated on in each iteration, we can avoid actually doing the copies implied by this cycling, which gives a fairly significant performance gain.
2017-06-30 00:33:16 -05:00
Stephen Heumann aab47e38e7 Compute SHA-1 message schedule 20 elements at a time, reusing storage.
The reduces the storage needed and boosts performance, since the whole schedule is contained in the direct page.
2017-06-29 22:22:06 -05:00
Stephen Heumann 7182fc5817 Use separate loops for the four parts of the SHA-1 computation. 2017-06-29 20:51:36 -05:00
Stephen Heumann dfdb3186fd Add macros for rotates. 2017-06-29 20:41:49 -05:00
Stephen Heumann ad4e0a0dd5 More SHA-1 optimizations. 2017-06-29 20:16:22 -05:00
Stephen Heumann 13654c0888 Small optimizations in SHA-1 computation. 2017-06-29 19:52:52 -05:00
Stephen Heumann a519776847 Add implementation of the basic block-processing function for SHA-1. 2017-06-29 16:54:49 -05:00
Stephen Heumann 1cb8841a46 state -> context 2017-06-29 16:52:34 -05:00
Stephen Heumann f60585cc3e Add note about context size. 2017-06-28 01:26:24 -05:00
Stephen Heumann d4baf7dbe4 Usage message and indentation cleanups in test program. 2017-06-27 23:42:20 -05:00
Stephen Heumann 4ffd064204 Add comments and copyright notices. 2017-06-27 23:30:58 -05:00
Stephen Heumann e46264f0c4 Small decryption optimization, saving a value in a register between rounds. 2017-06-27 22:35:57 -05:00
Stephen Heumann 634ff1e865 Optimize decryption code.
AddRoundKey is integrated into InvMixColumn and InvFinalRoundStep, rather than being done separately.
2017-06-27 20:44:14 -05:00
Stephen Heumann 18dabeb621 Allow number of test iters to be given on command line. 2017-06-27 20:07:07 -05:00
Stephen Heumann d9b8467bb7 Rename some interfaces. 2017-06-27 19:42:53 -05:00
Stephen Heumann 14fe68de79 Time decryption as well as encryption. 2017-06-27 19:35:38 -05:00
Stephen Heumann a522ab6d88 Optimize decryption a bit. 2017-06-27 19:24:06 -05:00
Stephen Heumann 46fcb3badc Add support for AES-256 decryption. 2017-06-27 18:35:04 -05:00
Stephen Heumann 0e3e511ba8 Add basic decryption implementation for AES-128 and AES-192. 2017-06-27 18:17:00 -05:00
Stephen Heumann 9d9f62444d Add timing test. 2017-06-27 12:45:58 -05:00