ECE297:11Lecture7 Whyanewstandard? 1.Oldstandardinsecureagainstbrute-forceattacks

2.Straightforwardfixesleadtoinefficient implementations AdvancedStandard K1 K2 K3 • TripleDES in out

3.Newtrendsinfastsoftwareencryption • useofbasicinstructionsofthemicroprocessor 4.Newwaysofassessingcipherstrength • differential • linearcryptanalysis

Whyacontest? ExternalformatoftheAESalgorithm

• Focustheeffortofcryptographiccommunity plaintextblock

Smallnumberofspecialistsintheopenresearch 128bits

• Stimulatetheresearchonmethodsofconstructing secureciphers AES

• Avoidbackdoortheories 128,192,256bits

128bits • Speed-uptheacceptanceofthestandard

block

Rulesofthecontest AESContestEffort

Eachteamsubmits June1998 15Candidates Round1 Detailed Justification Tentative fromUSA,Canada,Belgium, Security France,Germany,Norway,UK, Isreal, Softwareefficiency cipher ofdesign results Korea,Japan,Australia,CostaRica description decisions ofcryptanalysis August1999 Round2 5finalcandidates Security Source Mars,RC6, Rijndael,, Source Test Hardwareefficiency code code vectors inC inJava October2000 1winner: Rijndael Belgium

1 AEScontest- FirstRound AES:Candidatealgorithms NorthAmerica (8) Europe(4) Asia(2) 15June1998 Deadlineforsubmittingcandidates 21 submissions, Canada: Germany: Korea: 15fulfilledallrequirements CAST-256 Magenta Crypton Deal August1998 1stAESConferenceinVentura,CA Belgium: Japan: USA: Presentationofcandidates Mars Rijndael RC6 March1999 2ndAESConferenceinwRome,Italy Twofish France: Safer+ Australia(1) ReviewofresultsoftheFirstRound DFC HPC analysis Israel,GB, CostaRica: Australia: August1999 NISTannouncesfivefinalcandidates Norway: LOKI97 Frog Serpent

FirstroundJune1998-August1999 Surveyfilledby104participantsofthe SecondAESConferenceinRome,March1999

1. Rijndael +76 Security Software 2.RC6 +73 3. Twofish +61 OverwhelmingYES Resistance implementations 4.Mars +52 toknownattacks, 5.Serpent +45 randomnesstests PC Smartcards 6.E2 +14 MildYES 7.CAST-256 -2 8.Safer+ -4 Middle-of-the-Road 9.DFC -5 10. Crypton -15 MildNO 11.DEAL -70 12.HPC -77 13.Magenta -83 OverwhelmingNO 14.Loki97 -85 15.Frog -85

AESFinalists(1) AESFinalists(2) USA Mars - IBM Europe C. Burwick,D.Coppersmith,E. D’Avignon, R. Gennaro,S. Halevi,C. Jutla,S.M. Matyas, Rijndael - J. Daemen,V. Rijmen L.O’Connor,M. Peyravian,D.Safford, KatholiekeUniversiteitLeuven N. Zunic Belgium RC6- RSADataSecurity,Inc. R. Rivest - MIT Serpent - R.Anderson,Cambridge,England M. Robshaw,R.Sidney,Y.L.Yin- RSA E. Biham - Technion,Israel L.Knudsen,UniversityofBergen,Norway Twofish - CounterpaneSystems B. Schneier,J.Kelsey,C.Hall,N.Ferguson - Counterpane,D.Whiting- Hi/fn, D.Wagner- Berkeley

2 AEScontest:SecondRound SecondroundAugust1999-August2000 13-14April2000 3rdAESConferenceinNewYork Security Hardware 15May2000 Resistanceto implementations EndofthecommentperiodforRoundII newattacks FPGA ASIC 2October2000 Winnerannounced

November2001 FIPS-197:AESannounced May2002 Standardbecomeseffective

HowNISThasmadeafinaldecision? Security:Theoreticalattacksbetter thanexhaustivekeysearch

Serpent 9 32 BASICCRITERIA = Twofish 6 16 security softwareefficiency Mars 11 16 without16mixingrounds hardwareefficiency flexibility Rijndael 7 10

