aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-14 18:04:35 +0000
committerlloyd <[email protected]>2010-10-14 18:04:35 +0000
commit0cb6bcfedef6ffa797801acd7cb945feb2d05d50 (patch)
treea89de84b769036989fd59364dfb2d4fa000c697f
parenta142500346e9bef5c4b0905103eac9a494d6822e (diff)
In all cases where the block size of the cipher is fixed, the key
parameters are as well. So make them template paramters. The sole exception was AES, because you could either initialize AES with a fixed key length, in which case it would only be that specific key length, or not, in which case it would support any valid AES key size. This is removed in this checkin; you have to specifically ask for AES-128, AES-192, or AES-256, depending on which one you want. This is probably actually a good thing, because every implementation other than the base one (SSSE3, AES-NI, OpenSSL) did not support "AES", only the versions with specific fixed key sizes. So forcing the user to ask for the one they want ensures they get the ones that are faster and/or safer.
-rw-r--r--checks/validate.dat294
-rw-r--r--src/block/aes/aes.cpp111
-rw-r--r--src/block/aes/aes.h69
-rw-r--r--src/block/aes_ssse3/aes_ssse3.h15
-rw-r--r--src/block/block_cipher.h16
-rw-r--r--src/block/blowfish/blowfish.h4
-rw-r--r--src/block/cast/cast128.h4
-rw-r--r--src/block/cast/cast256.h4
-rw-r--r--src/block/des/des.h8
-rw-r--r--src/block/des/desx.h4
-rw-r--r--src/block/gost_28147/gost_28147.cpp2
-rw-r--r--src/block/gost_28147/gost_28147.h4
-rw-r--r--src/block/idea/idea.h4
-rw-r--r--src/block/kasumi/kasumi.h4
-rw-r--r--src/block/mars/mars.h4
-rw-r--r--src/block/misty1/misty1.cpp4
-rw-r--r--src/block/misty1/misty1.h2
-rw-r--r--src/block/noekeon/noekeon.h4
-rw-r--r--src/block/rc2/rc2.h4
-rw-r--r--src/block/rc5/rc5.cpp2
-rw-r--r--src/block/rc5/rc5.h2
-rw-r--r--src/block/rc6/rc6.h4
-rw-r--r--src/block/safer/safer_sk.cpp3
-rw-r--r--src/block/safer/safer_sk.h2
-rw-r--r--src/block/seed/seed.h4
-rw-r--r--src/block/serpent/serpent.h5
-rw-r--r--src/block/skipjack/skipjack.h4
-rw-r--r--src/block/square/square.h6
-rw-r--r--src/block/tea/tea.h4
-rw-r--r--src/block/twofish/twofish.h6
-rw-r--r--src/block/xtea/xtea.h4
-rw-r--r--src/engine/core_engine/lookup_block.cpp2
-rw-r--r--src/libstate/policy.cpp1
33 files changed, 244 insertions, 366 deletions
diff --git a/checks/validate.dat b/checks/validate.dat
index 3da482cf9..9e0aba063 100644
--- a/checks/validate.dat
+++ b/checks/validate.dat
@@ -8,119 +8,10 @@
# Block cipher format is plaintext:ciphertext:key
-[AES]
-# From FIPS 197
+[AES-128]
00112233445566778899AABBCCDDEEFF:69C4E0D86A7B0430D8CDB78070B4C55A:\
000102030405060708090A0B0C0D0E0F
-00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:\
-000102030405060708090A0B0C0D0E0F1011121314151617
-00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:\
-000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
-
-506812A45F08C889B97F5980038B8359:D8F532538289EF7D06B506A4FD5BE9C9:\
-00010203050607080A0B0C0D0F101112
-5C6D71CA30DE8B8B00549984D2EC7D4B:59AB30F4D4EE6E4FF9907EF65B1FB68C:\
-14151617191A1B1C1E1F202123242526
-53F3F4C64F8616E4E7C56199F48F21F6:BF1ED2FCB2AF3FD41443B56D85025CB1:\
-28292A2B2D2E2F30323334353738393A
-A1EB65A3487165FB0F1C27FF9959F703:7316632D5C32233EDCB0780560EAE8B2:\
-3C3D3E3F41424344464748494B4C4D4E
-3553ECF0B1739558B08E350A98A39BFA:408C073E3E2538072B72625E68B8364B:\
-50515253555657585A5B5C5D5F606162
-67429969490B9711AE2B01DC497AFDE8:E1F94DFA776597BEACA262F2F6366FEA:\
-64656667696A6B6C6E6F707173747576
-93385C1F2AEC8BED192F5A8E161DD508:F29E986C6A1C27D7B29FFD7EE92B75F1:\
-78797A7B7D7E7F80828384858788898A
-3E23B3BC065BCC152407E23896D77783:1959338344E945670678A5D432C90B93:\
-54555657595A5B5C5E5F606163646566
-79F0FBA002BE1744670E7E99290D8F52:E49BDDD2369B83EE66E6C75A1161B394:\
-68696A6B6D6E6F70727374757778797A
-DA23FE9D5BD63E1D72E3DAFBE21A6C2A:D3388F19057FF704B70784164A74867D:\
-7C7D7E7F81828384868788898B8C8D8E
-E3F5698BA90B6A022EFD7DB2C7E6C823:23AA03E2D5E4CD24F3217E596480D1E1:\
-A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6
-BDC2691D4F1B73D2700679C3BCBF9C6E:C84113D68B666AB2A50A8BDB222E91B9:\
-E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2
-BA74E02093217EE1BA1B42BD5624349A:AC02403981CD4340B507963DB65CB7B6:\
-08090A0B0D0E0F10121314151718191A
-B5C593B5851C57FBF8B3F57715E8F680:8D1299236223359474011F6BF5088414:\
-6C6D6E6F71727374767778797B7C7D7E
-
-FEC1C04F529BBD17D8CECFCC4718B17F:62564C738F3EFE186E1A127A0C4D3C61:\
-4A4B4C4D4F50515254555657595A5B5C5E5F606163646566
-32DF99B431ED5DC5ACF8CAF6DC6CE475:07805AA043986EB23693E23BEF8F3438:\
-68696A6B6D6E6F70727374757778797A7C7D7E7F81828384
-7FDC2B746F3F665296943B83710D1F82:DF0B4931038BADE848DEE3B4B85AA44B:\
-868788898B8C8D8E90919293959697989A9B9C9D9FA0A1A2
-8FBA1510A3C5B87E2EAA3F7A91455CA2:592D5FDED76582E4143C65099309477C:\
-A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6B8B9BABBBDBEBFC0
-2C9B468B1C2EED92578D41B0716B223B:C9B8D6545580D3DFBCDD09B954ED4E92:\
-C2C3C4C5C7C8C9CACCCDCECFD1D2D3D4D6D7D8D9DBDCDDDE
-0A2BBF0EFC6BC0034F8A03433FCA1B1A:5DCCD5D6EB7C1B42ACB008201DF707A0:\
-E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFC
-25260E1F31F4104D387222E70632504B:A2A91682FFEB6ED1D34340946829E6F9:\
-FEFE01010304050608090A0B0D0E0F10121314151718191A
-C527D25A49F08A5228D338642AE65137:E45D185B797000348D9267960A68435D:\
-1C1D1E1F21222324262728292B2C2D2E3031323335363738
-3B49FC081432F5890D0E3D87E884A69E:45E060DAE5901CDA8089E10D4F4C246B:\
-3A3B3C3D3F40414244454647494A4B4C4E4F505153545556
-D173F9ED1E57597E166931DF2754A083:F6951AFACC0079A369C71FDCFF45DF50:\
-58595A5B5D5E5F60626364656768696A6C6D6E6F71727374
-8C2B7CAFA5AFE7F13562DAEAE1ADEDE0:9E95E00F351D5B3AC3D0E22E626DDAD6:\
-767778797B7C7D7E80818283858687888A8B8C8D8F909192
-AAF4EC8C1A815AEB826CAB741339532C:9CB566FF26D92DAD083B51FDC18C173C:\
-94959697999A9B9C9E9FA0A1A3A4A5A6A8A9AAABADAEAFB0
-40BE8C5D9108E663F38F1A2395279ECF:C9C82766176A9B228EB9A974A010B4FB:\
-D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBEC
-0C8AD9BC32D43E04716753AA4CFBE351:D8E26AA02945881D5137F1C1E1386E88:\
-2A2B2C2D2F30313234353637393A3B3C3E3F404143444546
-1407B1D5F87D63357C8DC7EBBAEBBFEE:C0E024CCD68FF5FFA4D139C355A77C55:\
-48494A4B4D4E4F50525354555758595A5C5D5E5F61626364
-E51AA0B135DBA566939C3B6359A980C5:8CD9423DFC459E547155C5D1D522E540:\
-E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFCFEFE010103040506
-069A007FC76A459F98BAF917FEDF9521:080E9517EB1677719ACF728086040AE3:\
-08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E
-726165C1723FBCF6C026D7D00B091027:7C1700211A3991FC0ECDED0AB3E576B0:\
-30313233353637383A3B3C3D3F40414244454647494A4B4C4E4F505153545556
-D7C544DE91D55CFCDE1F84CA382200CE:DABCBCC855839251DB51E224FBE87435:\
-58595A5B5D5E5F60626364656768696A6C6D6E6F71727374767778797B7C7D7E
-FED3C9A161B9B5B2BD611B41DC9DA357:68D56FAD0406947A4DD27A7448C10F1D:\
-80818283858687888A8B8C8D8F90919294959697999A9B9C9E9FA0A1A3A4A5A6
-4F634CDC6551043409F30B635832CF82:DA9A11479844D1FFEE24BBF3719A9925:\
-A8A9AAABADAEAFB0B2B3B4B5B7B8B9BABCBDBEBFC1C2C3C4C6C7C8C9CBCCCDCE
-109CE98DB0DFB36734D9F3394711B4E6:5E4BA572F8D23E738DA9B05BA24B8D81:\
-D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBECEEEFF0F1F3F4F5F6
-4EA6DFABA2D8A02FFDFFA89835987242:A115A2065D667E3F0B883837A6E903F8:\
-70717273757677787A7B7C7D7F80818284858687898A8B8C8E8F909193949596
-5AE094F54AF58E6E3CDBF976DAC6D9EF:3E9E90DC33EAC2437D86AD30B137E66E:\
-98999A9B9D9E9FA0A2A3A4A5A7A8A9AAACADAEAFB1B2B3B4B6B7B8B9BBBCBDBE
-764D8E8E0F29926DBE5122E66354FDBE:01CE82D8FBCDAE824CB3C48E495C3692:\
-C0C1C2C3C5C6C7C8CACBCCCDCFD0D1D2D4D5D6D7D9DADBDCDEDFE0E1E3E4E5E6
-3F0418F888CDF29A982BF6B75410D6A9:0C9CFF163CE936FAAF083CFD3DEA3117:\
-E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FAFCFDFEFF01020304060708090B0C0D0E
-E4A3E7CB12CDD56AA4A75197A9530220:5131BA9BD48F2BBA85560680DF504B52:\
-10111213151617181A1B1C1D1F20212224252627292A2B2C2E2F303133343536
-211677684AAC1EC1A160F44C4EBF3F26:9DC503BBF09823AEC8A977A5AD26CCB2:\
-38393A3B3D3E3F40424344454748494A4C4D4E4F51525354565758595B5C5D5E
-D21E439FF749AC8F18D6D4B105E03895:9A6DB0C0862E506A9E397225884041D7:\
-60616263656667686A6B6C6D6F70717274757677797A7B7C7E7F808183848586
-D9F6FF44646C4725BD4C0103FF5552A7:430BF9570804185E1AB6365FC6A6860C:\
-88898A8B8D8E8F90929394959798999A9C9D9E9FA1A2A3A4A6A7A8A9ABACADAE
-0B1256C2A00B976250CFC5B0C37ED382:3525EBC02F4886E6A5A3762813E8CE8A:\
-B0B1B2B3B5B6B7B8BABBBCBDBFC0C1C2C4C5C6C7C9CACBCCCECFD0D1D3D4D5D6
-B056447FFC6DC4523A36CC2E972A3A79:07FA265C763779CCE224C7BAD671027B:\
-D8D9DADBDDDEDFE0E2E3E4E5E7E8E9EAECEDEEEFF1F2F3F4F6F7F8F9FBFCFDFE
-5E25CA78F0DE55802524D38DA3FE4456:E8B72B4E8BE243438C9FFF1F0E205872:\
-00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526
-A5BCF4728FA5EAAD8567C0DC24675F83:109D4F999A0E11ACE1F05E6B22CBCB50:\
-28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E
-814E59F97ED84646B78B2CA022E9CA43:45A5E8D4C3ED58403FF08D68A0CC4029:\
-50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576
-15478BEEC58F4775C7A7F5D4395514D7:196865964DB3D417B6BD4D586BCB7634:\
-78797A7B7D7E7F80828384858788898A8C8D8E8F91929394969798999B9C9D9E
-
-[AES-128]
506812A45F08C889B97F5980038B8359:D8F532538289EF7D06B506A4FD5BE9C9:\
00010203050607080A0B0C0D0F101112
@@ -1274,6 +1165,9 @@ A0A1A2A3A5A6A7A8AAABACADAFB0B1B2
00000000000000000000000000000000
[AES-192]
+00112233445566778899AABBCCDDEEFF:DDA97CA4864CDFE06EAF70A0EC0D7191:\
+000102030405060708090A0B0C0D0E0F1011121314151617
+
2D33EEF2C0430A8A9EBF45E809C40BB6:DFF4945E0336DF4C1C56BC700EFF837F:\
00010203050607080A0B0C0D0F10111214151617191A1B1C
@@ -2619,6 +2513,9 @@ D3D2DDDCAAADACAF9C9D9E9FE8EBEAE5:9ADB3D4CCA559BB98C3E2ED73DBF1154:\
000000000000000000000000000000000000000000000000
[AES-256]
+00112233445566778899AABBCCDDEEFF:8EA2B7CA516745BFEAFC49904B496089:\
+000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
+
834EADFCCAC7E1B30664B1ABA44815AB:1946DABF6A03A2A2C3D0B05080AED6FC:\
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526
@@ -25233,13 +25130,14 @@ F58C4C04D6E5F1BA779EABFB5F7BFBD69CFC4E967EDB808D679F777BC6702C7D\
603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:\
000102030405060708090A0B0C0D0E0F
-[AES/CFB]
+[AES-128/CFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
3B3FD92EB72DAD20333449F8E83CFB4AC8A64537A0B3A93FCDE3CDAD9F1CE58B\
26751F67A3CBB140B1808CF187A4F4DFC04B05357C5D1C0EEAC4C66F9FF7F2E6:\
2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F
+[AES-192/CFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
CDC80D6FDDF18CAB34C25909C99A417467CE7F7F81173621961A2B70171D3D7A\
@@ -25247,6 +25145,7 @@ CDC80D6FDDF18CAB34C25909C99A417467CE7F7F81173621961A2B70171D3D7A\
8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:\
000102030405060708090A0B0C0D0E0F
+[AES-256/CFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
DC7E84BFDA79164B7ECD8486985D386039FFED143B28B1C832113C6331E5407B\
@@ -25254,13 +25153,14 @@ DF10132415E54B92A13ED0A8267AE2F975A385741AB9CEF82031623D55B1E471:\
603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4:\
000102030405060708090A0B0C0D0E0F
-[AES/OFB]
+[AES-128/OFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
3B3FD92EB72DAD20333449F8E83CFB4A7789508D16918F03F53C52DAC54ED825\
9740051E9C5FECF64344F7A82260EDCC304C6528F659C77866A510D9C1D6AE5E:\
2B7E151628AED2A6ABF7158809CF4F3C:000102030405060708090A0B0C0D0E0F
+[AES-192/OFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
CDC80D6FDDF18CAB34C25909C99A4174FCC28B8D4C63837C09E81700C1100401\
@@ -25268,6 +25168,7 @@ CDC80D6FDDF18CAB34C25909C99A4174FCC28B8D4C63837C09E81700C1100401\
8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B:\
000102030405060708090A0B0C0D0E0F
+[AES-256/OFB]
6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
DC7E84BFDA79164B7ECD8486985D38604FEBDC6740D20B3AC88F6AD82A4FB08D\
@@ -59660,10 +59561,11 @@ D1FADD67122FF916A6DE358A5D4BE30645761273D97CF9A3AA:\
4761EF4FF7D28587CC62F4FBC8BF75129035D173686AD394A5DC:\
BF0557B787C01A589BBD6EBB83F3A330:69ECFA9B0A41FDF990F4CC167B987870
-[CMAC(AES)]
-# First twelve vectors come from a paper, they were generated by Eisuke Kuroda
-# and Yuki Ohira at Ibaraki University. The rest were generated by me for the
-# EAX specification.
+# First 4 vectors for each key size come from a paper, they were
+# generated by Eisuke Kuroda and Yuki Ohira at Ibaraki University. The
+# rest were generated by me for the EAX specification.
+
+[CMAC(AES-128)]
:BB1D6929E95937287FA37D129B756746:2B7E151628AED2A6ABF7158809CF4F3C
6BC1BEE22E409F96E93D7E117393172A:070A16B46B4D4144F79BDD9DD04A287C:\
@@ -59677,99 +59579,7 @@ DFA66747DE9AE63030CA32611497C827:2B7E151628AED2A6ABF7158809CF4F3C
30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
51F0BEBF7E3B9D92FC49741779363CFE:2B7E151628AED2A6ABF7158809CF4F3C
-:D17DDF46ADAACDE531CAC483DE7A9367:\
-8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
-
-6BC1BEE22E409F96E93D7E117393172A:9E99A7BF31E710900662F65E617C5184:\
-8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
-
-6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
-30C81C46A35CE411:8A1DE5BE2EB31AAD089A82E6EE908B0E:\
-8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
-
-6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
-30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
-A1D5DF0EED790F794D77589659F39A11:\
-8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
-
-:028962F61B7BF89EFC6B551F4667D983:\
-603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
-
-6BC1BEE22E409F96E93D7E117393172A:28A7023F452E8F82BD4BF28D8C37C35C:\
-603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
-
-6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
-30C81C46A35CE411:AAF3D8F1DE5640C232F5B169B9C911E6:\
-603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
-
-6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
-30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
-E1992190549F6ED5696A2C056C315410:\
-603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
-
# The rest were generated by me and are non-official
-:146843CEFEF83BB230862DEE5288012C:FBFC57D01402E2527D11C008C041D51F
-
-4C:3FD7EC49061ABD552D6FA2685FF77388:556813A5E6DC9A926FB235991CA1A014
-
-258B:80BC1B9501710D77C01451732517F272:6195FB30EABDBEEF1C5CE5E2CD533893
-
-D1EF53:B708B2BDDEAB33BF33AAE5B47C8ED59B:7BB3D07953D5D76252B2C73642F1C829
-
-84878883:D8E24AF6410BE6D26FE65E05DB95C1A0:18D366221A8BDAD5DD6483A388163EF5
-
-721CFD4147:8F8ECB42EFE42F708D0EF849B4180627:2E0C3C02080D6B4C6A01FABC78FCC2D2
-
-991225136F00:2B73C3006233572AD1AF399539723018:A157A82608FD6228D0F08D785B1AAB24
-
-350183544EB437:D25C063089641481A482D02BAE21DEB0:\
-DA042063FE9E16CBA7EA06345E479DB5
-
-424ADA19952F4588:2625B8C34C00C1F1BB066BBCCBFF9BCA:\
-8DC221212A006704B5DB69FDFE17FCF9
-
-8596E11E94EA19CC3A:86A9ACE5C41B661924C8D4CB02335E0F:\
-B7F6065E06187815BCEA2B8260C4968A
-
-7C82BF2335D8A2E21C7A:836A7DC8C531AB6CFA8022132D88B4FD:\
-43929194A29B904776D80925BCDDA258
-
-70202B9787517E4E1135C3:2C05A0B0ED6D8425347C07AC28CCE816:\
-F587DAD7CEB57FD9D205B1FBA1C7CD48
-
-AFB34746EDC8281368ADB521:01454B9D291553F7B2832A88F0D4F4A9:\
-19B140930E41923A1381B76133A28067
-
-C35C54CA3855817DC78E9E3187:A0FA07F0E142234072A12F0512197ECD:\
-C9D0F494B96DE372B33D8507EA2AA2B3
-
-A601BF53B49B3CBED0CFC259C96D:0BA5CC599A16EC3965A5E2FC53AE2016:\
-2767C4F69FF145F1226863771AC86B90
-
-3581A17D977891E5EBA90C547397A1:6A8EB76EFA42243E15A7CE5913298331:\
-4D1F72F544CE74099E135956FAF88FF8
-
-1E28DBAA317AFA919A0F97FE25B3C8A1:1DB868DE86D1E6ED593060147B78E08E:\
-C97C0A1C1E2F7327331FBF3337846251
-
-01702E80410F607CE8A85041E0419FE88A:666315D7F0A1D25BD69E7C11E0220258:\
-5E0848CEB6E1469C33B9C397C6212608
-
-DFC8914D867E651B30F5910397E6DEB9F140:137C3A9C80A9FBAE82B1B53586EED7DC:\
-DB210A614E72085F8681A82936893EE6
-
-1C8EF80E2D646CE28406C4312000F18E95D82A:B964FEC670CD39AAF35D2DC10D3071EE:\
-BF6E95E79CFF45B78B60B523682A67F8
-
-3DC82D1710367C124696CAA6760F1C01B626E065:7F6E14CF8020207D74CB786FCE9F10C0:\
-768AA70ADFAF6738DC8FF2A85C34B6AE
-
-91D45A498BB9A093F6F678C495A7EF12C881A782E0:0BCFCBF5C1011EED7453CAEBEFEDDFC3:\
-2B7D219195BA5F620E18C9628F3611EC
-
-91B47BA5E78F1D059BE584C388D76CB7F55079BAC1EC:36790C9BA09C76E402F22D4FE9127C9C:\
-A92F1EE4C1C4717339FA7A4305851B5D
-
3B2E8F8C7838FDE9610CE6FCC10F854AEAAE3A2184832A:\
6B642B7D118A78A160B7EA0E11789A99:8989DA29F037D54809D39E0F21BAD66B
@@ -59821,9 +59631,59 @@ A517CF03FBC41E32CE9A4385A141074CC3EECDFE930E607DA8B1C0C07464B61A\
43AD:DE5E5B64B403E3772CCB13E175C734FE:\
EDCBA48465D6B8BDBF274658EF587F72
+85380139C424704AC24497634E9CBFCEE21E0F99CF3AC8F9C6AE2D6FDD091363\
+41149C05380C4FFA50E65D9E831D6C653B7BFE0BB5C6047C7431EB513AFEB47B\
+1250804B5DD045ADB6A34C39C0B89EFB349C06E9620A65D63C5028764EDCF261\
+2D72AC8A42F137F9948332543CD150706D5659D061BFA69D0FCE135EAB05BFD8\
+786B62BA5C99B3F11DE64559B795C924EC22F44DE19BEAF169FD4F14030EEC7B\
+794E35D5E8E9C6:\
+3015A6D16CDDF7E1E8C28521F4064A28:FB565C5DB38C2237869ED34CA10A055C
+
+7B326530160FE8CFFB68704022DE43BBB54FCD83BF4C554774BAC625441C1DBF\
+4F82F06591D8348C40A4CD6282101D3860EBBB1F371166ABCB2DD00F49EDCF98\
+6FBFFD0197328DD7D65A39596B5791CB424CEA795D5024287DF438C7E1075F50\
+C65D515D8FDF3465396DBEA4C44F6F069C597FF9AAA32227:\
+39F2933F156616549749CCAEBF682322:\
+0398D70C12CE6F7ED28828647FB18A56
+
+[CMAC(AES-192)]
+:D17DDF46ADAACDE531CAC483DE7A9367:\
+8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
+
+6BC1BEE22E409F96E93D7E117393172A:9E99A7BF31E710900662F65E617C5184:\
+8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
+
+6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
+30C81C46A35CE411:8A1DE5BE2EB31AAD089A82E6EE908B0E:\
+8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
+
+6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
+30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
+A1D5DF0EED790F794D77589659F39A11:\
+8E73B0F7DA0E6452C810F32B809079E562F8EAD2522C6B7B
+
F4FF3C7E2F56F4:E1D41EC244EBC98373457A95685D0EFB:\
76BF48A88F0F5531C4D1A14846742CE39B8D8827F863ABDA
+E2C0FFB463EF4B6EC114322FAFB8:D25D89E8CE9685D975C645FB2A19E50D:\
+970BD2C9C46E9B85E13949E13D39B466A8070F40570D1070
+
+[CMAC(AES-256)]
+:028962F61B7BF89EFC6B551F4667D983:\
+603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
+
+6BC1BEE22E409F96E93D7E117393172A:28A7023F452E8F82BD4BF28D8C37C35C:\
+603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
+
+6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
+30C81C46A35CE411:AAF3D8F1DE5640C232F5B169B9C911E6:\
+603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
+
+6BC1BEE22E409F96E93D7E117393172AAE2D8A571E03AC9C9EB76FAC45AF8E51\
+30C81C46A35CE411E5FBC1191A0A52EFF69F2445DF4F9B17AD2B417BE66C3710:\
+E1992190549F6ED5696A2C056C315410:\
+603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4
+
B664B2C219D625DC472EC765605E6D5822681C5E9FFD10645B:\
3FC310BAF6F1A39FA25AE7DEA104EDA9:\
19449A56180CB52462C37109EA1D329708F7C4FBC43B37E1B2C55E38F5551C0E
@@ -59837,24 +59697,6 @@ F0D16D00B5CF601F1A5BE91422A5562C252C5C1DEBDF05B5BC328BF8505DF740
CB1C20084C5DACB3270F118633DB4F33:\
420D2C372E496D403A9F520158FCCDA6D6BCE14E6EAD2B90918B919E5E8621A0
-E2C0FFB463EF4B6EC114322FAFB8:D25D89E8CE9685D975C645FB2A19E50D:\
-970BD2C9C46E9B85E13949E13D39B466A8070F40570D1070
-
-85380139C424704AC24497634E9CBFCEE21E0F99CF3AC8F9C6AE2D6FDD091363\
-41149C05380C4FFA50E65D9E831D6C653B7BFE0BB5C6047C7431EB513AFEB47B\
-1250804B5DD045ADB6A34C39C0B89EFB349C06E9620A65D63C5028764EDCF261\
-2D72AC8A42F137F9948332543CD150706D5659D061BFA69D0FCE135EAB05BFD8\
-786B62BA5C99B3F11DE64559B795C924EC22F44DE19BEAF169FD4F14030EEC7B\
-794E35D5E8E9C6:\
-3015A6D16CDDF7E1E8C28521F4064A28:FB565C5DB38C2237869ED34CA10A055C
-
-7B326530160FE8CFFB68704022DE43BBB54FCD83BF4C554774BAC625441C1DBF\
-4F82F06591D8348C40A4CD6282101D3860EBBB1F371166ABCB2DD00F49EDCF98\
-6FBFFD0197328DD7D65A39596B5791CB424CEA795D5024287DF438C7E1075F50\
-C65D515D8FDF3465396DBEA4C44F6F069C597FF9AAA32227:\
-39F2933F156616549749CCAEBF682322:\
-0398D70C12CE6F7ED28828647FB18A56
-
# SSL3-MAC vectors were posted by Thomas Pornin to sci.crypt
[SSL3-MAC(MD5)]
00:A856430AF077AE2C328D9FFE4E56813A:0123456789ABCDEF0123456789ABCDEF
diff --git a/src/block/aes/aes.cpp b/src/block/aes/aes.cpp
index b317fa735..7f6c5ea9c 100644
--- a/src/block/aes/aes.cpp
+++ b/src/block/aes/aes.cpp
@@ -410,13 +410,16 @@ const u32bit TD[1024] = {
0x3C498B28, 0x0D9541FF, 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064,
0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 };
-}
-
/*
* AES Encryption
*/
-void AES::encrypt_n(const byte in[], byte out[], size_t blocks) const
+void aes_encrypt_n(const byte in[], byte out[],
+ size_t blocks,
+ const MemoryRegion<u32bit>& EK,
+ const MemoryRegion<byte>& ME)
{
+ const size_t BLOCK_SIZE = 16;
+
const u32bit* TE0 = TE;
const u32bit* TE1 = TE + 256;
const u32bit* TE2 = TE + 512;
@@ -522,8 +525,12 @@ void AES::encrypt_n(const byte in[], byte out[], size_t blocks) const
/*
* AES Decryption
*/
-void AES::decrypt_n(const byte in[], byte out[], size_t blocks) const
+void aes_decrypt_n(const byte in[], byte out[], size_t blocks,
+ const MemoryRegion<u32bit>& DK,
+ const MemoryRegion<byte>& MD)
{
+ const size_t BLOCK_SIZE = 16;
+
const u32bit* TD0 = TD;
const u32bit* TD1 = TD + 256;
const u32bit* TD2 = TD + 512;
@@ -600,9 +607,19 @@ void AES::decrypt_n(const byte in[], byte out[], size_t blocks) const
}
/*
-* AES Key Schedule
+* AES Byte Substitution
*/
-void AES::key_schedule(const byte key[], size_t length)
+u32bit aes_S(u32bit input)
+ {
+ return make_u32bit(SE[get_byte(0, input)], SE[get_byte(1, input)],
+ SE[get_byte(2, input)], SE[get_byte(3, input)]);
+ }
+
+void aes_key_schedule(const byte key[], size_t length,
+ MemoryRegion<u32bit>& EK,
+ MemoryRegion<u32bit>& DK,
+ MemoryRegion<byte>& ME,
+ MemoryRegion<byte>& MD)
{
static const u32bit RC[10] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000,
@@ -618,11 +635,11 @@ void AES::key_schedule(const byte key[], size_t length)
for(size_t i = X; i < 4*(rounds+1); i += X)
{
- XEK[i] = XEK[i-X] ^ S(rotate_left(XEK[i-1], 8)) ^ RC[(i-X)/X];
+ XEK[i] = XEK[i-X] ^ aes_S(rotate_left(XEK[i-1], 8)) ^ RC[(i-X)/X];
for(size_t j = 1; j != X; ++j)
{
if(X == 8 && j == 4)
- XEK[i+j] = XEK[i+j-X] ^ S(XEK[i+j-1]);
+ XEK[i+j] = XEK[i+j-X] ^ aes_S(XEK[i+j-1]);
else
XEK[i+j] = XEK[i+j-X] ^ XEK[i+j-1];
}
@@ -652,38 +669,70 @@ void AES::key_schedule(const byte key[], size_t length)
DK.set(&XDK[0], length + 24);
}
-/*
-* AES Byte Substitution
-*/
-u32bit AES::S(u32bit input)
+}
+
+void AES_128::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
- return make_u32bit(SE[get_byte(0, input)], SE[get_byte(1, input)],
- SE[get_byte(2, input)], SE[get_byte(3, input)]);
+ aes_encrypt_n(in, out, blocks, EK, ME);
}
-/*
-* AES Constructor
-*/
-AES::AES() : BlockCipher_Fixed_Block_Size(16, 32, 8),
- EK(0), ME(16), DK(0), MD(16)
+void AES_128::decrypt_n(const byte in[], byte out[], size_t blocks) const
{
+ aes_decrypt_n(in, out, blocks, DK, MD);
}
-/*
-* AES Constructor
-*/
-AES::AES(size_t key_size) : BlockCipher_Fixed_Block_Size(key_size),
- EK(key_size+24), ME(16),
- DK(key_size+24), MD(16)
+void AES_128::key_schedule(const byte key[], size_t length)
{
- if(key_size != 16 && key_size != 24 && key_size != 32)
- throw Invalid_Key_Length(name(), key_size);
+ aes_key_schedule(key, length, EK, DK, ME, MD);
}
-/*
-* Clear memory of sensitive data
-*/
-void AES::clear()
+void AES_128::clear()
+ {
+ zeroise(EK);
+ zeroise(DK);
+ zeroise(ME);
+ zeroise(MD);
+ }
+
+void AES_192::encrypt_n(const byte in[], byte out[], size_t blocks) const
+ {
+ aes_encrypt_n(in, out, blocks, EK, ME);
+ }
+
+void AES_192::decrypt_n(const byte in[], byte out[], size_t blocks) const
+ {
+ aes_decrypt_n(in, out, blocks, DK, MD);
+ }
+
+void AES_192::key_schedule(const byte key[], size_t length)
+ {
+ aes_key_schedule(key, length, EK, DK, ME, MD);
+ }
+
+void AES_192::clear()
+ {
+ zeroise(EK);
+ zeroise(DK);
+ zeroise(ME);
+ zeroise(MD);
+ }
+
+void AES_256::encrypt_n(const byte in[], byte out[], size_t blocks) const
+ {
+ aes_encrypt_n(in, out, blocks, EK, ME);
+ }
+
+void AES_256::decrypt_n(const byte in[], byte out[], size_t blocks) const
+ {
+ aes_decrypt_n(in, out, blocks, DK, MD);
+ }
+
+void AES_256::key_schedule(const byte key[], size_t length)
+ {
+ aes_key_schedule(key, length, EK, DK, ME, MD);
+ }
+
+void AES_256::clear()
{
zeroise(EK);
zeroise(DK);
diff --git a/src/block/aes/aes.h b/src/block/aes/aes.h
index d2e051f83..a165f83b5 100644
--- a/src/block/aes/aes.h
+++ b/src/block/aes/aes.h
@@ -1,6 +1,6 @@
/*
* AES
-* (C) 1999-2009 Jack Lloyd
+* (C) 1999-2010 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -13,68 +13,69 @@
namespace Botan {
/**
-* Rijndael aka AES
+* AES-128
*/
-class BOTAN_DLL AES : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL AES_128 : public Block_Cipher_Fixed_Params<16, 16>
{
public:
- std::string name() const { return "AES"; }
+ AES_128() : EK(40), DK(40), ME(16), MD(16) {}
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
void decrypt_n(const byte in[], byte out[], size_t blocks) const;
void clear();
- BlockCipher* clone() const { return new AES; }
-
- AES();
-
- /**
- * AES fixed to a particular key_size (16, 24, or 32 bytes)
- * @param key_size the chosen fixed key size
- */
- AES(size_t key_size);
- private:
- void key_schedule(const byte[], size_t);
- static u32bit S(u32bit);
- SecureVector<u32bit> EK;
- SecureVector<byte> ME;
-
- SecureVector<u32bit > DK;
- SecureVector<byte> MD;
- };
-
-/**
-* AES-128
-*/
-class BOTAN_DLL AES_128 : public AES
- {
- public:
std::string name() const { return "AES-128"; }
BlockCipher* clone() const { return new AES_128; }
- AES_128() : AES(16) {}
+ private:
+ void key_schedule(const byte key[], size_t length);
+
+ SecureVector<u32bit> EK, DK;
+ SecureVector<byte> ME, MD;
};
/**
* AES-192
*/
-class BOTAN_DLL AES_192 : public AES
+class BOTAN_DLL AES_192 : public Block_Cipher_Fixed_Params<16, 24>
{
public:
+ AES_192() : EK(48), DK(48), ME(16), MD(16) {}
+
+ void encrypt_n(const byte in[], byte out[], size_t blocks) const;
+ void decrypt_n(const byte in[], byte out[], size_t blocks) const;
+
+ void clear();
+
std::string name() const { return "AES-192"; }
BlockCipher* clone() const { return new AES_192; }
- AES_192() : AES(24) {}
+ private:
+ void key_schedule(const byte key[], size_t length);
+
+ SecureVector<u32bit> EK, DK;
+ SecureVector<byte> ME, MD;
};
/**
* AES-256
*/
-class BOTAN_DLL AES_256 : public AES
+class BOTAN_DLL AES_256 : public Block_Cipher_Fixed_Params<16, 32>
{
public:
+ AES_256() : EK(56), DK(56), ME(16), MD(16) {}
+
+ void encrypt_n(const byte in[], byte out[], size_t blocks) const;
+ void decrypt_n(const byte in[], byte out[], size_t blocks) const;
+
+ void clear();
+
std::string name() const { return "AES-256"; }
BlockCipher* clone() const { return new AES_256; }
- AES_256() : AES(32) {}
+ private:
+ void key_schedule(const byte key[], size_t length);
+
+ SecureVector<u32bit> EK, DK;
+ SecureVector<byte> ME, MD;
};
}
diff --git a/src/block/aes_ssse3/aes_ssse3.h b/src/block/aes_ssse3/aes_ssse3.h
index 59bb85f12..686b7999f 100644
--- a/src/block/aes_ssse3/aes_ssse3.h
+++ b/src/block/aes_ssse3/aes_ssse3.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* AES-128 using SSSE3
*/
-class BOTAN_DLL AES_128_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL AES_128_SSSE3 : public Block_Cipher_Fixed_Params<16, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,8 +25,7 @@ class BOTAN_DLL AES_128_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "AES-128"; }
BlockCipher* clone() const { return new AES_128_SSSE3; }
- AES_128_SSSE3() : BlockCipher_Fixed_Block_Size(16),
- EK(44), DK(44) {}
+ AES_128_SSSE3() : EK(44), DK(44) {}
private:
void key_schedule(const byte[], size_t);
@@ -36,7 +35,7 @@ class BOTAN_DLL AES_128_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
/**
* AES-192 using SSSE3
*/
-class BOTAN_DLL AES_192_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL AES_192_SSSE3 : public Block_Cipher_Fixed_Params<16, 24>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -46,8 +45,7 @@ class BOTAN_DLL AES_192_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "AES-192"; }
BlockCipher* clone() const { return new AES_192_SSSE3; }
- AES_192_SSSE3() : BlockCipher_Fixed_Block_Size(24),
- EK(52), DK(52) {}
+ AES_192_SSSE3() : EK(52), DK(52) {}
private:
void key_schedule(const byte[], size_t);
@@ -57,7 +55,7 @@ class BOTAN_DLL AES_192_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
/**
* AES-256 using SSSE3
*/
-class BOTAN_DLL AES_256_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL AES_256_SSSE3 : public Block_Cipher_Fixed_Params<16, 32>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -67,8 +65,7 @@ class BOTAN_DLL AES_256_SSSE3 : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "AES-256"; }
BlockCipher* clone() const { return new AES_256_SSSE3; }
- AES_256_SSSE3() : BlockCipher_Fixed_Block_Size(32),
- EK(60), DK(60) {}
+ AES_256_SSSE3() : EK(60), DK(60) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/block_cipher.h b/src/block/block_cipher.h
index 3e14e0739..b5a3c8439 100644
--- a/src/block/block_cipher.h
+++ b/src/block/block_cipher.h
@@ -115,17 +115,17 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
virtual void clear() = 0;
};
-template<size_t N>
-class BlockCipher_Fixed_Block_Size : public BlockCipher
+/**
+* Represents a block cipher with a single fixed block size
+*/
+template<size_t BS, size_t KMIN, size_t KMAX = 0, size_t KMOD = 1>
+class Block_Cipher_Fixed_Params : public BlockCipher
{
public:
- BlockCipher_Fixed_Block_Size(size_t kmin,
- size_t kmax = 0,
- size_t kmod = 1) :
- BlockCipher(kmin, kmax, kmod) {}
+ Block_Cipher_Fixed_Params() : BlockCipher(KMIN, KMAX, KMOD) {}
- enum { BLOCK_SIZE = N };
- size_t block_size() const { return N; }
+ enum { BLOCK_SIZE = BS };
+ size_t block_size() const { return BS; }
};
}
diff --git a/src/block/blowfish/blowfish.h b/src/block/blowfish/blowfish.h
index c9bf8b2e0..b89ffcaaa 100644
--- a/src/block/blowfish/blowfish.h
+++ b/src/block/blowfish/blowfish.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Blowfish
*/
-class BOTAN_DLL Blowfish : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL Blowfish : public Block_Cipher_Fixed_Params<8, 1, 56>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL Blowfish : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "Blowfish"; }
BlockCipher* clone() const { return new Blowfish; }
- Blowfish() : BlockCipher_Fixed_Block_Size(1, 56), S(1024), P(18) {}
+ Blowfish() : S(1024), P(18) {}
private:
void key_schedule(const byte[], size_t);
void generate_sbox(MemoryRegion<u32bit>& box,
diff --git a/src/block/cast/cast128.h b/src/block/cast/cast128.h
index 3ecbcaa5a..10c646c94 100644
--- a/src/block/cast/cast128.h
+++ b/src/block/cast/cast128.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* CAST-128
*/
-class BOTAN_DLL CAST_128 : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL CAST_128 : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "CAST-128"; }
BlockCipher* clone() const { return new CAST_128; }
- CAST_128() : BlockCipher_Fixed_Block_Size(11, 16), MK(16), RK(16) {}
+ CAST_128() : MK(16), RK(16) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/cast/cast256.h b/src/block/cast/cast256.h
index 0dda7f0d7..2f2beef47 100644
--- a/src/block/cast/cast256.h
+++ b/src/block/cast/cast256.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* CAST-256
*/
-class BOTAN_DLL CAST_256 : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL CAST_256 : public Block_Cipher_Fixed_Params<16, 4, 32, 4>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL CAST_256 : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "CAST-256"; }
BlockCipher* clone() const { return new CAST_256; }
- CAST_256() : BlockCipher_Fixed_Block_Size(4, 32, 4), MK(48), RK(48) {}
+ CAST_256() : MK(48), RK(48) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/des/des.h b/src/block/des/des.h
index d758cc4c1..db5a375e0 100644
--- a/src/block/des/des.h
+++ b/src/block/des/des.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* DES
*/
-class BOTAN_DLL DES : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL DES : public Block_Cipher_Fixed_Params<8, 8>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL DES : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "DES"; }
BlockCipher* clone() const { return new DES; }
- DES() : BlockCipher_Fixed_Block_Size(8), round_key(32) {}
+ DES() : round_key(32) {}
private:
void key_schedule(const byte[], size_t);
@@ -35,7 +35,7 @@ class BOTAN_DLL DES : public BlockCipher_Fixed_Block_Size<8>
/**
* Triple DES
*/
-class BOTAN_DLL TripleDES : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL TripleDES : public Block_Cipher_Fixed_Params<8, 16, 24, 8>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -45,7 +45,7 @@ class BOTAN_DLL TripleDES : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "TripleDES"; }
BlockCipher* clone() const { return new TripleDES; }
- TripleDES() : BlockCipher_Fixed_Block_Size(16, 24, 8), round_key(96) {}
+ TripleDES() : round_key(96) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/des/desx.h b/src/block/des/desx.h
index 962575529..993eca86b 100644
--- a/src/block/des/desx.h
+++ b/src/block/des/desx.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* DESX
*/
-class BOTAN_DLL DESX : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL DESX : public Block_Cipher_Fixed_Params<8, 24>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL DESX : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "DESX"; }
BlockCipher* clone() const { return new DESX; }
- DESX() : BlockCipher_Fixed_Block_Size(24), K1(8), K2(8) {}
+ DESX() : K1(8), K2(8) {}
private:
void key_schedule(const byte[], size_t);
SecureVector<byte> K1, K2;
diff --git a/src/block/gost_28147/gost_28147.cpp b/src/block/gost_28147/gost_28147.cpp
index 9adc0d568..07f3359cd 100644
--- a/src/block/gost_28147/gost_28147.cpp
+++ b/src/block/gost_28147/gost_28147.cpp
@@ -52,7 +52,7 @@ GOST_28147_89_Params::GOST_28147_89_Params(const std::string& n) : name(n)
* GOST Constructor
*/
GOST_28147_89::GOST_28147_89(const GOST_28147_89_Params& param) :
- BlockCipher_Fixed_Block_Size(32), SBOX(1024), EK(8)
+ SBOX(1024), EK(8)
{
// Convert the parallel 4x4 sboxes into larger word-based sboxes
for(size_t i = 0; i != 4; ++i)
diff --git a/src/block/gost_28147/gost_28147.h b/src/block/gost_28147/gost_28147.h
index adf542bbe..75ba74c44 100644
--- a/src/block/gost_28147/gost_28147.h
+++ b/src/block/gost_28147/gost_28147.h
@@ -49,7 +49,7 @@ class BOTAN_DLL GOST_28147_89_Params
/**
* GOST 28147-89
*/
-class BOTAN_DLL GOST_28147_89 : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL GOST_28147_89 : public Block_Cipher_Fixed_Params<8, 32>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -66,7 +66,7 @@ class BOTAN_DLL GOST_28147_89 : public BlockCipher_Fixed_Block_Size<8>
GOST_28147_89(const GOST_28147_89_Params& params);
private:
GOST_28147_89(const SecureVector<u32bit>& other_SBOX) :
- BlockCipher_Fixed_Block_Size(32), SBOX(other_SBOX), EK(8) {}
+ SBOX(other_SBOX), EK(8) {}
void key_schedule(const byte[], size_t);
diff --git a/src/block/idea/idea.h b/src/block/idea/idea.h
index 3552d282f..42fa60c47 100644
--- a/src/block/idea/idea.h
+++ b/src/block/idea/idea.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* IDEA
*/
-class BOTAN_DLL IDEA : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL IDEA : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL IDEA : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "IDEA"; }
BlockCipher* clone() const { return new IDEA; }
- IDEA() : BlockCipher_Fixed_Block_Size(16), EK(52), DK(52) {}
+ IDEA() : EK(52), DK(52) {}
protected:
/**
* @return const reference to encryption subkeys
diff --git a/src/block/kasumi/kasumi.h b/src/block/kasumi/kasumi.h
index 7b416f193..7871aa170 100644
--- a/src/block/kasumi/kasumi.h
+++ b/src/block/kasumi/kasumi.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* KASUMI, the block cipher used in 3G telephony
*/
-class BOTAN_DLL KASUMI : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL KASUMI : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL KASUMI : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "KASUMI"; }
BlockCipher* clone() const { return new KASUMI; }
- KASUMI() : BlockCipher_Fixed_Block_Size(16), EK(64) {}
+ KASUMI() : EK(64) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/mars/mars.h b/src/block/mars/mars.h
index 7a53d116b..5ca05f886 100644
--- a/src/block/mars/mars.h
+++ b/src/block/mars/mars.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* MARS, IBM's candidate for AES
*/
-class BOTAN_DLL MARS : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL MARS : public Block_Cipher_Fixed_Params<16, 16, 32, 4>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL MARS : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "MARS"; }
BlockCipher* clone() const { return new MARS; }
- MARS() : BlockCipher_Fixed_Block_Size(16, 32, 4), EK(40) {}
+ MARS() : EK(40) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/misty1/misty1.cpp b/src/block/misty1/misty1.cpp
index 56a995b76..36c25a814 100644
--- a/src/block/misty1/misty1.cpp
+++ b/src/block/misty1/misty1.cpp
@@ -251,9 +251,7 @@ void MISTY1::key_schedule(const byte key[], size_t length)
/*
* MISTY1 Constructor
*/
-MISTY1::MISTY1(size_t rounds) :
- BlockCipher_Fixed_Block_Size(16),
- EK(100), DK(100)
+MISTY1::MISTY1(size_t rounds) : EK(100), DK(100)
{
if(rounds != 8)
throw Invalid_Argument("MISTY1: Invalid number of rounds: "
diff --git a/src/block/misty1/misty1.h b/src/block/misty1/misty1.h
index 3bd05b4c6..14d8a2958 100644
--- a/src/block/misty1/misty1.h
+++ b/src/block/misty1/misty1.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* MISTY1
*/
-class BOTAN_DLL MISTY1 : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL MISTY1 : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
diff --git a/src/block/noekeon/noekeon.h b/src/block/noekeon/noekeon.h
index 79c627579..7c5c73dcb 100644
--- a/src/block/noekeon/noekeon.h
+++ b/src/block/noekeon/noekeon.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Noekeon
*/
-class BOTAN_DLL Noekeon : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL Noekeon : public Block_Cipher_Fixed_Params<16, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL Noekeon : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "Noekeon"; }
BlockCipher* clone() const { return new Noekeon; }
- Noekeon() : BlockCipher_Fixed_Block_Size(16), EK(4), DK(4) {}
+ Noekeon() : EK(4), DK(4) {}
protected:
/**
* The Noekeon round constants
diff --git a/src/block/rc2/rc2.h b/src/block/rc2/rc2.h
index ad4b1a308..1ebad1e73 100644
--- a/src/block/rc2/rc2.h
+++ b/src/block/rc2/rc2.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* RC2
*/
-class BOTAN_DLL RC2 : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL RC2 : public Block_Cipher_Fixed_Params<8, 1, 32>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -32,7 +32,7 @@ class BOTAN_DLL RC2 : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "RC2"; }
BlockCipher* clone() const { return new RC2; }
- RC2() : BlockCipher_Fixed_Block_Size(1, 32), K(64) {}
+ RC2() : K(64) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/rc5/rc5.cpp b/src/block/rc5/rc5.cpp
index d9e74683c..cfcc4cb64 100644
--- a/src/block/rc5/rc5.cpp
+++ b/src/block/rc5/rc5.cpp
@@ -122,7 +122,7 @@ std::string RC5::name() const
/*
* RC5 Constructor
*/
-RC5::RC5(size_t rounds) : BlockCipher_Fixed_Block_Size(1, 32)
+RC5::RC5(size_t rounds)
{
if(rounds < 8 || rounds > 32 || (rounds % 4 != 0))
throw Invalid_Argument("RC5: Invalid number of rounds " +
diff --git a/src/block/rc5/rc5.h b/src/block/rc5/rc5.h
index cb282af4e..c69705471 100644
--- a/src/block/rc5/rc5.h
+++ b/src/block/rc5/rc5.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* RC5
*/
-class BOTAN_DLL RC5 : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL RC5 : public Block_Cipher_Fixed_Params<8, 1, 32>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
diff --git a/src/block/rc6/rc6.h b/src/block/rc6/rc6.h
index 8446138e0..af7b62316 100644
--- a/src/block/rc6/rc6.h
+++ b/src/block/rc6/rc6.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* RC6, Ron Rivest's AES candidate
*/
-class BOTAN_DLL RC6 : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL RC6 : public Block_Cipher_Fixed_Params<16, 1, 32>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL RC6 : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "RC6"; }
BlockCipher* clone() const { return new RC6; }
- RC6() : BlockCipher_Fixed_Block_Size(1, 32), S(44) {}
+ RC6() : S(44) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/safer/safer_sk.cpp b/src/block/safer/safer_sk.cpp
index 941c4fed8..59a6cc276 100644
--- a/src/block/safer/safer_sk.cpp
+++ b/src/block/safer/safer_sk.cpp
@@ -131,8 +131,7 @@ BlockCipher* SAFER_SK::clone() const
/*
* SAFER-SK Constructor
*/
-SAFER_SK::SAFER_SK(size_t rounds) :
- BlockCipher_Fixed_Block_Size(16)
+SAFER_SK::SAFER_SK(size_t rounds)
{
if(rounds > 13 || rounds == 0)
throw Invalid_Argument(name() + ": Invalid number of rounds");
diff --git a/src/block/safer/safer_sk.h b/src/block/safer/safer_sk.h
index 2fde757bd..803afffa0 100644
--- a/src/block/safer/safer_sk.h
+++ b/src/block/safer/safer_sk.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* SAFER-SK
*/
-class BOTAN_DLL SAFER_SK : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL SAFER_SK : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
diff --git a/src/block/seed/seed.h b/src/block/seed/seed.h
index 649e28a68..979312930 100644
--- a/src/block/seed/seed.h
+++ b/src/block/seed/seed.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* SEED, a Korean block cipher
*/
-class BOTAN_DLL SEED : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL SEED : public Block_Cipher_Fixed_Params<16, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL SEED : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "SEED"; }
BlockCipher* clone() const { return new SEED; }
- SEED() : BlockCipher_Fixed_Block_Size(16), K(32) {}
+ SEED() : K(32) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/serpent/serpent.h b/src/block/serpent/serpent.h
index fccdcf214..33bd747cd 100644
--- a/src/block/serpent/serpent.h
+++ b/src/block/serpent/serpent.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Serpent, an AES finalist
*/
-class BOTAN_DLL Serpent : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL Serpent : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,8 +25,7 @@ class BOTAN_DLL Serpent : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "Serpent"; }
BlockCipher* clone() const { return new Serpent; }
- Serpent() : BlockCipher_Fixed_Block_Size(16, 32, 8),
- round_key(132) {}
+ Serpent() : round_key(132) {}
protected:
/**
* For use by subclasses using SIMD, asm, etc
diff --git a/src/block/skipjack/skipjack.h b/src/block/skipjack/skipjack.h
index 73ae28de2..051d35351 100644
--- a/src/block/skipjack/skipjack.h
+++ b/src/block/skipjack/skipjack.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Skipjack, a NSA designed cipher used in Fortezza
*/
-class BOTAN_DLL Skipjack : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL Skipjack : public Block_Cipher_Fixed_Params<8, 10>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL Skipjack : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "Skipjack"; }
BlockCipher* clone() const { return new Skipjack; }
- Skipjack() : BlockCipher_Fixed_Block_Size(10), FTAB(2560) {}
+ Skipjack() : FTAB(2560) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/square/square.h b/src/block/square/square.h
index d6df63131..5147c0383 100644
--- a/src/block/square/square.h
+++ b/src/block/square/square.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Square
*/
-class BOTAN_DLL Square : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL Square : public Block_Cipher_Fixed_Params<16, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,9 +25,7 @@ class BOTAN_DLL Square : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "Square"; }
BlockCipher* clone() const { return new Square; }
- Square() : BlockCipher_Fixed_Block_Size(16),
- EK(28), DK(28), ME(32), MD(32) {}
-
+ Square() : EK(28), DK(28), ME(32), MD(32) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/tea/tea.h b/src/block/tea/tea.h
index a7318ba5c..0290b112f 100644
--- a/src/block/tea/tea.h
+++ b/src/block/tea/tea.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* TEA
*/
-class BOTAN_DLL TEA : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL TEA : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL TEA : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "TEA"; }
BlockCipher* clone() const { return new TEA; }
- TEA() : BlockCipher_Fixed_Block_Size(16), K(4) {}
+ TEA() : K(4) {}
private:
void key_schedule(const byte[], size_t);
SecureVector<u32bit> K;
diff --git a/src/block/twofish/twofish.h b/src/block/twofish/twofish.h
index a212bd285..7594bdcfd 100644
--- a/src/block/twofish/twofish.h
+++ b/src/block/twofish/twofish.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* Twofish, an AES finalist
*/
-class BOTAN_DLL Twofish : public BlockCipher_Fixed_Block_Size<16>
+class BOTAN_DLL Twofish : public Block_Cipher_Fixed_Params<16, 16, 32, 8>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,9 +25,7 @@ class BOTAN_DLL Twofish : public BlockCipher_Fixed_Block_Size<16>
std::string name() const { return "Twofish"; }
BlockCipher* clone() const { return new Twofish; }
- Twofish() : BlockCipher_Fixed_Block_Size(16, 32, 8),
- SB(1024), RK(40) {}
-
+ Twofish() : SB(1024), RK(40) {}
private:
void key_schedule(const byte[], size_t);
diff --git a/src/block/xtea/xtea.h b/src/block/xtea/xtea.h
index 539725be8..985e9d6d1 100644
--- a/src/block/xtea/xtea.h
+++ b/src/block/xtea/xtea.h
@@ -15,7 +15,7 @@ namespace Botan {
/**
* XTEA
*/
-class BOTAN_DLL XTEA : public BlockCipher_Fixed_Block_Size<8>
+class BOTAN_DLL XTEA : public Block_Cipher_Fixed_Params<8, 16>
{
public:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -25,7 +25,7 @@ class BOTAN_DLL XTEA : public BlockCipher_Fixed_Block_Size<8>
std::string name() const { return "XTEA"; }
BlockCipher* clone() const { return new XTEA; }
- XTEA() : BlockCipher_Fixed_Block_Size(16), EK(64) {}
+ XTEA() : EK(64) {}
protected:
/**
* @return const reference to the key schedule
diff --git a/src/engine/core_engine/lookup_block.cpp b/src/engine/core_engine/lookup_block.cpp
index 77436c8c1..cc5239dd1 100644
--- a/src/engine/core_engine/lookup_block.cpp
+++ b/src/engine/core_engine/lookup_block.cpp
@@ -117,8 +117,6 @@ BlockCipher* Core_Engine::find_block_cipher(const SCAN_Name& request,
{
#if defined(BOTAN_HAS_AES)
- if(request.algo_name() == "AES")
- return new AES;
if(request.algo_name() == "AES-128")
return new AES_128;
if(request.algo_name() == "AES-192")
diff --git a/src/libstate/policy.cpp b/src/libstate/policy.cpp
index 803ca518e..05ca6f807 100644
--- a/src/libstate/policy.cpp
+++ b/src/libstate/policy.cpp
@@ -268,7 +268,6 @@ void set_default_aliases(Library_State& config)
config.add_alias("PSS-MGF1", "EMSA4");
config.add_alias("EMSA-PSS", "EMSA4");
- config.add_alias("Rijndael", "AES");
config.add_alias("3DES", "TripleDES");
config.add_alias("DES-EDE", "TripleDES");
config.add_alias("CAST5", "CAST-128");