A Software-Optimized Encryption Algorithm
Total Page:16
File Type:pdf, Size:1020Kb
To app ear in J of CryptologyFull version of Last revised Septemb er A SoftwareOptimized Encryption Algorithm Phillip Rogaway and Don Copp ersmith Department of Computer Science Engineering I I Buildin g University of California Davis CA USA rogawaycsucdavisedu IBM TJ Watson ResearchCenter PO Box Yorktown Heights NY USA copp erwatsonibmcom Abstract We describ e a softwareecient encryption algorithm named SEAL Computational cost on a mo dern bit pro cessor is ab out clo ck cycles p er byte of text The cipher is a pseudorandom function family under control of a key rst prepro cessed into an internal table it stretches a bit p osition index into a long pseudorandom string This string can b e used as the keystream of a Vernam cipher Key words Cryptography Encryption Fast encryption Pseudoran dom function family Software encryption Stream cipher Intro duction Encrypting Fast In Software Encryption must often b e p erformed at high data rates a requirement sometimes met with the help of supp orting crypto graphic hardware Unfortunately cryptographic hardware is often absent and data condentiality is sacriced b ecause the cost of software cryptographyis deemed to b e excessive The computational cost of software cryptography is a function of the under y of its implementation But regardless of imple lying algorithm and the qualit mentation a cryptographic algorithm designed to run well in hardware will not p erform in software as well as an algorithm optimized for software execution The hardwareoriented Data Encryption Algorithm DES is no exception Of ten what is needed is a welldesigned softwareoptimized encryption metho d for to days general purp ose computers To this end wehave designed SEAL Software Encryption Algorithm SEAL is a pseudorandom function family under control of a key rst prepro cesse d into a set of tables SEAL stretches a bit p osition index into a keystream of essentially arbitrary length One then encrypts byXORing this keystream with the plaintext in the manner of a Vernam cipher As with anyVernam cipher it is imp erative that the keystream only b e used once On a mo dern bit pro cessor SEAL can encrypt messages at a rate of ab out clo ck cycles p er byte of text In comparison the DES algorithm is more than times as exp ensive Even a Cyclic Redundancy Co de CRC is more costly Related Work We are not the rst to realize the value of softwareoptimized cryptography In Merkle describ ed the utilityofsoftwareoriented cryptog raphy and he prop osed a suite of three softwareecient algorithms One of them called Khufuisablock cipher which is similar in spirit to SEAL An earlier softwareoriented blo ck cipher than Khufu is FEAL But this algorithm and its variants have not proven to b e particularly secure see for history and attacks Nor is it all that fast RC is a p opular softwareecient stream cipher designed byRivest It is fast though less fast than SEALRC is a softwareecient blo ck cipher It to o was designed by Rivest Some other softwareecient ciphers include BlowshandWAKE History And Naming The full name of the cipher describ ed in this pap er is SEAL An earlier version of this cipher was describ ed in and denoted SEAL Though SEAL is the rst mo dication to SEAL which the authors have describ ed a variantknown as SEAL had already app eared SEAL apart from using NISTs revised in the literature it was identical to Secure Hash Algorithm SHA instead of the original one SHA While SEAL retains that change the more signicant adjustment is resp onsiveto an attackby Handschuh and Gilb ert See Section for further information on their attack and the dierences b etween SEAL and SEAL In this pap er the name SEALby itself always refers to SEAL Characteristics of the Cipher Key characteristics and design choices of SEAL are explained b elow Preprocessing The Key In typical applications requiring fast software cryp tography data encryption is required over the course of a communication session to a remote partner or over the course of a login session to a particular machine In either case the key a which protects the session is determined at session setup Typically this session setup takes at least a few milliseconds and is not a time critical op eration It is therefore acceptable in most applications to sp end some numberofmilliseconds to map the short key a to a less concise representation of the cryptographic transformation sp ecialized to this key Our cipher has this characteristic As such SEAL is an inappropriate choice for applications which require rapid keysetup LengthIncreasing Pseudorandom Function Variable Output And Key Lengths The function SEAL is a typ e of cryptographic ob ject called a pseudorandom function family PRF Such ob jects were rst dened in SEAL is a lengthincreasing PRF under control of a bit key a SEAL maps a bit string n to an Lbit string SEALa n L The number L can b e made as large or as small as is needed for a target application but output lengths ranging from a few bytes to a few thousand bytes are anticipated An arbitrary length key a can b e used as the key for SEAL simply by selecting a SHAa As a pseudorandom function family SEALa L should lo ok like a random function if a is random and unknown The meaning of this is as follows First a key a is taken at random from f g Next the adversary is given at random either a blackb ox for the function SEALa L or else a blackb ox for a truly random function R Either maps bits to L bits The adversarys job is to guess whichtyp e of b ox she has Say that the adversary wins if she correctly guesses Random or Pseudorandom Our goal is that for any reasonable adversary she should not win with probability signicantly greater than Though we will not attempt to dene reasonable or signicant weaimto defeat adversaries with substantial computational resources and cleverness A PRF can b e used to make a go o d stream cipher In a stream cipher the encryption of a message dep ends not only on the key a and the message x but also on the messages p osition n in the data stream This p osition is often a counter sequence numb er which indicates which message is b eing enciphered The encryption of string x at p osition n is given by hn x SEALa n Li where L jxj In other applications n might indicate the address of a piece of data on disk Target Platforms Execution vehicles that should run the algorithm well in TM TM TM clude the Intel Intel Pentium pro cessors and contemp orary bit RISC machines Because of the particular challenges involved in having a cipher run well on the Pentium and b ecause of the p ervasiveness of this pro cessor familywehave optimized our cipher with the characteristics of this pro cessor family particularly in mind By doing well on these diculttooptimizefor vehicles weexpecttodowell on any mo dern bit pro cessor Some of the relevant limitations of the Pentium are a small register set a twoop erand instruction architecture and a small rst level cache Here is some further detail whichwas imp ortant in design choices These pro cessors have general registers including the register normally used as a stackpointer Most instructions work on two op erands A A op B instead of three A B op C The has an KByte onchip cache for data and instructions while entium has an KByte data cache and an KByte instruction cache the P Cache misses can b e exp ensive The and Pentium pro cessors use a stage instruction pip eline and if the base register for an address calculation is the destination register of the preceding instruction an extra cycle will b e consumed The Pentium pro cessor has dual instruction pip es one of whichrunsavery limited instruction set It was not a design goal for the cipher to exhibit an instruction dep endency structure whichwould allowustoalways ll b oth pip es TableDriven Cipher One early decision was whether to make the cipher a straightline program of logical op erations like MD or SHA or to drive it instead by the use of a large table likeKhufu or a software DES instead The tabledriven approachwas selected b ecause wefeltthatitwould lead to a faster and easiertodesign cipher With the tabledriven algorithm we could get very rapid diusion and there would b e less temptation to pro duce a cipher whose most ecient implementation used selfmo difying co de In view of the size of the rstlevel cache and the fact that servers maywant to store in secondlevel cache the representation of the encryption transformation of tens of clients it was decided that we should not b e to o generous with the size of the tables that we used Wewould settle on a total size for all tables of KBytes pro cedure Initializen A B C D n n n n A n R B n iii R C n iii R D n iii R for j to do P A xfc B B T P A A iii P B xfc C C T P B B iii P C xfc D D T P C C iii P D xfc A A T P D D iii n n n n D B A C P A xfc B B T P A A iii P B xfc C C T P B B iii P C xfc D D T P C C iii P D xfc A A T P D D iii Fig Initializati on of A B C D n n n n from n This initiali zatio n de pends on aderived tables T and R Denition of the Cipher Notation We call a bit string a word and an bit string a byte The empty string is denoted We write numb ers in hexadecimal by preceding them with x and then using the symb ols af to represent decimal numb ers resp ectivelyByy iii t we denote a right circular shift of the word y by t bits in other words the ith bit of y iii t is y Similarly y hhh t denotes itmod a left circular shift of y by t bits By andwe