OpenWhiteBox / AES

Implementations of white-box AES constructions and their cryptanalyses.
BSD 3-Clause "New" or "Revised" License
209 stars 31 forks source link

Precompution phase #7

Closed sia72abedi closed 3 years ago

sia72abedi commented 3 years ago

Hi @Bren2010,

I read the code that you wrote for Chow. I have a question there. As I understood from the Chow scheme in key generation phase, the application should create a table for every section and precompute everything on that table. for example, the Tbox step should be defined as out = TBox(in) instead of out = SBox(RelativeByteOfRoundKey ^ in). It means that TBox should be completely similar to the sbox table. In other words, generate all possibility of 'in' and calculate relative 'out' and store these pair as a table. So that in the encryption phase, the application search in the table based on input and finding the output. But in your application, I saw that you are calculating based on SBox(RelativeByteOfRoundKey ^ in) in the encryption phase. could you please explain?

Bren2010 commented 3 years ago

Can you point to which area of the code you're specifically confused about? The encryption logic here looks reasonable to me -- everything is computed as table lookups.

sia72abedi commented 3 years ago

in the section that you pointed you are calling ExpandWord. Then the program tries to call the Get method of TBoxTyiTable. So it refers to the Get method of common.TBox as this type assigned to the TBoxTyiTable in the key generation phase. So the this Get method will be called. This get method does "SBox(RelativeByteOfRoundKey ^ in)", not retrieve from precompiled table.

Bren2010 commented 3 years ago

Ah ok, you're right that after key generation TBoxTyiTable will be backed by an implementation that still has the round key in memory. However if you serialize and then parse the construction, you'll see that the table is computed in-full and then backed by an opaque table.ParsedWord. Hope that helps!