OKlibrary  0.2.1.6
AdvancedEncryptionStandard.mac
Go to the documentation of this file.
00001 /* Matthew Gwynne, 4.3.2008 (Swansea) */
00002 /* Copyright 2008, 2009, 2010, 2011 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00021 oklib_include("OKlib/ComputerAlgebra/Cryptology/Lisp/CryptoSystems/Rijndael/AdvancedEncryptionStandard.mac")$
00022 oklib_include("OKlib/ComputerAlgebra/Cryptology/Lisp/CryptoSystems/Rijndael/tests/AdvancedEncryptionStandard.mac")$
00023 
00024 
00025 /* *********
00026    * S box *
00027    *********
00028 */
00029 
00030 okltest_rijn_sbox_vec(rijn_sbox_vec);
00031 okltest_rijn_sbox_nat(rijn_sbox_nat);
00032 okltest_rijn_sbox_nat(rijn_lookup_sbox_nat);
00033 okltest_rijn_inv_sbox_vec(rijn_inv_sbox_vec);
00034 okltest_rijn_inv_sbox_nat(rijn_inv_sbox_nat);
00035 okltest_rijn_inv_sbox_nat(rijn_lookup_inv_sbox_nat);
00036 
00037 okltest_rijn_sbox_pmtf(rijn_sbox_pmtf);
00038 okltest_rijn_inv_sbox_pmtf(rijn_inv_sbox_pmtf);
00039 
00040 okltest_rijn_sbox_vec(rijn_sbox_bf);
00041 okltest_rijn_inv_sbox_vec(rijn_inv_sbox_bf);
00042 
00043 /* *************
00044    * Sub-bytes *
00045    *************
00046 */
00047 
00048 okltest_rijn_subbytes(rijn_subbytes);
00049 okltest_rijn_inv_subbytes(rijn_inv_subbytes);
00050 
00051 
00052 /* **************
00053    * Shift rows *
00054    **************
00055 */
00056 
00057 okltest_aes_shiftrows(aes_shiftrows);
00058 okltest_aes_inv_shiftrows(aes_inv_shiftrows);
00059 
00060 /* ***************
00061    * Mix columns *
00062    ***************
00063 */
00064 
00065 okltest_rijn_mixcolumn(rijn_mixcolumn);
00066 okltest_rijn_inv_mixcolumn(rijn_inv_mixcolumn);
00067 
00068 
00069 okltest_rijn_mixcolumns(rijn_mixcolumns);
00070 okltest_rijn_inv_mixcolumns(rijn_inv_mixcolumns);
00071 
00072 
00073 /* *****************
00074    * Key expansion *
00075    *****************
00076 */
00077 
00078 okltest_aes_key_expansion(aes_key_expansion); 
00079 
00080 /* *********************************
00081    * AES encryption and decryption *
00082    *********************************
00083 */
00084 
00085 okltest_aes_round(aes_round);
00086 okltest_aes_inv_round(aes_inv_round);
00087 
00088 okltest_aes_encrypt_gen(aes_encrypt_gen);
00089 okltest_aes_decrypt_gen(aes_decrypt_gen);
00090 okltest_aes_encrypt_gen(aes_encrypt_ibc_gen);
00091 
00092 /* *************************************
00093    * Convenience instantiations of AES *
00094    *************************************
00095 */
00096 
00097 okltest_aes_encrypt_generic(aes_encrypt_l);
00098 if oklib_test_level >= 1 then okltest_aes_encrypt_generic(aes_encrypt)
00099 else true;
00100 okltest_aes_encrypt_nat_generic(aes_encrypt_nat_l);
00101 if oklib_test_level >= 1 then okltest_aes_encrypt_nat_generic(aes_encrypt_nat)
00102 else true;
00103 
00104 okltest_aes_decrypt_generic(aes_decrypt_l);
00105 if oklib_test_level >= 1 then okltest_aes_decrypt_generic(aes_decrypt)
00106 else true;
00107 okltest_aes_decrypt_nat_generic(aes_decrypt_nat_l);
00108 if oklib_test_level >= 1 then okltest_aes_decrypt_nat_generic(aes_decrypt_nat)
00109 else true;
00110 
00111 okltest_aes_encrypt_bin(aes_encrypt_bin);
00112 okltest_aes_decrypt_bin(aes_decrypt_bin);
00113 
00114 okltest_aes_encrypt_hex(aes_encrypt_hex);
00115 okltest_aes_decrypt_hex(aes_decrypt_hex);
00116 
00117 okltest_aes_int(aes_int);
00118