OKlibrary  0.2.1.6
AdvancedEncryptionStandard.hpp File Reference

Plans on the AES implementation. More...

Go to the source code of this file.


Detailed Description

Plans on the AES implementation.

Todo:
Provide function for generating AES term
  • Running something like
    maxima> aes_encrypt_ibc_gen(p,k,1,s,mc);
       
    should result in a term representing AES which we can then rewrite and utilise in our explanation of the AES system.
  • Currently however, we get the following error:
    fullmapl: argument must be a list or matrix; found: "+"
    #0: lambda([a,b],matrixmap(rijn_stand,a+b))(a=p,b=k)
    #1: ibc_0(buildq([sbox_f],lambda([key,r],aes_keyschedule(key,r,sbox_f))),buildq([sbox_f,mixcolumn_f],lambda([p,r],aes_round_ibc(p,r,sbox_f,mixcolumn_f))),lambda([a,b],matrixmap(rijn_stand,a+b)))(plain_text=p,key=k,n=2)
    #2: aes_encrypt_ibc_gen(plaintext=p,key=k,num_rounds=1,sbox_f=s,mixcolumn_f=mc)
     -- an error. To debug this try: debugmode(true);
       
  • One needs to make sure that each of the functions in the AES implementation is written carefully to ensure it collapses correctly to a term when all relevant details are provided.
  • One can generate a general term if we provide matrices of terms and specify the MixColumn operation:
    maxima> aes_encrypt_ibc_gen(genmatrix(lambda([a,b],nounify(p)(a,b)),4,4),genmatrix(lambda([a,b],nounify(k)(a,b)),4,4),1,nounify(s),rijn_mixcolumn);
    matrix([('s('p(2,2)+'k(2,2))+'s('p(1,1)+'k(1,1)))*x
                   +'s('p(4,4)+'k(4,4))+'s('p(3,3)+'k(3,3))+'s('k(2,4))+'s('p(2,2)+'k(2,2))+'k(1,1)+1,
                  ('s('p(2,3)+'k(2,3))+'s('p(1,2)+'k(1,2)))*x
                   +'s('p(4,1)+'k(4,1))+'s('p(3,4)+'k(3,4))+'s('k(2,4))+'s('p(2,3)+'k(2,3))+'k(1,2)
                   +'k(1,1)+1,
                  ('s('p(2,4)+'k(2,4))+'s('p(1,3)+'k(1,3)))*x
                   +'s('p(4,2)+'k(4,2))+'s('p(3,1)+'k(3,1))+'s('p(2,4)+'k(2,4))+'s('k(2,4))+'k(1,3)
                   +'k(1,2)+'k(1,1)+1,
                  ('s('p(2,1)+'k(2,1))+'s('p(1,4)+'k(1,4)))*x
                   +'s('p(4,3)+'k(4,3))+'s('p(3,2)+'k(3,2))+'s('k(2,4))+'s('p(2,1)+'k(2,1))+'k(1,4)
                   +'k(1,3)+'k(1,2)+'k(1,1)+1],
                 [('s('p(3,3)+'k(3,3))+'s('p(2,2)+'k(2,2)))*x
                   +'s('p(4,4)+'k(4,4))+'s('k(3,4))+'s('p(3,3)+'k(3,3))+'s('p(1,1)+'k(1,1))+'k(2,1),
                  ('s('p(3,4)+'k(3,4))+'s('p(2,3)+'k(2,3)))*x
                   +'s('p(4,1)+'k(4,1))+'s('p(3,4)+'k(3,4))+'s('k(3,4))+'s('p(1,2)+'k(1,2))+'k(2,2)
                   +'k(2,1),
                  ('s('p(3,1)+'k(3,1))+'s('p(2,4)+'k(2,4)))*x
                   +'s('p(4,2)+'k(4,2))+'s('k(3,4))+'s('p(3,1)+'k(3,1))+'s('p(1,3)+'k(1,3))+'k(2,3)
                   +'k(2,2)+'k(2,1),
                  ('s('p(3,2)+'k(3,2))+'s('p(2,1)+'k(2,1)))*x
                   +'s('p(4,3)+'k(4,3))+'s('k(3,4))+'s('p(3,2)+'k(3,2))+'s('p(1,4)+'k(1,4))+'k(2,4)
                   +'k(2,3)+'k(2,2)+'k(2,1)],
                 [('s('p(4,4)+'k(4,4))+'s('p(3,3)+'k(3,3)))*x
                   +'s('p(4,4)+'k(4,4))+'s('k(4,4))+'s('p(2,2)+'k(2,2))+'s('p(1,1)+'k(1,1))+'k(3,1),
                  ('s('p(4,1)+'k(4,1))+'s('p(3,4)+'k(3,4)))*x
                   +'s('k(4,4))+'s('p(4,1)+'k(4,1))+'s('p(2,3)+'k(2,3))+'s('p(1,2)+'k(1,2))+'k(3,2)
                   +'k(3,1),
                  ('s('p(4,2)+'k(4,2))+'s('p(3,1)+'k(3,1)))*x
                   +'s('k(4,4))+'s('p(4,2)+'k(4,2))+'s('p(2,4)+'k(2,4))+'s('p(1,3)+'k(1,3))+'k(3,3)
                   +'k(3,2)+'k(3,1),
                  ('s('p(4,3)+'k(4,3))+'s('p(3,2)+'k(3,2)))*x
                   +'s('k(4,4))+'s('p(4,3)+'k(4,3))+'s('p(2,1)+'k(2,1))+'s('p(1,4)+'k(1,4))+'k(3,4)
                   +'k(3,3)+'k(3,2)+'k(3,1)],
                 [('s('p(4,4)+'k(4,4))+'s('p(1,1)+'k(1,1)))*x
                   +'s('p(3,3)+'k(3,3))+'s('p(2,2)+'k(2,2))+'s('k(1,4))+'s('p(1,1)+'k(1,1))+'k(4,1),
                  ('s('p(4,1)+'k(4,1))+'s('p(1,2)+'k(1,2)))*x
                   +'s('p(3,4)+'k(3,4))+'s('p(2,3)+'k(2,3))+'s('k(1,4))+'s('p(1,2)+'k(1,2))+'k(4,2)
                   +'k(4,1),
                  ('s('p(4,2)+'k(4,2))+'s('p(1,3)+'k(1,3)))*x
                   +'s('p(3,1)+'k(3,1))+'s('p(2,4)+'k(2,4))+'s('k(1,4))+'s('p(1,3)+'k(1,3))+'k(4,3)
                   +'k(4,2)+'k(4,1),
                  ('s('p(4,3)+'k(4,3))+'s('p(1,4)+'k(1,4)))*x
                   +'s('p(3,2)+'k(3,2))+'s('p(2,1)+'k(2,1))+'s('p(1,4)+'k(1,4))+'s('k(1,4))+'k(4,4)
                   +'k(4,3)+'k(4,2)+'k(4,1)])
       
Todo:
Standardise data types and documentation
  • A comment section needs to be written at the top of the AdvancedEncryptionStandard.mac to describe the basic idea and the basic standard datatypes present.
  • This should also be transferred to docus.
  • DONE Currently the specifications (in comments) and docus are incomplete and inconsistent, due to changes from lists of integers to matrices of polynomials, and the original poor definitions.
Todo:
Requirements
  • This should be expanded and tidied up with a more formal specification?
  • This specification should then be moved to the docus.
  • What specifically is needed from the maxima implementation?
    • DONE A function F_AES(p,k) = c and F_AES'(c,k) = p .
    • (DONE Moved to Generalisations) How to generalise this to Rijndael? Perhaps F_Rijndael(p,k,r) where the size of p and k is implicit based on the structures used for p and k, and r is given? Is r really needed as it seems this is a function of the size of p and k?
    • DONE A separate round function to allow greater flexibility when investigating variants with a smaller number of rounds.
    • (DONE Moved to Generalisations) What sort of generalisations are needed?
      1. Should the elements of the round such as ShiftRows be interchangable to some arbitrary permutation (perhaps just across rows?)?
      2. Should MixColumns be generalised to an arbitrary 4-Byte value multiplication, should it even be viewed in this way? See ???
Todo:
Add todos.
Bug:
DONE (Added missing "_rijn" specifier) Sbox vector calculation yields wrong size
  • rijn_sbox_vec([0,0,0,0,0,0,0,0]) = [1,1,0,0,0,1,1]

Definition in file AdvancedEncryptionStandard.hpp.