Brissouille / Lagrange

Cryptanalysis on differents algorithms with z3 solver sat
GNU General Public License v3.0
17 stars 1 forks source link

Management of Mode for the AES (ECB, CBC, ....) #2

Closed Brissouille closed 5 years ago

Brissouille commented 5 years ago

Will the class Aes be a class inheritance or a class attribute ?

Brissouille commented 5 years ago

To my mind, the best solution is to create a class for each mode. For example, a class AES_CBC mode will have "n" attributes of type aes. Then we combine the output of one aes to the input of the next aes.

Brissouille commented 5 years ago

I'm beginning by the CBC, because the ECB is a joke.

Brissouille commented 5 years ago

CBC mode is in progress. Nevertheless, I may change my conception of the integration of the mode. Indeed I think that the code can be factorized with the other mode of the AES.

Brissouille commented 5 years ago

The Aes_Cbc class is implemented but not completly tested. The factorization of the code is not taken in account in the commit c6e384aad85bcb98d45dd69f366afc2d78364706

Brissouille commented 5 years ago

During the test, I found a bug with the key. Indeed the zero key works but not the FF key. The encryption of a message works with key zero keys. The xor with the iv works.

Brissouille commented 5 years ago

I found the bug with the key. It is just a forget to add the equations into my solver. The Aes_Cbc class is pushed on master and the branches are merged.

Brissouille commented 5 years ago

I will created a new branch for the other mode

Brissouille commented 5 years ago

The other mode will be implemented with the factorization of the code. I must implement the decryption function in the aes_mode class and transform the init_mode function to an abstract method.

Brissouille commented 5 years ago

The mode CBC has a problem about the second block. The plaintext of second block looks like to zero block. EDIT: I found the problem, fix it in master branch without verify. EDIT2: I verify a little, it works

Brissouille commented 5 years ago

Problem with Aes_Ctr mode. The indexes of the iv must be mastered. EDIT: The indexes is mastered but the equation in the solver is no taken account.

Brissouille commented 5 years ago

I resolve the problem with AES ctr. I delete the reset of aes block and it s work. I stop the development of the different mode of the AES.