RC6 15 20 0 5 10 15 20 25 30 35 #ofroundsintheattack/total#ofrounds

Security:Authorsofattacks NISTReport:Security Team Attackedcipher SecurityMargin Twofish Kelsey,Kohno, Schneier MARS Ferguson,Stay,Wagner, High Serpent MARS Whiting Serpent Twofish

Serpent Rijndael Knudsen,Meier Rijndael RC6 Adequate Othergroups RC6 Lucks,U.Mannheim Twofish Gilbert, Minier,FranceTelecom Simple Complex Gilbert, Handschuh, Joux, Vaudenay,FranceTelecom Complexity

3 Efficiencyinsoftware:NIST-specifiedplatform Efficiencyinsoftware:NISTtests 200MHzPentiumPro,BorlandC++ 450MHzPentiumII,DJGPP gcc Speed[Mbits/s] Speed[Mbits/s] 128-bitkey 160 192-bitkey 128-bitkey 30 256-bitkey 140 192-bitkey 25 120 256-bitkey 20 100 80 15 60 10 40 5 20 0 0 Rijndael Rijndael RC6 Twofish Mars Serpent Mars RC6 Serpent Twofish

Efficiencyinsoftware:Rankingofencryption NISTReport:SoftwareEfficiency speedsforvariousplatforms EncryptionandDecryptionSpeed

Intel Alpha Sun-Sparc H-P 32-bit 64-bit DSPs processors processors Mars 442432 344 3 3 RC6 1 31 1 41 433 5 4 RC6 Rijndael Rijndael high Twofish Twofish Twofish 21 321 4 222 2 2 Rijndael Mars Rijndael 324323 1 1 1 1 1 Mars Mars medium RC6 RC6 Serpent 555555 555 4 5 Twofish low Serpent Serpent Serpent

NISTReport:SoftwareEfficiency Efficiencyinsoftware:Keysetup 200MHzPentiumPro,BorlandC++ Encryptionanddecryptionspeedinsoftware Time[clockcycles] onsmartcards 25000 128-bitkey 8-bit 32-bit 192-bitkey processors 20000 processors 256-bitkey

Rijndael 15000 Rijndael better high RC6 RC6 10000 medium Mars Mars Twofish 5000 low Serpent Twofish Serpent 0 Rijndael RC6 Mars Serpent Twofish

4 NISTReport:SoftwareEfficiency NISTReport:SoftwareEfficiency Keyscheduling Keyscheduling onsmartcards 32-bit 64-bit DSPs 8-bit processors processors processors

Rijndael Rijndael Rijndael high Serpent high Rijndael

Mars RC6 Mars Mars medium RC6 Serpent RC6 medium Twofish

Mars Serpent Twofish RC6 low Twofish low Twofish Serpent

Efficiencyinsoftware Efficiencyinsoftware:Conclusions Encryption/decryption Strongdependenceon: Strongvariationofresults 1.Instructionsetarchitecture (e.g.,variablerotations) Serpenttheworstformajorityofplatforms 2.Programminglanguage Keysetup (assembler,C,Java) Moderatevariationofresults 3.Compiler Rijndael andRC6thebestformajorityofplatforms 4.Programmingstyle TwofishandSerpenttheworstformajorityof platforms

Primarywaysofimplementing Whichwaytogo? inhardware ASIC FPGA ASICs FPGAs Application Specific Field Programmable Integrated Circuit Gate Array Off-the-shelf Highperformance • designsmustbesent • boughtofftheshelf Lowdevelopmentcosts forexpensiveandtime andreconfiguredby consumingfabrication designersthemselves Lowpower Shorttimetothemarket insemiconductorfoundry • nophysicallayoutdesign; • designedalltheway designendswith Lowcost(butonly frombehavioraldescription abitstream used inhighvolumes) Reconfigurability tophysicallayout toconfigureadevice

5 Reconfigurability Implementationofasecret-keycipher Roundkeyscomputedon-the-fly control ExternalROMandmicroprocessorenables input key changinganFPGAfunctioninseveralmilliseconds

