URL
https://opencores.org/ocsvn/clefia-fpga/clefia-fpga/trunk
Subversion Repositories clefia-fpga
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 2 to Rev 3
- ↔ Reverse comparison
Rev 2 → Rev 3
/clefia-fpga/trunk/rtl/type3/config.vhdl
File deleted
\ No newline at end of file
/clefia-fpga/trunk/rtl/type3/data_path_pipeline.vhd
File deleted
/clefia-fpga/trunk/rtl/type3/key_exp.vhd
File deleted
\ No newline at end of file
/clefia-fpga/trunk/rtl/type3/regcore.vhd
File deleted
/clefia-fpga/trunk/rtl/type3/state_machine.vhd
File deleted
\ No newline at end of file
/clefia-fpga/trunk/rtl/type3/data_registry.vhd
File deleted
/clefia-fpga/trunk/rtl/type3/core.vhd
File deleted
/clefia-fpga/trunk/doc/clefia-userguide_rev2.pdf
Cannot display: file marked as a binary type.
svn:mime-type = application/pdf
clefia-fpga/trunk/doc/clefia-userguide_rev2.pdf
Property changes :
Deleted: svn:mime-type
## -1 +0,0 ##
-application/pdf
\ No newline at end of property
Index: clefia-fpga/trunk/doc/clefia-architecture-key_expansion_rev2.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/pdf
Index: clefia-fpga/trunk/doc/clefia-architecture-key_expansion_rev2.pdf
===================================================================
--- clefia-fpga/trunk/doc/clefia-architecture-key_expansion_rev2.pdf (revision 2)
+++ clefia-fpga/trunk/doc/clefia-architecture-key_expansion_rev2.pdf (nonexistent)
clefia-fpga/trunk/doc/clefia-architecture-key_expansion_rev2.pdf
Property changes :
Deleted: svn:mime-type
## -1 +0,0 ##
-application/pdf
\ No newline at end of property
Index: clefia-fpga/trunk/doc/clefia-architecture-blockcipher_rev2.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/pdf
Index: clefia-fpga/trunk/doc/clefia-architecture-blockcipher_rev2.pdf
===================================================================
--- clefia-fpga/trunk/doc/clefia-architecture-blockcipher_rev2.pdf (revision 2)
+++ clefia-fpga/trunk/doc/clefia-architecture-blockcipher_rev2.pdf (nonexistent)
clefia-fpga/trunk/doc/clefia-architecture-blockcipher_rev2.pdf
Property changes :
Deleted: svn:mime-type
## -1 +0,0 ##
-application/pdf
\ No newline at end of property
Index: clefia-fpga/trunk/sim/xilinx-memory/TB_0.coe
===================================================================
--- clefia-fpga/trunk/sim/xilinx-memory/TB_0.coe (revision 2)
+++ clefia-fpga/trunk/sim/xilinx-memory/TB_0.coe (nonexistent)
@@ -1,522 +0,0 @@
-;******************************************************************
-;******** TB_0_2
-;******************************************************************
-;
-; This .COE file specifies initialization values for a block
-; memory of depth=512, and width=32. In this case, values are
-; specified in hexadecimal format.
-memory_initialization_radix=16;
-memory_initialization_vector=
-57ae41ef,
-499239ab,
-d1bf63dc,
-c6913fae,
-2f5ebce2,
-3366ccaa,
-74e8cd25,
-fbebcb20,
-95376e59,
-6ddaa973,
-8219322b,
-eac98f46,
-0e1c3824,
-b07dfa87,
-a84d9ad7,
-1c387048,
-2850a0f0,
-d0bd67da,
-4b9631a7,
-9239724b,
-5cb86dd5,
-eec19f5e,
-85172e39,
-b17ffe81,
-c49537a2,
-0a14283c,
-76ecc529,
-3d7af48e,
-63c69157,
-f9efc32c,
-172e5c72,
-af4386c5,
-bf63c6a5,
-a15fbee1,
-19326456,
-65ca8943,
-f7f3fb08,
-7af4f501,
-3264c8ac,
-204080c0,
-060c1814,
-ce811f9e,
-e4d5b762,
-831b362d,
-9d274e69,
-5bb671c7,
-4c982db5,
-d8ad47ea,
-42841591,
-5dba69d3,
-2e5cb8e4,
-e8cd874a,
-d4b577c2,
-9b2b567d,
-0f1e3c22,
-13264c6a,
-3c78f088,
-890f1e11,
-67ce814f,
-c09d27ba,
-71e2d93b,
-aa4992db,
-b671e293,
-f5f7f304,
-a455aaff,
-be61c2a3,
-fde7d334,
-8c050a0f,
-1224486c,
-00000000,
-97336655,
-daa94fe6,
-78f0fd0d,
-e1dfa37c,
-cf831b98,
-6bd6b167,
-3972e496,
-43861197,
-55aa49e3,
-264c98d4,
-3060c0a0,
-982d5a77,
-cc851792,
-dda753f4,
-ebcb8b40,
-54a84de5,
-b37bf68d,
-8f030605,
-4e9c25b9,
-162c5874,
-fae9cf26,
-224488cc,
-a557aef9,
-77eec12f,
-09122436,
-61c2995b,
-d6b17fce,
-2a54a8fc,
-53a651f7,
-376edcb2,
-458a0983,
-c19f23bc,
-6cd8ad75,
-ae4182c3,
-efc39b58,
-70e0dd3d,
-08102030,
-992f5e71,
-8b0b161d,
-1d3a744e,
-f2f9ef16,
-b475ea9f,
-e9cf834c,
-c7933ba8,
-9f234665,
-4a9435a1,
-3162c4a6,
-254a94de,
-fee1df3e,
-7cf8ed15,
-d3bb6bd0,
-a259b2eb,
-bd67cea9,
-56ac45e9,
-14285078,
-880d1a17,
-60c09d5d,
-0b162c3a,
-cd871394,
-e2d9af76,
-3468d0b8,
-50a05dfd,
-9e214263,
-dca557f2,
-11224466,
-050a141e,
-2b56acfa,
-b773e695,
-a94f9ed1,
-48903dad,
-ffe3db38,
-66cc8549,
-8a09121b,
-73e6d137,
-03060c0a,
-75eac923,
-86112233,
-f1ffe31c,
-6ad4b561,
-a753a6f5,
-40801d9d,
-c2992fb6,
-b96fdeb1,
-2c58b0e8,
-dbab4be0,
-1f3e7c42,
-58b07dcd,
-94356a5f,
-3e7cf884,
-edc79354,
-fce5d732,
-1b366c5a,
-a05dbae7,
-04081018,
-b86ddab7,
-8d070e09,
-e6d1bf6e,
-59b279cb,
-62c49551,
-933b764d,
-356ad4be,
-7efce519,
-ca890f86,
-214284c6,
-dfa35bf8,
-478e018f,
-152a547e,
-f3fbeb10,
-ba69d2bb,
-7ffee11f,
-a651a2f3,
-69d2b96b,
-c88d078a,
-4d9a29b3,
-87132635,
-3b76ec9a,
-9c254a6f,
-01020406,
-e0dda77a,
-dea15ffe,
-244890d8,
-52a455f1,
-7bf6f107,
-0c183028,
-68d0bd6d,
-1e3c7844,
-801d3a27,
-b279f28b,
-5ab475c1,
-e7d3bb68,
-ad478ec9,
-d5b773c4,
-23468cca,
-f4f5f702,
-468c0589,
-3f7efc82,
-913f7e41,
-c98f038c,
-6edca579,
-84152a3f,
-72e4d531,
-bb6bd6bd,
-0d1a342e,
-18306050,
-d9af43ec,
-96316253,
-f0fde71a,
-5fbe61df,
-4182199b,
-ac458acf,
-274e9cd2,
-c59733a4,
-e3dbab70,
-3a74e89c,
-811f3e21,
-6fdea17f,
-070e1c12,
-a35bb6ed,
-79f2f90b,
-f6f1ff0e,
-2d5ab4ee,
-3870e090,
-1a34685c,
-44880d85,
-5ebc65d9,
-b577ee99,
-d2b96fd6,
-ecc59752,
-cb8b0b80,
-903d7a47,
-9a29527b,
-366cd8b4,
-e5d7b364,
-2952a4f6,
-c39b2bb0,
-4f9e21bf,
-ab4b96dd,
-64c88d45,
-51a259fb,
-f8edc72a,
-10204060,
-d7b37bc8,
-bc65caaf,
-0204080c,
-7dfae913,
-8e010203,
-;------------
-6c47d89f,
-da9ea937,
-c3569bcd,
-e91bcfd4,
-4e4a9cd6,
-9d9c27bb,
-0a501444,
-3df57a8f,
-b8a96dc4,
-36ad6cc1,
-b4c975bc,
-38dd70ad,
-139826be,
-34bd68d5,
-0c601878,
-d986af29,
-bf9163f2,
-7487e86f,
-94d435e1,
-8f0c030f,
-b7d173a2,
-9c9425b1,
-e57bd7ac,
-dcaea50b,
-9e8421a5,
-07380e36,
-497292e0,
-4f429edc,
-98b42d99,
-2c7d5825,
-b0e97d94,
-93ec3bd7,
-129024b4,
-eb0bcbc0,
-cd2687a1,
-b3f17b8a,
-92e439dd,
-e76bd3b8,
-413282b0,
-6027c0e7,
-e34bdb90,
-21154257,
-27254e6b,
-3bc576b3,
-e663d1b2,
-19c832fa,
-d2deb967,
-0e701c6c,
-91fc3fc3,
-118822aa,
-c77693e5,
-3fe57e9b,
-2a4d5419,
-8e040105,
-a1615f3e,
-bc8965ec,
-2b455613,
-c80e8d83,
-c56697f1,
-0f781e66,
-5be2b654,
-f3cbfb30,
-874c135f,
-8b2c0b27,
-fb8beb60,
-f5fbf70c,
-debea11f,
-201d405d,
-c67e91ef,
-a7515302,
-84541541,
-ce3e81bf,
-d88ead23,
-650fcac5,
-51b2a210,
-c9068f89,
-a449551c,
-ef2bc3e8,
-432286a4,
-53a2a604,
-25354a7f,
-5dd2ba68,
-9bac2b87,
-319562f7,
-e813cdde,
-3eed7c91,
-0d681a72,
-d7f6b345,
-80741d69,
-ffabe348,
-696fd2bd,
-8a24092d,
-bab969d0,
-0b58164e,
-73bfe659,
-5cdab862,
-6e57dc8b,
-549aa832,
-15a82a82,
-6237c4f3,
-f6e3f112,
-35b56adf,
-309d60fd,
-52aaa40e,
-a3715b2a,
-16b02c9c,
-d3d6bb6d,
-285d500d,
-328d64e9,
-fa83e96a,
-aa394970,
-5ecabc76,
-cf3683b5,
-ea03c9ca,
-ed3bc7fc,
-78e7f017,
-338566e3,
-58fab04a,
-0948125a,
-7bfff609,
-633fc6f9,
-c04e9dd3,
-c1469fd9,
-460a8c86,
-1ef03ccc,
-dfb6a315,
-a9214f6e,
-99bc2f93,
-5592aa38,
-04200828,
-c46e95fb,
-86441155,
-39d572a7,
-779fee71,
-8264197d,
-ec33c5f6,
-403a80ba,
-18c030f0,
-90f43dc9,
-97cc33ff,
-59f2b240,
-dda6a701,
-836c1b77,
-1ff83ec6,
-9aa4298d,
-37a56ecb,
-06300c3c,
-243d4875,
-6407c8cf,
-7cc7f83f,
-a5415716,
-568aac26,
-487a90ea,
-08401050,
-855c174b,
-d0cebd73,
-612fc2ed,
-262d4c61,
-ca1e8997,
-6f5fde81,
-7ed7fc2b,
-6a77d4a3,
-b6d971a8,
-71afe24d,
-a0695d34,
-70a7e047,
-05280a22,
-d1c6bf79,
-45128a98,
-8c140511,
-23054643,
-1ce038d8,
-f0d3fd2e,
-ee23c1e2,
-893c0f33,
-ad014746,
-7af7f403,
-4b6296f4,
-c25e99c7,
-2f655e3b,
-db96ab3d,
-5aeab45e,
-4d529ac8,
-7697ec7b,
-671fced1,
-17b82e96,
-2d755a2f,
-f4f3f506,
-cb168b9d,
-b1e17f9e,
-4a6a94fe,
-a8294d64,
-b5c177b6,
-220d4449,
-47028e8c,
-3acd74b9,
-d5e6b751,
-108020a0,
-4c5a98c2,
-72b7e453,
-cc2e85ab,
-00000000,
-f99bef74,
-e053dd8e,
-fdbbe75c,
-e243d99a,
-fea3e142,
-ae194158,
-f893ed7e,
-5fc2be7c,
-ab314b7a,
-f1dbff24,
-1bd836ee,
-422a84ae,
-817c1f63,
-d6feb14f,
-be9961f8,
-441a8892,
-29555207,
-a6595108,
-5782ae2c,
-b9a16fce,
-af114352,
-f2c3f93a,
-d4eeb55b,
-758fea65,
-6617ccdb,
-bbb16bda,
-6867d0b7,
-9f8c23af,
-50baa01a,
-02100414,
-0108020a,
-3cfd7885,
-7fdffe21,
-8d1c071b,
-1ad034e4,
-88340d39,
-bd8167e6,
-ac09454c,
-f7ebf318,
-e473d5a6,
-79eff21d,
-96c431f5,
-a2795920,
-fcb3e556,
-6d4fda95,
-b2f97980,
-6b7fd6a9,
-0318061e,
-e15bdf84,
-2e6d5c31,
-7dcffa35,
-14a02888,
-95dc37eb,
-1de83ad2;
Index: clefia-fpga/trunk/sim/xilinx-memory/TB_1.coe
===================================================================
--- clefia-fpga/trunk/sim/xilinx-memory/TB_1.coe (revision 2)
+++ clefia-fpga/trunk/sim/xilinx-memory/TB_1.coe (nonexistent)
@@ -1,522 +0,0 @@
-;******************************************************************
-;******** TB_1_3
-;******************************************************************
-;
-; This .COE file specifies initialization values for a block
-; memory of depth=512, and width=32. In this case, values are
-; specified in hexadecimal format.
-memory_initialization_radix=16;
-memory_initialization_vector=
-d86c75ad,
-a9dae64f,
-9bc3b02b,
-cfe94c83,
-9c4eb925,
-279d694e,
-140a3c28,
-7a3d8ef4,
-6db8b7da,
-6c36b4d8,
-75b49fea,
-703890e0,
-26136a4c,
-6834b8d0,
-180c2830,
-afd9ec43,
-63bfa5c6,
-e87425cd,
-35945f6a,
-038f0506,
-73b795e6,
-259c6f4a,
-d7e564b3,
-a5dcf257,
-219e6342,
-0e07121c,
-9249ab39,
-9e4fbf21,
-2d98775a,
-582ce8b0,
-7db087fa,
-3b934d76,
-24126c48,
-cbeb408b,
-87cd9413,
-7bb38df6,
-39924b72,
-d3e768bb,
-82419b19,
-c0605d9d,
-dbe370ab,
-4221c684,
-4e27d29c,
-763b9aec,
-d1e66ebf,
-32195664,
-b9d2d66f,
-1c0e2438,
-3f91417e,
-22116644,
-93c7a83b,
-7e3f82fc,
-542afca8,
-018e0302,
-5fa1e1be,
-65bcafca,
-562bfaac,
-8dc88a07,
-97c5a433,
-1e0f223c,
-b65bc771,
-fbf310eb,
-13873526,
-0b8b1d16,
-ebfb20cb,
-f7f504f3,
-a1defe5f,
-4020c080,
-91c6ae3f,
-53a7f5a6,
-15843f2a,
-81ce9e1f,
-add8ea47,
-ca654389,
-a251fb59,
-8fc98c03,
-55a4ffaa,
-c3ef589b,
-86439711,
-a653f751,
-4a25de94,
-ba5dd369,
-2b9b7d56,
-6231a6c4,
-cde84a87,
-7c3e84f8,
-1a0d2e34,
-b3d7c87b,
-1d80273a,
-e3ff38db,
-d2696bb9,
-098a1b12,
-69babbd2,
-160b3a2c,
-e67337d1,
-b85cd56d,
-dc6e79a5,
-a854e54d,
-2a157e54,
-c4625195,
-f1f60eff,
-6a35bed4,
-6030a0c0,
-a452f155,
-5ba3edb6,
-2c167458,
-bbd3d06b,
-5028f0a0,
-6432acc8,
-e9fa26cf,
-49aadb92,
-bc5ed965,
-83cf981b,
-c9ea468f,
-c7ed5493,
-f0780dfd,
-6633aacc,
-b058cd7d,
-12093624,
-f67b07f1,
-c6635791,
-9dc0ba27,
-9fc1bc23,
-8c468905,
-3c1e4478,
-a3dff85b,
-4fa9d19e,
-2f99715e,
-aa55e349,
-08041810,
-95c4a237,
-11863322,
-723996e4,
-ee772fc1,
-19822b32,
-c5ec5297,
-80409d1d,
-30185060,
-3d90477a,
-33975566,
-b259cb79,
-a7ddf453,
-1b832d36,
-3e1f427c,
-299a7b52,
-6e37b2dc,
-0c061418,
-4824d890,
-c864458d,
-f87c15ed,
-57a5f9ae,
-ac56e945,
-9048ad3d,
-10083020,
-1785392e,
-bdd0da67,
-c2615b99,
-4c26d498,
-89ca860f,
-de6f7fa1,
-fc7e19e5,
-d46a61b5,
-71b693e2,
-e2713bd9,
-5da0e7ba,
-e0703ddd,
-0a051e14,
-bfd1dc63,
-8a458309,
-058c0f0a,
-4623ca8c,
-381c4870,
-fdf01ae7,
-c1ee5e9f,
-0f89111e,
-47adc98e,
-f47a01f5,
-964ba731,
-99c2b62f,
-5e2fe2bc,
-abdbe04b,
-b45ac175,
-9a4db329,
-ec7629c5,
-ce674f81,
-2e17725c,
-5a2deeb4,
-f5f402f7,
-8bcb800b,
-7fb181fe,
-944aa135,
-4da8d79a,
-77b599ee,
-4422cc88,
-8e478f01,
-743a9ce8,
-b7d5c473,
-20106040,
-984cb52d,
-e47231d5,
-85cc9217,
-00000000,
-eff92cc3,
-dde07aa7,
-e7fd34d3,
-d9e276af,
-e1fe3edf,
-41aec382,
-edf82ac7,
-be5fdf61,
-4babdd96,
-fff11ce3,
-361b5a6c,
-84429115,
-1f81213e,
-b1d6ce7f,
-61bea3c2,
-8844850d,
-5229f6a4,
-51a6f3a2,
-ae57ef41,
-6fb9b1de,
-43afc586,
-f9f216ef,
-b5d4c277,
-ea7523c9,
-cc664985,
-6bbbbdd6,
-d0686dbd,
-239f6546,
-a050fd5d,
-04020c08,
-02010604,
-783c88f0,
-fe7f1fe1,
-078d090e,
-341a5c68,
-0d88171a,
-67bda9ce,
-45accf8a,
-f3f708fb,
-d5e462b7,
-f2790bf9,
-31965362,
-59a2ebb2,
-e5fc32d7,
-da6d73a9,
-79b28bf2,
-d66b67b1,
-06030a0c,
-dfe17ca3,
-5c2ee4b8,
-fa7d13e9,
-28147850,
-3795596e,
-3a1d4e74,
-;--------
-82572cae,
-7249e092,
-c6d179bf,
-7ec6ef91,
-652f3b5e,
-8533e366,
-87746fe8,
-8bfb60eb,
-dc95eb37,
-4f6d95da,
-64827d19,
-03eacac9,
-700e6c1c,
-e9b0947d,
-29a8644d,
-e01cd838,
-5d280d50,
-ced073bd,
-624bf496,
-e492dd39,
-da5c62b8,
-23eee2c1,
-5c854b17,
-e1b19e7f,
-6ec4fb95,
-500a4414,
-97767bec,
-f53d8f7a,
-3f63f9c6,
-9bf974ef,
-b817962e,
-11af5243,
-91bff263,
-61a13e5f,
-c819fa32,
-0f65c5ca,
-ebf718f3,
-f77a03f4,
-8d32e964,
-1d205d40,
-30063c0c,
-3ecebf81,
-73e4a6d5,
-6c83771b,
-9c9dbb27,
-e25b54b6,
-5a4cc298,
-8ed823ad,
-2a42ae84,
-d25d68ba,
-6d2e315c,
-13e8decd,
-eed45bb5,
-ac9b872b,
-780f661e,
-9813be26,
-fd3c8578,
-3c89330f,
-1f67d1ce,
-4ec0d39d,
-af714de2,
-39aa7049,
-d9b6a871,
-fbf50cf7,
-49a41c55,
-99bef861,
-bbfd5ce7,
-148c1105,
-9012b424,
-00000000,
-cc97ff33,
-9eda37a9,
-e77817f0,
-5be184df,
-36cfb583,
-7f6ba9d6,
-d539a772,
-2243a486,
-925538aa,
-2d26614c,
-9d30fd60,
-b498992d,
-2eccab85,
-a6dd01a7,
-0bebc0cb,
-9a5432a8,
-f1b38a7b,
-0c8f0f03,
-4a4ed69c,
-b0169c2c,
-83fa6ae9,
-0d224944,
-41a51657,
-9f7771ee,
-48095a12,
-2f61edc2,
-fed64fb1,
-4d2a1954,
-a25304a6,
-a537cb6e,
-1245988a,
-46c1d99f,
-476c9fd8,
-19ae5841,
-2befe8c3,
-a77047e0,
-40085010,
-bc99932f,
-2c8b270b,
-e81dd23a,
-c3f23af9,
-c9b4bc75,
-1be9d4cf,
-76c7e593,
-8c9faf23,
-6a4afe94,
-9531f762,
-35257f4a,
-a3fe42e1,
-c77c3ff8,
-d6d36dbb,
-79a22059,
-81bde667,
-8a5626ac,
-a0148828,
-3488390d,
-2760e7c0,
-580b4e16,
-26cda187,
-43e29ad9,
-bd34d568,
-ba501aa0,
-849ea521,
-aedc0ba5,
-8811aa22,
-2805220a,
-452b1356,
-d1b7a273,
-21a96e4f,
-7a48ea90,
-abff48e3,
-1766dbcc,
-248a2d09,
-bf7359e6,
-18031e06,
-8f7565ea,
-44865511,
-dbf124ff,
-776aa3d4,
-51a70253,
-3a40ba80,
-5ec2c799,
-a1b9ce6f,
-7d2c2558,
-96db3dab,
-f81fc63e,
-fa584ab0,
-d494e135,
-ed3e917c,
-3bedfcc7,
-b3fc56e5,
-d81bee36,
-69a0345d,
-20042808,
-a9b8c46d,
-1c8d1b07,
-63e6b2d1,
-f25940b2,
-3762f3c4,
-ec93d73b,
-b535df6a,
-d77e2bfc,
-1eca9789,
-15215742,
-b6df15a3,
-02478c8e,
-a815822a,
-cbf330fb,
-b9bad069,
-df7f21fe,
-59a60851,
-6f69bdd2,
-0ec8838d,
-524dc89a,
-4c875f13,
-c53bb376,
-949cb125,
-08010a02,
-53e08edd,
-bede1fa1,
-3d247548,
-aa520ea4,
-ff7b09f6,
-600c7818,
-6768b7d0,
-f01ecc3c,
-7480691d,
-f9b28079,
-ea5a5eb4,
-6be7b8d3,
-01ad4647,
-e6d551b7,
-05234346,
-f3f406f5,
-0a46868c,
-e53f9b7e,
-fc91c33f,
-06c9898f,
-576e8bdc,
-54844115,
-b77253e4,
-b1bbda6b,
-680d721a,
-c018f030,
-86d929af,
-c496f531,
-d3f02efd,
-c25f7cbe,
-3241b082,
-09ac4c45,
-25276b4e,
-66c5f197,
-4be390db,
-cd3ab974,
-7c81631f,
-5f6f81de,
-3807360e,
-71a32a5b,
-ef791df2,
-e3f612f1,
-752d2f5a,
-dd38ad70,
-d01ae434,
-1a449288,
-ca5e76bc,
-c1b5b677,
-ded267b9,
-33ecf6c5,
-16cb9d8b,
-f490c93d,
-a49a8d29,
-ad36c16c,
-7be5acd7,
-55290752,
-56c3cd9b,
-424fdc9e,
-31ab7a4b,
-0764cfc8,
-b25110a2,
-93f87eed,
-8010a020,
-f6d745b3,
-89bcec65,
-10021404,
-cf7d35fa,
-048e0501;
Index: clefia-fpga/trunk/sim/xilinx-memory/KeyExp.coe
===================================================================
--- clefia-fpga/trunk/sim/xilinx-memory/KeyExp.coe (revision 2)
+++ clefia-fpga/trunk/sim/xilinx-memory/KeyExp.coe (nonexistent)
@@ -1,387 +0,0 @@
-memory_initialization_radix=16;
-memory_initialization_vector=
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-f56b7aeb,
-994a8a42,
-96a4bd75,
-fa854521,
-735b768a,
-1f7abac4,
-d5bc3b45,
-b99d5d62,
-52d73592,
-3ef636e5,
-c57a1ac9,
-a95b9b72,
-5ab42554,
-369555ed,
-1553ba9a,
-7972b2a2,
-e6b85d4d,
-8a995951,
-4b550696,
-2774b4fc,
-c9bb034b,
-a59a5a7e,
-88cc81a5,
-e4ed2d3f,
-0,
-0,
-7c6f68e2,
-104e8ecb,
-d2263471,
-be07c765,
-511a3208,
-3d3bfbe6,
-1084b134,
-7ca565a7,
-304bf0aa,
-5c6aaa87,
-f4347855,
-9815d543,
-4213141a,
-2e32f2f5,
-cd180a0d,
-a139f97a,
-5e852d36,
-32a464e9,
-c353169b,
-af72b274,
-8db88b4d,
-e199593a,
-7ed56d96,
-12f434c9,
-d37b36cb,
-bf5a9a64,
-85ac9b65,
-e98d4d32,
-7adf6582,
-16fe3ecd,
-d17e32c1,
-bd5f9f66,
-50b63150,
-3c9757e7,
-1052b098,
-7c73b3a7,
-0,
-0,
-c6d61d91,
-aaf73771,
-5b6226f8,
-374383ec,
-15b8bb4c,
-799959a2,
-32d5f596,
-5ef43485,
-f57b7acb,
-995a9a42,
-96acbd65,
-fa8d4d21,
-735f7682,
-1f7ebec4,
-d5be3b41,
-b99f5f62,
-52d63590,
-3ef737e5,
-1162b2f8,
-7d4383a6,
-30b8f14c,
-5c995987,
-2055d096,
-4c74b497,
-fc3b684b,
-901ada4b,
-920cb425,
-fe2ded25,
-710f7222,
-1d2eeec6,
-d4963911,
-b8b77763,
-524234b8,
-3e63a3e5,
-1128b26c,
-7d09c9a6,
-309df106,
-5cbc7c87,
-f45f7883,
-987ebe43,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-963ebc41,
-fa1fdf21,
-73167610,
-1f37f7c4,
-01829338,
-6da363b6,
-38c8e1ac,
-54e9298f,
-246dd8e6,
-484c8c93,
-fe276c73,
-9206c649,
-9302b639,
-ff23e324,
-7188732c,
-1da969c6,
-00cd91a6,
-6cec2cb7,
-ec7748d3,
-8056965b,
-9a2aa469,
-f60bcb2d,
-751c7a04,
-193dfdc2,
-02879532,
-6ea666b5,
-ed524a99,
-8173b35a,
-4ea00d7c,
-228141f9,
-1f59ae8e,
-7378b8a8,
-e3bd5747,
-8f9c5c54,
-9dcfaba3,
-f1ee2e2a,
-a2f6d5d1,
-ced71715,
-697242d8,
-055393de,
-0cb0895c,
-609151bb,
-3e51ec9e,
-5270b089,
-0,
-0,
-963ebc41,
-fa1fdf21,
-73167610,
-1f37f7c4,
-01829338,
-6da363b6,
-38c8e1ac,
-54e9298f,
-246dd8e6,
-484c8c93,
-fe276c73,
-9206c649,
-9302b639,
-ff23e324,
-7188732c,
-1da969c6,
-00cd91a6,
-6cec2cb7,
-ec7748d3,
-8056965b,
-9a2aa469,
-f60bcb2d,
-751c7a04,
-193dfdc2,
-02879532,
-6ea666b5,
-ed524a99,
-8173b35a,
-4ea00d7c,
-228141f9,
-1f59ae8e,
-7378b8a8,
-e3bd5747,
-8f9c5c54,
-9dcfaba3,
-f1ee2e2a,
-a2f6d5d1,
-ced71715,
-697242d8,
-055393de,
-0cb0895c,
-609151bb,
-3e51ec9e,
-5270b089,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-1f8eaf20,
-73af6fa8,
-37ceffa0,
-5bef2f80,
-23eed7e0,
-4fcf0f94,
-29fec3c0,
-45df1f9e,
-2cf6c9d0,
-40d7179b,
-2e72ccd8,
-42539399,
-2f30ce5c,
-4311d198,
-2f91cf1e,
-43b07098,
-fbd9678f,
-97f8384c,
-91fdb3c7,
-fddc1c26,
-a4efd9e3,
-c8ce0e13,
-be66ecf1,
-d2478709,
-673a5e48,
-0b1bdbd0,
-0b948714,
-67b575bc,
-3dc3ebba,
-51e2228a,
-f2f075dd,
-9ed11145,
-417112de,
-2d5090f6,
-cca9096f,
-a088487b,
-8a4584b7,
-e664a43d,
-a933c25b,
-c512d21e,
-b888e12d,
-d4a9690f,
-644d58a6,
-086cacd3,
-de372c53,
-b216d669,
-830a9629,
-ef2beb34,
-798c6324,
-15ad6dce,
-04cf99a2,
-68ee2eb3,
-0,
-0;
-;
\ No newline at end of file
Index: clefia-fpga/trunk/sim/tb/core_enc_tb.vhd
===================================================================
--- clefia-fpga/trunk/sim/tb/core_enc_tb.vhd (revision 2)
+++ clefia-fpga/trunk/sim/tb/core_enc_tb.vhd (nonexistent)
@@ -1,183 +0,0 @@
--- This file is part of CLEFIA Type-III FPGA IP-core.
---
--- CLEFIA Type-III is free FPGA IP-core: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- CLEFIA Type-III is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with Foobar. If not, see .
---------------------------------------------------------------------------------
--- Company: Instituto Superior Tecnico de Lisboa
--- Engineer: João Carlos Nunes Bittencourt
---
--- Design Name: Core Testbench for 256-bit key size
--- Module Name: core_enc_tb
--- Project Name: CLEFIA Type-III
---------------------------------------------------------------------------------
-library ieee;
-use ieee.std_logic_1164.all;
-
-entity core_enc_tb is
-end core_enc_tb;
-
-architecture behavior OF core_enc_tb is
-
- component core
- port ( data_in : in std_logic_vector (127 downto 0);
- data_out : out std_logic_vector (127 downto 0);
- skey : in std_logic_vector (255 downto 0);
- clk : in std_logic;
- reset : in std_logic;
- enc_dec : in std_logic;
- start : in std_logic;
- expand_key : in std_logic;
- key_size_192 : in std_logic;
- key_size_256 : in std_logic;
- ack : out std_logic;
- done_cypher : out std_logic;
- done : out std_logic
- );
- end component;
-
- -- Clock period definitions
- constant clk_period : time := 10 ns;
-
- -- Design signals
- signal clk : std_logic;
- signal reset : std_logic := '0';
- signal wk : std_logic_vector(255 downto 0) := (others => '0');
- signal start : std_logic := '0';
- signal data_in : std_logic_vector(127 downto 0) := (others => '0');
- signal data_out : std_logic_vector(127 downto 0);
- signal done : std_logic;
- signal done_core : std_logic;
- signal ack : std_logic := '0';
- -- Config signals
- signal expand_key : std_logic := '0';
- signal encrypt_decrypt : std_logic := '0';
- signal key_size_192 : std_logic := '0';
- signal key_size_256 : std_logic := '0';
-
- -- Test Vetors
- -- signal zeros : std_logic_vector (255 downto 0) := (others => '0');
- -- signal wk_128 : std_logic_vector (127 downto 0) := X"ffeeddccbbaa99887766554433221100";
- -- signal wk_192 : std_logic_vector (127 downto 0) := X"ffeeddccbbaa99887766554433221100" xor X"f0e0d0c0b0a090800011223344556677";
- -- signal wk_256 : std_logic_vector (127 downto 0) := X"ffeeddccbbaa99887766554433221100" xor X"f0e0d0c0b0a090807060504030201000";
-
- -- Shared key
- -- signal data_in_128 : std_logic_vector (255 downto 0) := X"ffeeddccbbaa9988776655443322110000000000000000000000000000000000";
- -- signal data_in_192 : std_logic_vector (255 downto 0) := X"ffeeddccbbaa99887766554433221100f0e0d0c0b0a090800011223344556677";
- signal shared_key : std_logic_vector (255 downto 0) := X"ffeeddccbbaa99887766554433221100f0e0d0c0b0a090807060504030201000";
- signal plain_text : std_logic_vector (127 downto 0) := X"000102030405060708090a0b0c0d0e0f";
-
- -- Round counter signal
- signal rcounter : integer := 0;
-
-begin
-
- DUT : core port map (
- clk => clk,
- reset => reset,
- data_in => data_in,
- data_out => data_out,
- skey => wk,
- enc_dec => encrypt_decrypt,
- start => start,
- expand_key => expand_key,
- key_size_192 => key_size_192,
- key_size_256 => key_size_256,
- ack => ack,
- done_cypher => done_core,
- done => done
- );
-
- -- Clock process definitions
- clk_process :process
- begin
- clk <= '1';
- wait for clk_period/2;
- clk <= '0';
- wait for clk_period/2;
- end process;
-
- -- Stimulus process
- stim_proc: process
- begin
- reset <= '1';
- wait for clk_period;
- -- Configuration
- data_in <= plain_text; -- & X"00000000000000000000000000000000";
- wk <= shared_key;
- key_size_192 <= '0';
- key_size_256 <= '0';
- wait for clk_period;
- -- First we need to generate the Round Keys
- expand_key <= '1';
- encrypt_decrypt <= '0';
- wait for clk_period;
- reset <= '0';
- wait for clk_period;
- start <= '1';
- wait for clk_period;
- start <= '0';
- wait until done = '1';
- wait for 2 * clk_period;
- expand_key <= '0';
- reset <= '1';
- wait for 2 * clk_period;
- reset <= '0';
- start <= '1';
- wk <= shared_key;
- data_in <= plain_text;
- wait for clk_period;
- start <= '0';
- wait until done_core = '1';
- wait for clk_period;
- assert false report "end of simulation" severity failure;
- end process;
-
- -- Round counter process
- round_counter : process
- begin
- if (start = '1') then
- rcounter <= rcounter + 1;
- elsif (rcounter /= 0) then
- rcounter <= rcounter + 1;
- end if;
- wait for clk_period;
- end process;
-
- -- String output data
- monitor : process
- function to_string(sv: Std_Logic_Vector) return string is
- use std.textio.all;
- use ieee.std_logic_textio.all;
- variable lp: line;
- begin
- hwrite(lp, sv);
- return lp.all;
- end;
- begin
- if(done_core = '1') then
- report to_string(data_out);
- end if;
- wait for clk_period;
- end process;
-
- -- Cyphered Output data
- -- ciphertext: de2bf2fd9b74aacdf1298555459494fd (128 bit)
- -- ciphertext: e2482f649f028dc480dda184fde181ad (192 bit)
-
- -- key Expand expected results:
- -- Expected Lkey for 128 bit key = 8f89a61b 9db9d0f3 93e65627 da0d027e
- -- Expected Lkey L for 192 bit key = db05415a 800082db 7cb8186c d788c5f3
- -- Expected Lkey R for 192 bit key = 1ca9b2e1 b4606829 c92dd35e 2258a432
- -- Expected Lkey L for 256 bit key = 477e8f09 66ee5378 2cc2be04 bf55e28f
- -- Expected Lkey R for 256 bit key = d6c10b89 4eeab575 84bd5663 cc933940
-end;
\ No newline at end of file
Index: clefia-fpga/trunk/sys/clefia_test.h
===================================================================
--- clefia-fpga/trunk/sys/clefia_test.h (revision 2)
+++ clefia-fpga/trunk/sys/clefia_test.h (nonexistent)
@@ -1,43 +0,0 @@
-/******************************************************************************
- * Copyright 2007, 2008 Sony Corporation
- *
- * clefia_ref.h
- *
- * "The 128-bit Blockcipher CLEFIA"
- * Header file for Reference ANSI C code
- *
- * Version 1.0.1 (August 26 2008)
- *
- * NOTICE
- * This reference code is written for a clear understanding of the CLEFIA
- * blockcipher algorithm based on the specification of CLEFIA.
- * Therefore, this code does not include any optimizations for
- * high-speed or low-cost implementations or any countermeasures against
- * implementation attacks.
- *
- *****************************************************************************/
-
-#ifndef _CLEFIA_REF_H_INCLUDED
-#define _CLEFIA_REF_H_INCLUDED
-
-#define CLEFIA_BLK_SIZE 16
-#define CLEFIA_RK_MAX (8 * 26 + 16)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int ClefiaKeySet(unsigned char *rk, const unsigned char *skey, const int key_bitlen);
-void ClefiaEncrypt(unsigned char *ct, const unsigned char *pt, const unsigned char *rk, const int r);
-void ClefiaDecrypt(unsigned char *pt, const unsigned char *ct, const unsigned char *rk, const int r);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ?_CLEFIA_REF_H_INCLUDED */
-
-
-/* end of file */
-
-
Index: clefia-fpga/trunk/sys/clefia_test.c
===================================================================
--- clefia-fpga/trunk/sys/clefia_test.c (revision 2)
+++ clefia-fpga/trunk/sys/clefia_test.c (nonexistent)
@@ -1,591 +0,0 @@
-/******************************************************************************
- * Copyright 2007, 2008 Sony Corporation
- *
- * clefia_ref.c
- *
- * "The 128-bit Blockcipher CLEFIA"
- * Reference ANSI C code
- *
- * Version 1.0.1 (August 26 2008)
- *
- * NOTICE
- * This reference code is written for a clear understanding of the CLEFIA
- * blockcipher algorithm based on the specification of CLEFIA.
- * Therefore, this code does not include any optimizations for
- * high-speed or low-cost implementations or any countermeasures against
- * implementation attacks.
- *
- *****************************************************************************/
-
-void BytePut0(const unsigned char *data, int bytelen);
-void BytePut(const unsigned char *data, int bytelen);
-void ByteCpy(unsigned char *dst, const unsigned char *src, int bytelen);
-void ByteXor(unsigned char *dst, const unsigned char *a, const unsigned char *b, int bytelen);
-
-unsigned char ClefiaMul2(unsigned char x);
-void ClefiaF0Xor(unsigned char *y, const unsigned char *x, const unsigned char *rk);
-void ClefiaF1Xor(unsigned char *y, const unsigned char *x, const unsigned char *rk);
-void ClefiaGfn4(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r);
-void ClefiaGfn8(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r);
-void ClefiaGfn4Inv(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r);
-
-void ClefiaDoubleSwap(unsigned char *lk);
-void ClefiaConSet(unsigned char *con, const unsigned char *iv, int lk);
-void ClefiaKeySet128(unsigned char *rk, const unsigned char *skey);
-void ClefiaKeySet192(unsigned char *rk, const unsigned char *skey);
-void ClefiaKeySet256(unsigned char *rk, const unsigned char *skey);
-
-int ClefiaKeySet(unsigned char *rk, const unsigned char *skey, const int key_bitlen);
-void ClefiaEncrypt(unsigned char *ct, const unsigned char *pt, const unsigned char *rk, const int r);
-void ClefiaDecrypt(unsigned char *pt, const unsigned char *ct, const unsigned char *rk, const int r);
-
-
-/* S0 (8-bit S-box based on four 4-bit S-boxes) */
-const unsigned char clefia_s0[256] = {
- 0x57U, 0x49U, 0xd1U, 0xc6U, 0x2fU, 0x33U, 0x74U, 0xfbU,
- 0x95U, 0x6dU, 0x82U, 0xeaU, 0x0eU, 0xb0U, 0xa8U, 0x1cU,
- 0x28U, 0xd0U, 0x4bU, 0x92U, 0x5cU, 0xeeU, 0x85U, 0xb1U,
- 0xc4U, 0x0aU, 0x76U, 0x3dU, 0x63U, 0xf9U, 0x17U, 0xafU,
- 0xbfU, 0xa1U, 0x19U, 0x65U, 0xf7U, 0x7aU, 0x32U, 0x20U,
- 0x06U, 0xceU, 0xe4U, 0x83U, 0x9dU, 0x5bU, 0x4cU, 0xd8U,
- 0x42U, 0x5dU, 0x2eU, 0xe8U, 0xd4U, 0x9bU, 0x0fU, 0x13U,
- 0x3cU, 0x89U, 0x67U, 0xc0U, 0x71U, 0xaaU, 0xb6U, 0xf5U,
- 0xa4U, 0xbeU, 0xfdU, 0x8cU, 0x12U, 0x00U, 0x97U, 0xdaU,
- 0x78U, 0xe1U, 0xcfU, 0x6bU, 0x39U, 0x43U, 0x55U, 0x26U,
- 0x30U, 0x98U, 0xccU, 0xddU, 0xebU, 0x54U, 0xb3U, 0x8fU,
- 0x4eU, 0x16U, 0xfaU, 0x22U, 0xa5U, 0x77U, 0x09U, 0x61U,
- 0xd6U, 0x2aU, 0x53U, 0x37U, 0x45U, 0xc1U, 0x6cU, 0xaeU,
- 0xefU, 0x70U, 0x08U, 0x99U, 0x8bU, 0x1dU, 0xf2U, 0xb4U,
- 0xe9U, 0xc7U, 0x9fU, 0x4aU, 0x31U, 0x25U, 0xfeU, 0x7cU,
- 0xd3U, 0xa2U, 0xbdU, 0x56U, 0x14U, 0x88U, 0x60U, 0x0bU,
- 0xcdU, 0xe2U, 0x34U, 0x50U, 0x9eU, 0xdcU, 0x11U, 0x05U,
- 0x2bU, 0xb7U, 0xa9U, 0x48U, 0xffU, 0x66U, 0x8aU, 0x73U,
- 0x03U, 0x75U, 0x86U, 0xf1U, 0x6aU, 0xa7U, 0x40U, 0xc2U,
- 0xb9U, 0x2cU, 0xdbU, 0x1fU, 0x58U, 0x94U, 0x3eU, 0xedU,
- 0xfcU, 0x1bU, 0xa0U, 0x04U, 0xb8U, 0x8dU, 0xe6U, 0x59U,
- 0x62U, 0x93U, 0x35U, 0x7eU, 0xcaU, 0x21U, 0xdfU, 0x47U,
- 0x15U, 0xf3U, 0xbaU, 0x7fU, 0xa6U, 0x69U, 0xc8U, 0x4dU,
- 0x87U, 0x3bU, 0x9cU, 0x01U, 0xe0U, 0xdeU, 0x24U, 0x52U,
- 0x7bU, 0x0cU, 0x68U, 0x1eU, 0x80U, 0xb2U, 0x5aU, 0xe7U,
- 0xadU, 0xd5U, 0x23U, 0xf4U, 0x46U, 0x3fU, 0x91U, 0xc9U,
- 0x6eU, 0x84U, 0x72U, 0xbbU, 0x0dU, 0x18U, 0xd9U, 0x96U,
- 0xf0U, 0x5fU, 0x41U, 0xacU, 0x27U, 0xc5U, 0xe3U, 0x3aU,
- 0x81U, 0x6fU, 0x07U, 0xa3U, 0x79U, 0xf6U, 0x2dU, 0x38U,
- 0x1aU, 0x44U, 0x5eU, 0xb5U, 0xd2U, 0xecU, 0xcbU, 0x90U,
- 0x9aU, 0x36U, 0xe5U, 0x29U, 0xc3U, 0x4fU, 0xabU, 0x64U,
- 0x51U, 0xf8U, 0x10U, 0xd7U, 0xbcU, 0x02U, 0x7dU, 0x8eU
-};
-
-/* S1 (8-bit S-box based on inverse function) */
-const unsigned char clefia_s1[256] = {
- 0x6cU, 0xdaU, 0xc3U, 0xe9U, 0x4eU, 0x9dU, 0x0aU, 0x3dU,
- 0xb8U, 0x36U, 0xb4U, 0x38U, 0x13U, 0x34U, 0x0cU, 0xd9U,
- 0xbfU, 0x74U, 0x94U, 0x8fU, 0xb7U, 0x9cU, 0xe5U, 0xdcU,
- 0x9eU, 0x07U, 0x49U, 0x4fU, 0x98U, 0x2cU, 0xb0U, 0x93U,
- 0x12U, 0xebU, 0xcdU, 0xb3U, 0x92U, 0xe7U, 0x41U, 0x60U,
- 0xe3U, 0x21U, 0x27U, 0x3bU, 0xe6U, 0x19U, 0xd2U, 0x0eU,
- 0x91U, 0x11U, 0xc7U, 0x3fU, 0x2aU, 0x8eU, 0xa1U, 0xbcU,
- 0x2bU, 0xc8U, 0xc5U, 0x0fU, 0x5bU, 0xf3U, 0x87U, 0x8bU,
- 0xfbU, 0xf5U, 0xdeU, 0x20U, 0xc6U, 0xa7U, 0x84U, 0xceU,
- 0xd8U, 0x65U, 0x51U, 0xc9U, 0xa4U, 0xefU, 0x43U, 0x53U,
- 0x25U, 0x5dU, 0x9bU, 0x31U, 0xe8U, 0x3eU, 0x0dU, 0xd7U,
- 0x80U, 0xffU, 0x69U, 0x8aU, 0xbaU, 0x0bU, 0x73U, 0x5cU,
- 0x6eU, 0x54U, 0x15U, 0x62U, 0xf6U, 0x35U, 0x30U, 0x52U,
- 0xa3U, 0x16U, 0xd3U, 0x28U, 0x32U, 0xfaU, 0xaaU, 0x5eU,
- 0xcfU, 0xeaU, 0xedU, 0x78U, 0x33U, 0x58U, 0x09U, 0x7bU,
- 0x63U, 0xc0U, 0xc1U, 0x46U, 0x1eU, 0xdfU, 0xa9U, 0x99U,
- 0x55U, 0x04U, 0xc4U, 0x86U, 0x39U, 0x77U, 0x82U, 0xecU,
- 0x40U, 0x18U, 0x90U, 0x97U, 0x59U, 0xddU, 0x83U, 0x1fU,
- 0x9aU, 0x37U, 0x06U, 0x24U, 0x64U, 0x7cU, 0xa5U, 0x56U,
- 0x48U, 0x08U, 0x85U, 0xd0U, 0x61U, 0x26U, 0xcaU, 0x6fU,
- 0x7eU, 0x6aU, 0xb6U, 0x71U, 0xa0U, 0x70U, 0x05U, 0xd1U,
- 0x45U, 0x8cU, 0x23U, 0x1cU, 0xf0U, 0xeeU, 0x89U, 0xadU,
- 0x7aU, 0x4bU, 0xc2U, 0x2fU, 0xdbU, 0x5aU, 0x4dU, 0x76U,
- 0x67U, 0x17U, 0x2dU, 0xf4U, 0xcbU, 0xb1U, 0x4aU, 0xa8U,
- 0xb5U, 0x22U, 0x47U, 0x3aU, 0xd5U, 0x10U, 0x4cU, 0x72U,
- 0xccU, 0x00U, 0xf9U, 0xe0U, 0xfdU, 0xe2U, 0xfeU, 0xaeU,
- 0xf8U, 0x5fU, 0xabU, 0xf1U, 0x1bU, 0x42U, 0x81U, 0xd6U,
- 0xbeU, 0x44U, 0x29U, 0xa6U, 0x57U, 0xb9U, 0xafU, 0xf2U,
- 0xd4U, 0x75U, 0x66U, 0xbbU, 0x68U, 0x9fU, 0x50U, 0x02U,
- 0x01U, 0x3cU, 0x7fU, 0x8dU, 0x1aU, 0x88U, 0xbdU, 0xacU,
- 0xf7U, 0xe4U, 0x79U, 0x96U, 0xa2U, 0xfcU, 0x6dU, 0xb2U,
- 0x6bU, 0x03U, 0xe1U, 0x2eU, 0x7dU, 0x14U, 0x95U, 0x1dU
-};
-
-
-void ByteCpy(unsigned char *dst, const unsigned char *src, int bytelen)
-{
- while(bytelen-- > 0){
- *dst++ = *src++;
- }
-}
-
-void ByteXor(unsigned char *dst, const unsigned char *a, const unsigned char *b, int bytelen)
-{
- while(bytelen-- > 0){
- *dst++ = *a++ ^ *b++;
- }
-}
-
-unsigned char ClefiaMul2(unsigned char x)
-{
- /* multiplication over GF(2^8) (p(x) = '11d') */
- if(x & 0x80U){
- x ^= 0x0eU;
- }
- return ((x << 1) | (x >> 7));
-}
-
-#define ClefiaMul4(_x) (ClefiaMul2(ClefiaMul2((_x))))
-#define ClefiaMul6(_x) (ClefiaMul2((_x)) ^ ClefiaMul4((_x)))
-#define ClefiaMul8(_x) (ClefiaMul2(ClefiaMul4((_x))))
-#define ClefiaMulA(_x) (ClefiaMul2((_x)) ^ ClefiaMul8((_x)))
-
-void ClefiaF0Xor(unsigned char *dst, const unsigned char src[4], const unsigned char *rk)
-{
- unsigned char x[4], y[4], z[4];
-
- /* F0 */
-// printf("\ni1: "); BytePut(src, 4);
- printf("\n --- F_0 ---\n");
- printf("rk0: "); BytePut(rk, 4);
-// printf("src0_in: "); BytePut(src, 4);
- /* Key addition */
- ByteXor(x, src, rk, 4);
- /* Substitution layer */
- z[0] = clefia_s0[x[0]];
- z[1] = clefia_s1[x[1]];
- z[2] = clefia_s0[x[2]];
- z[3] = clefia_s1[x[3]];
- /* Diffusion layer (M0) */
- y[0] = z[0] ^ ClefiaMul2(z[1]) ^ ClefiaMul4(z[2]) ^ ClefiaMul6(z[3]);
- y[1] = ClefiaMul2(z[0]) ^ z[1] ^ ClefiaMul6(z[2]) ^ ClefiaMul4(z[3]);
- y[2] = ClefiaMul4(z[0]) ^ ClefiaMul6(z[1]) ^ z[2] ^ ClefiaMul2(z[3]);
- y[3] = ClefiaMul6(z[0]) ^ ClefiaMul4(z[1]) ^ ClefiaMul2(z[2]) ^ z[3] ;
- /* Xoring after F0 */
- ByteCpy(dst + 0, src + 0, 4);
- ByteXor(dst + 4, src + 4, y, 4);
-// printf("src0_out: "); BytePut(src + 4, 4);
-// printf("\n");
- printf("y0: "); BytePut(y, 4);
- printf("r10 : "); BytePut(src + 4, 4);
- printf("x1 : "); BytePut(dst + 4, 4);
-}
-
-void ClefiaF1Xor(unsigned char *dst, const unsigned char *src, const unsigned char *rk)
-{
- unsigned char x[4], y[4], z[4];
-
- /* F1 */
- /* Key addition */
-// unsigned char tmpKey;
-// tmpKey = src;
-// printf("\ni1: "); BytePut(src, 4);
- printf("\n --- F_1 ---\n");
- printf("rk1: "); BytePut(rk, 4);
-// printf("src1_in: "); BytePut(src, 4);
- ByteXor(x, src, rk, 4);
- /* Substitution layer */
- z[0] = clefia_s1[x[0]];
- z[1] = clefia_s0[x[1]];
- z[2] = clefia_s1[x[2]];
- z[3] = clefia_s0[x[3]];
- /* Diffusion layer (M1) */
- y[0] = z[0] ^ ClefiaMul8(z[1]) ^ ClefiaMul2(z[2]) ^ ClefiaMulA(z[3]);
- y[1] = ClefiaMul8(z[0]) ^ z[1] ^ ClefiaMulA(z[2]) ^ ClefiaMul2(z[3]);
- y[2] = ClefiaMul2(z[0]) ^ ClefiaMulA(z[1]) ^ z[2] ^ ClefiaMul8(z[3]);
- y[3] = ClefiaMulA(z[0]) ^ ClefiaMul2(z[1]) ^ ClefiaMul8(z[2]) ^ z[3] ;
-
- /* Xoring after F1 */
- ByteCpy(dst + 0, src + 0, 4);
- ByteXor(dst + 4, src + 4, y, 4);
-// printf("src1_out: "); BytePut(src + 4, 4);
-// printf("L1 : "); BytePut(dst + 4, 4);
-// printf("\n");
- printf("y1: "); BytePut(y, 4);
- printf("r11 : "); BytePut(src + 4, 4);
- printf("x1 : "); BytePut(dst + 4, 4);
-}
-
-void ClefiaGfn4(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r)
-{
- unsigned char fin[16], fout[16];
-
- ByteCpy(fin, x, 16);
- int round = 0;
- while(r-- > 0){
- round++;
-// printf("\n Round %d", round);
- ClefiaF0Xor(fout + 0, fin + 0, rk + 0);
- ClefiaF1Xor(fout + 8, fin + 8, rk + 4);
- rk += 8;
- if(r){ /* swapping for encryption */
- ByteCpy(fin + 0, fout + 4, 12);
- ByteCpy(fin + 12, fout + 0, 4);
- }
- }
- ByteCpy(y, fout, 16);
-}
-
-void ClefiaGfn8(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r)
-{
- unsigned char fin[32], fout[32];
-
- ByteCpy(fin, x, 32);
- while(r-- > 0){
- ClefiaF0Xor(fout + 0, fin + 0, rk + 0);
- ClefiaF1Xor(fout + 8, fin + 8, rk + 4);
- ClefiaF0Xor(fout + 16, fin + 16, rk + 8);
- ClefiaF1Xor(fout + 24, fin + 24, rk + 12);
- rk += 16;
- if(r){ /* swapping for encryption */
- ByteCpy(fin + 0, fout + 4, 28);
- ByteCpy(fin + 28, fout + 0, 4);
- }
- }
- ByteCpy(y, fout, 32);
-}
-
-void ClefiaGfn4Inv(unsigned char *y, const unsigned char *x, const unsigned char *rk, int r)
-{
- unsigned char fin[16], fout[16];
-
- rk += (r - 1) * 8;
- ByteCpy(fin, x, 16);
- while(r-- > 0){
- ClefiaF0Xor(fout + 0, fin + 0, rk + 0);
- ClefiaF1Xor(fout + 8, fin + 8, rk + 4);
- rk -= 8;
- if(r){ /* swapping for decryption */
- ByteCpy(fin + 0, fout + 12, 4);
- ByteCpy(fin + 4, fout + 0, 12);
- }
- }
- ByteCpy(y, fout, 16);
-}
-
-void ClefiaDoubleSwap(unsigned char *lk)
-{
- unsigned char t[16];
-
- t[0] = (lk[0] << 7) | (lk[1] >> 1);
- t[1] = (lk[1] << 7) | (lk[2] >> 1);
- t[2] = (lk[2] << 7) | (lk[3] >> 1);
- t[3] = (lk[3] << 7) | (lk[4] >> 1);
- t[4] = (lk[4] << 7) | (lk[5] >> 1);
- t[5] = (lk[5] << 7) | (lk[6] >> 1);
- t[6] = (lk[6] << 7) | (lk[7] >> 1);
- t[7] = (lk[7] << 7) | (lk[15] & 0x7fU);
-
- t[8] = (lk[8] >> 7) | (lk[0] & 0xfeU);
- t[9] = (lk[9] >> 7) | (lk[8] << 1);
- t[10] = (lk[10] >> 7) | (lk[9] << 1);
- t[11] = (lk[11] >> 7) | (lk[10] << 1);
- t[12] = (lk[12] >> 7) | (lk[11] << 1);
- t[13] = (lk[13] >> 7) | (lk[12] << 1);
- t[14] = (lk[14] >> 7) | (lk[13] << 1);
- t[15] = (lk[15] >> 7) | (lk[14] << 1);
-
- ByteCpy(lk, t, 16);
-}
-
-void ClefiaConSet(unsigned char *con, const unsigned char *iv, int lk)
-{
- unsigned char t[2];
- unsigned char tmp;
-
- ByteCpy(t, iv, 2);
- while(lk-- > 0){
- con[0] = t[0] ^ 0xb7U; /* P_16 = 0xb7e1 (natural logarithm) */
- con[1] = t[1] ^ 0xe1U;
- con[2] = ~((t[0] << 1) | (t[1] >> 7));
- con[3] = ~((t[1] << 1) | (t[0] >> 7));
- con[4] = ~t[0] ^ 0x24U; /* Q_16 = 0x243f (circle ratio) */
- con[5] = ~t[1] ^ 0x3fU;
- con[6] = t[1];
- con[7] = t[0];
- con += 8;
-
- /* updating T */
- if(t[1] & 0x01U){
- t[0] ^= 0xa8U;
- t[1] ^= 0x30U;
- }
- tmp = t[0] << 7;
- t[0] = (t[0] >> 1) | (t[1] << 7);
- t[1] = (t[1] >> 1) | tmp;
- }
-}
-
-void ClefiaKeySet128(unsigned char *rk, const unsigned char *skey)
-{
- const unsigned char iv[2] = {0x42U, 0x8aU}; /* cubic root of 2 */
- unsigned char lk[16];
- unsigned char con128[4 * 60];
- int i;
- unsigned char tmpKey;
-
- tmpKey = rk;
-
- /* generating CONi^(128) (0 <= i < 60, lk = 30) */
- ClefiaConSet(con128, iv, 30);
- /* GFN_{4,12} (generating L from K) */
- ClefiaGfn4(lk, skey, con128, 12);
-
- ByteCpy(rk, skey, 8); /* initial whitening key (WK0, WK1) */
- rk += 8;
- for(i = 0; i < 9; i++){ /* round key (RKi (0 <= i < 36)) */
- ByteXor(rk, lk, con128 + i * 16 + (4 * 24), 16);
-
- printf("\n----------------\n Cst : "); BytePut(con128 + i * 16 + (4 * 24), 16);
- printf("\n L : "); BytePut(lk, 16);
- if(i % 2){
- ByteXor(rk, rk, skey, 16); /* Xoring K */
- printf("\n Wkey : "); BytePut(skey, 16);
- }
- ClefiaDoubleSwap(lk); /* Updating L (DoubleSwap function) */
- printf("\n rk : "); BytePut(rk, 16);
- rk += 16;
- }
- ByteCpy(rk, skey + 8, 8); /* final whitening key (WK2, WK3) */
-}
-
-void ClefiaKeySet192(unsigned char *rk, const unsigned char *skey)
-{
- const unsigned char iv[2] = {0x71U, 0x37U}; /* cubic root of 3 */
- unsigned char skey256[32];
- unsigned char lk[32];
- unsigned char con192[4 * 84];
- int i;
-
- ByteCpy(skey256, skey, 24);
- for(i = 0; i < 8; i++){
- skey256[i + 24] = ~skey[i];
- }
-
- BytePut(skey256,32);
-
- /* generating CONi^(192) (0 <= i < 84, lk = 42) */
- ClefiaConSet(con192, iv, 42);
- /* GFN_{8,10} (generating L from K) */
- ClefiaGfn8(lk, skey256, con192, 10);
-
- ByteXor(rk, skey256, skey256 + 16, 8); /* initial whitening key (WK0, WK1) */
-
- rk += 8;
-// int j;
- for(i = 0; i < 11; i++){ /* round key (RKi (0 <= i < 44)) */
-
-// printf("\n----------------\n Cst : ");
-// for (j = 0; j < 16; j = j + 4) BytePut0(con192 + i * 16 + (4 * 24)+j, 4);
-// //BytePut(con192 + i * 16 + (4 * 24), 16);
-
- if((i / 2) % 2){
- printf("\n----------------\n Cst : "); BytePut(con192 + i * 16 + (4 * 40), 16);
- printf("\n Lr : ");BytePut0(lk+16, 16);
- ByteXor(rk, lk + 16, con192 + i * 16 + (4 * 40), 16); /* LR */
- if(i % 2){
- ByteXor(rk, rk, skey256 + 0, 16); /* Xoring KL */
- }
- ClefiaDoubleSwap(lk + 16); /* updating LR */
- printf("\n rk : "); BytePut(rk, 16);
- }else{
- printf("\n----------------\n Cst : "); BytePut(con192 + i * 16 + (4 * 40), 16);
- printf("\n Ll : ");BytePut0(lk, 16);
- ByteXor(rk, lk + 0, con192 + i * 16 + (4 * 40), 16); /* LL */
- if(i % 2){
- ByteXor(rk, rk, skey256 + 16, 16); /* Xoring KR */
- }
- ClefiaDoubleSwap(lk + 0); /* updating LL */
- printf("\n rk : "); BytePut(rk, 16);
- }
-// printf("\n rk : "); for (j = 0; j < 16; j = j + 4) BytePut0(rk+j, 4); printf("\n");
- rk += 16;
- }
- ByteXor(rk, skey256 + 8, skey256 + 24, 8); /* final whitening key (WK2, WK3) */
- // printf("\n key : "); BytePut(skey256, 24);
-}
-
-void ClefiaKeySet256(unsigned char *rk, const unsigned char *skey)
-{
- const unsigned char iv[2] = {0xb5, 0xc0U}; /* cubic root of 5 */
- unsigned char lk[32];
- unsigned char con256[4 * 92];
- int i;
-// int j;
-
- /* generating CONi^(256) (0 <= i < 92, lk = 46) */
- ClefiaConSet(con256, iv, 46);
- /* GFN_{8,10} (generating L from K) */
- ClefiaGfn8(lk, skey, con256, 10);
-
- ByteXor(rk, skey, skey + 16, 8); /* initial whitening key (WK0, WK1) */
-
- rk += 8;
- for(i = 0; i < 13; i++){ /* round key (RKi (0 <= i < 52)) */
- printf("\n----------------\n Cst : "); BytePut(con256 + i * 16 + (4 * 40), 16);
- // printf("\n L : "); for (j = 0; j < 16; j = j + 4) BytePut0(lk+j, 4);
- // BytePut(lk, 16); BytePut(lk+16, 16);//printf("\n");
- if((i / 2) % 2){
- //printf("\n Lr : "); BytePut0(lk+16, 16);
- ByteXor(rk, lk + 16, con256 + i * 16 + (4 * 40), 16); /* LR */
- if(i % 2){
- ByteXor(rk, rk, skey + 0, 16); /* Xoring KL */
- }
- ClefiaDoubleSwap(lk + 16); /* updating LR */
- }else{
-// printf("\n Ll : "); BytePut0(lk, 16);
- ByteXor(rk, lk + 0, con256 + i * 16 + (4 * 40), 16); /* LL */
- if(i % 2){
- ByteXor(rk, rk, skey + 16, 16); /* Xoring KR */
- }
- ClefiaDoubleSwap(lk + 0); /* updating LL */
- }
-// printf("\n rk : "); for (j = 0; j < 16; j = j + 4) BytePut0(rk+j, 4); printf("\n");
- rk += 16;
- }
- ByteXor(rk, skey + 8, skey + 24, 8); /* final whitening key (WK2, WK3) */
-}
-
-
-int ClefiaKeySet(unsigned char *rk, const unsigned char *skey, const int key_bitlen)
-{
- if(128 == key_bitlen){
- ClefiaKeySet128(rk, skey);
- return 18;
- }else if(192 == key_bitlen){
- ClefiaKeySet192(rk, skey);
- return 22;
- }else if(256 == key_bitlen){
- ClefiaKeySet256(rk, skey);
- return 26;
- }
-
- return 0; /* invalid key_bitlen */
-}
-
-void ClefiaEncrypt(unsigned char *ct, const unsigned char *pt, const unsigned char *rk, const int r)
-{
- unsigned char rin[16], rout[16];
-
- ByteCpy(rin, pt, 16);
-
- ByteXor(rin + 4, rin + 4, rk + 0, 4); /* initial key whitening */
- ByteXor(rin + 12, rin + 12, rk + 4, 4);
- rk += 8;
-
- ClefiaGfn4(rout, rin, rk, r); /* GFN_{4,r} */
-
- ByteCpy(ct, rout, 16);
- ByteXor(ct + 4, ct + 4, rk + r * 8 + 0, 4); /* final key whitening */
- ByteXor(ct + 12, ct + 12, rk + r * 8 + 4, 4);
-}
-
-void ClefiaDecrypt(unsigned char *pt, const unsigned char *ct, const unsigned char *rk, const int r)
-{
- unsigned char rin[16], rout[16];
-
- ByteCpy(rin, ct, 16);
-
- ByteXor(rin + 4, rin + 4, rk + r * 8 + 8, 4); /* initial key whitening */
- ByteXor(rin + 12, rin + 12, rk + r * 8 + 12, 4);
- rk += 8;
-
- ClefiaGfn4Inv(rout, rin, rk, r); /* GFN^{-1}_{4,r} */
-
- ByteCpy(pt, rout, 16);
- ByteXor(pt + 4, pt + 4, rk - 8, 4); /* final key whitening */
- ByteXor(pt + 12, pt + 12, rk - 4, 4);
-}
-
-
-
-/* Test */
-
-//#ifdef _CLEFIA_TEST
-
-#include
-
-void BytePut(const unsigned char *data, int bytelen)
-{
- while(bytelen-- > 0){
- printf("%02x", *data++);
- }
- printf("\n");
-}
-
-void BytePut0(const unsigned char *data, int bytelen)
-{
- while(bytelen-- > 0){
- printf("%02x", *data++);
- }
- printf(" ");
-}
-
-int main(void)
-{
- const unsigned char skey[32] = {
- 0xffU,0xeeU,0xddU,0xccU,0xbbU,0xaaU,0x99U,0x88U,
- 0x77U,0x66U,0x55U,0x44U,0x33U,0x22U,0x11U,0x00U,
- 0xf0U,0xe0U,0xd0U,0xc0U,0xb0U,0xa0U,0x90U,0x80U,
- 0x70U,0x60U,0x50U,0x40U,0x30U,0x20U,0x10U,0x00U
- };
- const unsigned char pt[16] = {
- 0x00U,0x01U,0x02U,0x03U,0x04U,0x05U,0x06U,0x07U,
- 0x08U,0x09U,0x0aU,0x0bU,0x0cU,0x0dU,0x0eU,0x0fU
- };
- unsigned char ct[16];
- unsigned char dst[16];
- unsigned char rk[8 * 26 + 16]; /* 8 bytes x 26 rounds(max) + whitening keys */
- int r;
-
- printf("--- Test ---\n");
- printf("plaintext: "); BytePut(pt, 16);
- printf("secretkey: "); BytePut(skey, 32);
-
- /* for 128-bit key */
- printf("--- CLEFIA-128 ---\n");
- /* encryption */
- r = ClefiaKeySet(rk, skey, 128);
- ClefiaEncrypt(dst, pt, rk, r);
- printf("\nciphertext: "); BytePut(dst, 16);
- /* decryption */
- ByteCpy(ct, dst, 16);
- r = ClefiaKeySet(rk, skey, 128);
- ClefiaDecrypt(dst, ct, rk, r);
- printf("plaintext : "); BytePut(dst, 16);
-
- /* for 192-bit key */
- printf("--- CLEFIA-192 ---\n");
- /* encryption */
- r = ClefiaKeySet(rk, skey, 192);
- ClefiaEncrypt(dst, pt, rk, r);
- printf("ciphertext: "); BytePut(dst, 16);
- /* decryption */
- ByteCpy(ct, dst, 16);
- r = ClefiaKeySet(rk, skey, 192);
- ClefiaDecrypt(dst, ct, rk, r);
- printf("plaintext : "); BytePut(dst, 16);
-
- /* for 256-bit key */
- printf("--- CLEFIA-256 ---\n");
- /* encryption */
- r = ClefiaKeySet(rk, skey, 256);
- ClefiaEncrypt(dst, pt, rk, r);
- printf("ciphertext: "); BytePut(dst, 16);
- /* decryption */
- ByteCpy(ct, dst, 16);
- r = ClefiaKeySet(rk, skey, 256);
- ClefiaDecrypt(dst, ct, rk, r);
- printf("plaintext : "); BytePut(dst, 16);
-
- return 0;
-}
-
-//#endif /* _CLEFIA_TEST */
-
-
-
-/* end of file */
-
-