Encryptionvs.decryptionvs.keyscheduling Control inputinterface unit FPGA FPGA FPGA Key Encryption Decryption scheduling key 5-15ms 5-15ms encryption/decryption scheduling Variousalgorithms FPGA FPGA FPGA roundkey outputinterface AES TripleDES IDEA 5-15ms 5-15ms output

Implementationofasecret-keycipher TypicalFlowDiagramof Roundkeysprecomputed aSecret-KeyBlockCipher control input/key RoundKey[0] Initialtransformation inputinterface Control i:=1 unit

key RoundKey[i] CipherRound scheduling i:=i+1 encryption/decryption #rounds times memoryof i<#rounds? round keys outputinterface RoundKey[#rounds+1] Finaltransformation output

Basiciterativearchitecture Primaryparametersofhardwareimplementations forsecret-keyblockciphers Latency Throughput

multiplexer Mi+2 M i Mi+1 M register i Timeto Encryption/ encrypt/decrypt Encryption/ oneround combinational decryption asingleblock decryption ofdata logic Numberofbits Ci+2 encrypted/decrypted Ci Ci+1 inaunitoftime

Ci

Block_size·Number_of_blocks_processed_simultaneously Throughput= Latency

6 Dependenceoftheencryptiontime Efficiencyinhardware:FPGA Virtex 1000:Speed onlatencyandthroughput Throughput[Mbit/s] 500 Messagesize 431 444 GeorgeMasonUniversity 450 414 UniversityofSouthernCalifornia 400 353 WorcesterPolytechnicInstitute

350 294 300 (Message_size–Block_size) Latency 250 Throughput 177 173 200 149 143 150 104 112 102 88 Time 100 62 61 50 Encryptiontime 0 Serpent Rijndael Twofish Serpent RC6 Mars I8 I1

Efficiencyinhardware:FPGA Virtex 1000:Area ASICimplementations:NSAgroup Area[CLBslices] 700 606 128-bitkeyscheduling 9000 GeorgeMasonUniversity 7964 3-in-1(128,192,256bit)keyscheduling 8000 UniversityofSouthernCalifornia 600 7000 WorcesterPolytechnicInstitute 500 443 6000 5511 4621 400 5000 4312 4507 300 4000 2507 3528 202 202 2809 2744 2666 2638 3000 200 105 105 103 104 1749 57 57 2000 1076 1137 1250 100 1000 0 Rijndael Serpent Twofish RC6 Mars 0 Twofish RC6 SerpentRijndaelMars Serpent I1 I8 I1

GMUResults: Encryptionincipherfeedbackmodes NSAResults: Encryptionincipherfeedbackmodes (CBC,CFB,OFB)- Virtex FPGA (CBC,CFB,OFB)- ASIC,0.5µmCMOS Throughput[Mbit/s] Throughput[Mbit/s] 500 700 400 600 Rijndael SerpentI8 Rijndael 500 300 400 200 Twofish SerpentI1 300 SerpentI1 100 RC6 200 Mars Mars 100 RC6 Twofish 0 0 0 1000 2000 3000 4000 5000 0 5 10 15 20 25 30 35 40 Area[CLBslices] Area[CLBslices]

7 NISTReport+GMUReport: Conclusionsforfeedbackciphermodes(1) HardwareEfficiency (CBC,CFB,OFB) Feedbackciphermodes:CBC,CFB Speed • Speed (throughput)shouldbetheprimary criteriaofcomparison High Rijndael Serpent

• Basiciterativearchitectureisthemostappropriate Twofish Medium forcomparisonandfutureimplementations RC6 • Serpentand Rijndael areovertwiceasfastasthe Low MARS nextbestcandidateforallimplementations

Small Medium Large Area

Conclusionsforfeedbackciphermodes(2) EncryptionKeySetupLatency[µs] (CBC,CFB,OFB) 9.55 1.96 5.74 1 NSA • Resultsconfirmedby 0.8 - threeindependentuniversitygroupsfor FPGAs,and USC - NSAgroupfor ASICs 0.6

• Resultsofcomparisonindependentof 0.4 implementationtechnology (FPGAs vs. ASICs) 0.17 0.18 0.2 0.07 0.08 0.06 0 0.02 0 Mars RC6 Rijndael Serpent Twofish I1

Encryptionvs.DecryptionKeySetupLatency[µs] Feedbackciphermodes- CBC M1 M2 M3 MN-1 MN 9.55 9.55 5.74 5.74 ... 1 encryption IV decryption

0.8 0.67 E E E E E 0.6 ...

0.4 C C 0.21 1 C2 C3 CN-1 N 0.11 0.2 ⊕ 0 0.02 0.06 C1 =AES(Mi IV) 0 C =AES(M ⊕ C )fori=2..N Mars RC6 Rijndael Serpent Twofish i i i-1 I1

8 Non-feedbackCounterMode- CTR FullMixedInnerandOuter-RoundPipelining Cipher1 Cipher2 IV IV+1 IV+2 IV+N-1 IV+N round1 ... round1

E E E E E ... round2 target ... M M M M M clock ... 0 1 2 N-1 N period, e.g.,20ns round10

round16 C C2 C3 CN-1 CN 1 128bits Speed= ⊕ Ci =Mi AES(IV+i)fori=0..N target_clock_period

Encryptioninnon-feedbackmodes(ECB,counter) NISTReport+GMUReport: decryptioninallmodes HardwareEfficiency Speed[Mbit/s] Non-feedbackciphermodes:ECB,CTR 7000 Rijndael 6.4 Gbit/s Speed 6000 Rijndael Serpent RC6 Mars RC6 High Serpent 5000 Twofish Mars Twofish 4000

3000 Medium

2000 Assumingclockperiod=50MHz 1000 Low

0 0 10000 20000 30000 40000 50000 60000 Small Medium Large Area[CLBslices] Area

Conclusionsfornon-feedbackciphermodes(1) ImportanceoftheAEScandidate ECB,counter hardwareefficiencycomparison

• Allcipherscanachieveapproximately • Importantfactorusedtodifferentiateamong thesamespeed. finalcandidates Area shouldbetheprimarycriteriaofcomparison. - objectiveandcommonlyacceptedmeasures - goodagreementamongresultsfromvariousgroups • Serpent, Twofish and Rijndael arethemost - largedifferencesamongfinalcandidates cost-efficientandtakeapproximatelythesame amountofarea • Efficientarchitecturesandmethodologies developed forallalgorithms

9 Flexibility:Criteria Surveyfilledby167participantsof theThirdAESConference,April2000 #votes • Additionalkey-sizesandblock-sizes 100 90 • Abilitytofunctionefficientlyandsecurelyinawide 80 variaty ofplatformsandapplications 70 low-end smartcards,wireless- memoryrequirements 60 IPSec,ATM- keysetuptimeinhardware 50 B-ISDN,satellitecommunication- encryptionspeed 40 30 20 10 0 Rijndael Serpent Twofish RC6 Mars

RankingbyparticipantsoftheAES3Conference Mostlikelywinner(s)(1) Positivevotes– negativevotes #votes Rijndael 100 80 + – 60 • fastestinhardware • securitymargin 40 20 • closetothefastestinsoftware 0 • veryhighflexibility -20 -40 novelideas -60 -80 Rijndael Serpent Twofish RC6 Mars

Mostlikelywinner(s)(2) Mostlikelywinner(s)(3) Serpent Twofish – – + + • goodsecuritymargin • moderatelyfast inhardware • largesecuritymargin • slowinsoftware • fastencryption/decryption • conservativeconstruction • moderateflexibility insoftware • slowkeysetup insoftware • veryfastinhardware • American • moderateflexibility • cryptanalytical reputationofauthors • strongly advertized

10 MajoroperationsofAESfinalists Basiccipheroperations(1)- S-box Software Hardware Serpent Rijndael Twofish RC6 Mars ROM C S-boxnxm S-boxes n-bitaddress WORDS[1<

Basiccipheroperations(2) Basiccipheroperations(3)- Multiplication MultiplicationintheGaloisFieldGF(2m) Software Hardware Software Hardware A B X C=const 32 32 C 8 8 C 32 32 x0 x3 x7 x0 x3 x4 x7 unsignedlongA,B,C; <<,^,|,& C=A*B; ... MUL32 MULGF(28) 32 ASM y y 32 ASM 0 7 C MUL Half- Y ROL,XOR,OR,AND Multiplier C=A·Bmod232

Basiccipheroperations(4)- Rotations Auxiliarycipheroperations- Permutation

Software Hardware Software Hardware Mux-basedshifter A<<<0 A<<<16 x x x x n x1 2 3 n-1 n C C ... C=(A<<B)|(A>>(32-B)); B[4] complex B[3] P sequenceof B[2] instructions ... A<<<B B[1] <<,|,& B[0] n 32 y1 y2 y3 yn-1 yn A<<

11 AES:Typesofcandidatealgorithms FeistelNetwork:SingleRoundofTwofish

Feistel Networks Modified Feistel Network D[3] D[2] D[1] D[0] Twofish Deal K2r+8 K2r+9 RC6 E2 LOKI97 <<<1 MARS DFC Magenta CAST-256 F- function Substitution- Others LinearTransformation >>>1 Networks Frog HPC Rijndael Safer+ D’[3] D’[2] D’[1] D’[0] Serpent Crypton

ModifiedFeistelNetwork:SingleRoundofMARS Substitution-LinearTransformationNetwork: D[3] D[2] D[1] D[0] SingleRoundofSerpent k k’ k=K[4+2i], k’=K[5+2i], 128 out1 i- roundno.

out2 in E S-boxes ⊕ out3 <<<13 LinearTransformation

K[i]

128 D’[3] D’[2 D’[1 D’[0 ] ] ]

Substitution-LinearTransformationNetwork: FirstbasicarchitectureofSerpent- SerpentI1 SerpentinHardware 128 128 128 128-bitregister initialpermutation Ki 128 regularSerpentround 128 128 128 128 128 32xS-box0 32xS-box1 32xS-box7 K0,...,K7,K32 encryption decryption K32,...,K7,K0 128 128 128 block block 8-to-1128-bitmultiplexer

128 128 lineartransformation K32 128 128 finalpermutation 128 output

12 AlternativebasicarchitectureofSerpent:SerpentI8 Rijndael– DifferentCircuits 128 forEncryptionandDecryption 128 128-bitregister plaintext ciphertext K0 round0 32xS-box0 subkey ByteSub lineartransformation oneimplementation roundofSerpent = ShiftRow InvMixColumn 8regularcipher round7 K7 rounds MixColumn InvShiftRow 32xS-box7 lineartransformation subkey InvByteSub K32

128 ciphertext plaintext output

Rijndael– ResourceSharingBetween EncryptionandDecryption Twofish– Encryption/DecryptionRound

inversedaffine transformation <<<1

encryption decryption >>>1 inversedelement F- function inGaloisfield <<<1

affine InvShiftRow >>>1 transformation subkey ShiftRow InvMixColumn MixColumn

subkey

RC6Round Twofish– F-function

R0 R1 R2 R3 h 32 32 32 32 M2 M0 q0 q0 q1 d e d e PHT q1 q0 q0 K2i MDS + F – S[2i+1] F – S[2i] q0 q1 q1

q1 q1 q0 A A d e d e h 5 5 M3 M1 <<< <<< q0 q0 q1 B B + S[2i+1] + S[2i] q1 q0 q0 K2i+1 MDS <<<8 + <<<9 R1 R0 R3 R2 q q q 0 1 1 d e e d d e e d

q1 q1 q0 feedback feedback feedback feedback toR toR 0 1 toR2 toR3

13 MARS- GeneralStructure MARS- KeyedTransformation

plaintext D3from D2from D1from D0from mixtransf. mixtransf. mixtransf. mixtransf.

+ subkey D3loop D2loop D1loop D0loop

forwardmixing optional swap keyedforward subkeys transformation optional rotation tothe keyedbackwards subkeys right 128-bitregister transformation optional swap backwardsmixing

- subkey Keyedtransformationcore

ciphertext D3loop D2loop D1loop D0loop

MARS- KeyedTransformationCore MARS– E-function

D3 D2 D1 D0 1 <<< S 32 32 32 32 1 +/– 2 +/– E 32 K[4+2i] 3 >>>13 2 <<< <<<13 >>>13

K[5+2i] <<<13 3 <<<5 <<<5 *

Secret-keycryptographystandards OperatingModesContest

Federal Banking International 4OldModes standards standards standards (CBC,CFB,OFB,ECB) April2001 NIST ANSI ISO 10NewCandidates fromEgypt,Estonia,Norway, FIPS46-1DES X3.92DES Sweden,Thailand,USA FIPS46-2DES ISO8732 Modesof operation Countermode FIPS81Modesof X3.106DESmodesofoperation ofa64-bit Summer2001 cipher operation 5StandardModes X9.52 Modesofoperation ISO10116Modesof FIPS46-3Triple ofTripleDES operation 2002 DES ofann-bit NewStandardModes cipher AES

14 Modessubmittedtothecontest(1) Modessubmittedtothecontest(2) Fullname Authors Institution Fullname Authors Institution A.A.Belal, Alexandria IGE InfiniteGarble V.D.Gligor, VDG,Inc., 2DEM 2D-EncryptionMode M.A.Abdel- University, Extension P.Donescu USA Gawad Egypt KFB KeyFeedbackMode NADA, ABC AccumulatedBlock J.Håstad, L.Knudsen U.ofBergen M.Naslund Ericsson Chaining Norway Sweden H.Lipmaa, Finland, UCSD,USA, OCB OffsetCodebook CTR CounterMode P.Rogaway, Estonia,USA, P.Rogaway Thailand D.Wagner Thailand PCFB PropagatingCipher H.Hellström StreamSec, Feedback Sweden IACBC IntegrityAwareCBC C.Jutla IBM,USA XCBC eXtendedCBC IAPM IntegrityAware V.D.Gligor, VDG,Inc., C.Jutla IBM,USA Encryption P.Donescu USA ParallalizableMode

EvaluationCriteriaforModesofOperation Evaluationcriteria(1) Security

Security • resistancetoattacks • proofofsecurity • randompropertiesoftheciphertext Efficiency Efficiency Functionality • numberofcallsoftheblockcipher • capabilityforparallelprocessing • memory/arearequirements • initializationtime • capabilityforpreprocessing

Evaluationcriteria(2) Modesofoperation:Currentstandard- CBC

Functionality M1 M2 M3 MN-1 MN • securityservices ... IV - confidentiality,integrity,authentication • flexibility - variablelengthsofblocksandkeys - differentamountofprecomputations E E E E E ... - requirementsonthelengthofthemessage • vulnerabilitytoimplementationerrors C C • requirementsontheamountofkeys,initialization 1 C2 C3 CN-1 N vectors,randomnumbers,etc. Problems: • errorpropagationandthecapabilityfor - Noparallelprocessingofblocksfromthesamepacket resynchronization - Nospeed-upbypreprocessing • patentrestrictions - Nointegrityorauthentication

15 Countermode Propertiesofexistingandnewciphermodes New IV IV+1 IV+2 IV+N-1 IV+N CBC CFB OFB standard ... Proofofsecurity E E E E E ... Parallelprocessing decryption only – K0 K1 K2 KN-1 KN M M M M M1 2 N-1 N Preprocessing 0 – – Integrityand C C C C C Features:0 1 2 N-1 N authentication – – – +Potentialforparallelprocessing Resistance +Speed-upbypreprocessing toimplementation – - Nointegrityorauthentication errors

Encryptionwithauthentication OCB Fullname Authors Institutions Controlsum IV 0 M1 M2 MN-1 MN IACBC IntegrityAwareCBC C. Jutla IBM length (patent) g(L) IAPM IntegrityAware C. Jutla IBM E Z1 Z2 ZN-1 ZN Parallalizable Mode (patent) ZN

XCBC- eXtended CBC V.D. Gligor, VDG,Inc., L E E ... E E E XOR Encryption P. Donescu (patent) E XECB- eXtended ECB V.D. Gligor, VDG,Inc., τ bits Z1 Z2 ZN-1 MN XOR Encryption P. Donescu (patent)

R C C2 CN-1 CN T OCB OffsetCodebook P. Rogaway UCSD, USA, 1 Thailand Zi=f(L,R)

16