27 #if defined(CRYPTO_AES_DEFAULT) || defined(CRYPTO_DOC) 
   68     uint8_t *schedule = sched;
 
   69     memcpy(schedule, key, 32);
 
   72     uint8_t iteration = 1;
 
   78             keyScheduleCore(schedule + 32, schedule + 28, iteration);
 
   79             schedule[32] ^= schedule[0];
 
   80             schedule[33] ^= schedule[1];
 
   81             schedule[34] ^= schedule[2];
 
   82             schedule[35] ^= schedule[3];
 
   87             applySbox(schedule + 32, schedule + 28);
 
   88             schedule[32] ^= schedule[0];
 
   89             schedule[33] ^= schedule[1];
 
   90             schedule[34] ^= schedule[2];
 
   91             schedule[35] ^= schedule[3];
 
   94             schedule[32] = schedule[28] ^ schedule[0];
 
   95             schedule[33] = schedule[29] ^ schedule[1];
 
   96             schedule[34] = schedule[30] ^ schedule[2];
 
   97             schedule[35] = schedule[31] ^ schedule[3];
 
  137 #define ENCRYPT(phase) \ 
  139         AESCommon::subBytesAndShiftRows(state2, state1); \ 
  140         AESCommon::mixColumn(state1,      state2); \ 
  141         AESCommon::mixColumn(state1 + 4,  state2 + 4); \ 
  142         AESCommon::mixColumn(state1 + 8,  state2 + 8); \ 
  143         AESCommon::mixColumn(state1 + 12, state2 + 12); \ 
  144         for (posn = 0; posn < 16; ++posn) \ 
  145             state1[posn] ^= schedule[posn + (phase)]; \ 
  147 #define DECRYPT(phase) \ 
  149         for (posn = 0; posn < 16; ++posn) \ 
  150             state2[posn] ^= schedule[posn + (phase)]; \ 
  151         AESCommon::inverseMixColumn(state1,      state2); \ 
  152         AESCommon::inverseMixColumn(state1 + 4,  state2 + 4); \ 
  153         AESCommon::inverseMixColumn(state1 + 8,  state2 + 8); \ 
  154         AESCommon::inverseMixColumn(state1 + 12, state2 + 12); \ 
  155         AESCommon::inverseShiftRowsAndSubBytes(state2, state1); \ 
  159         AESCommon::keyScheduleCore(temp, schedule + 28, (n)); \ 
  160         schedule[0] ^= temp[0]; \ 
  161         schedule[1] ^= temp[1]; \ 
  162         schedule[2] ^= temp[2]; \ 
  163         schedule[3] ^= temp[3]; \ 
  167         schedule[(a) * 4] ^= schedule[(b) * 4]; \ 
  168         schedule[(a) * 4 + 1] ^= schedule[(b) * 4 + 1]; \ 
  169         schedule[(a) * 4 + 2] ^= schedule[(b) * 4 + 2]; \ 
  170         schedule[(a) * 4 + 3] ^= schedule[(b) * 4 + 3]; \ 
  174         AESCommon::applySbox(temp, schedule + 12); \ 
  175         schedule[16] ^= temp[0]; \ 
  176         schedule[17] ^= temp[1]; \ 
  177         schedule[18] ^= temp[2]; \ 
  178         schedule[19] ^= temp[3]; \ 
  193 AESTiny256::~AESTiny256()
 
  220         memcpy(schedule, key, 32);
 
  228     uint8_t schedule[32];
 
  236     memcpy(schedule, this->schedule, 32);
 
  239     for (posn = 0; posn < 16; ++posn)
 
  240         state1[posn] = input[posn] ^ schedule[posn];
 
  244     for (round = 1; round <= 6; ++round) {
 
  267     AESCommon::subBytesAndShiftRows(state2, state1);
 
  268     for (posn = 0; posn < 16; ++posn)
 
  269         output[posn] = state2[posn] ^ schedule[posn];
 
  312 AESSmall256::~AESSmall256()
 
  331     memcpy(schedule, key, 32);
 
  332     for (round = 1; round <= 6; ++round) {
 
  353     uint8_t schedule[32];
 
  361     memcpy(schedule, reverse, 32);
 
  364     for (posn = 0; posn < 16; ++posn)
 
  365         state1[posn] = input[posn] ^ schedule[posn];
 
  366     AESCommon::inverseShiftRowsAndSubBytes(state2, state1);
 
  373     for (round = 6; round >= 1; --round) {
 
  391     for (posn = 0; posn < 16; ++posn)
 
  392         output[posn] = state2[posn] ^ schedule[posn];
 
AES256()
Constructs an AES 256-bit block cipher with no initial key.
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
size_t keySize() const
Size of a 256-bit AES key in bytes.
AESSmall256()
Constructs an AES 256-bit block cipher with no initial key.
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
void clear()
Clears all security-sensitive state from this block cipher.
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
size_t keySize() const
Size of a 256-bit AES key in bytes.
AESTiny256()
Constructs an AES 256-bit block cipher with no initial key.
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
void clear()
Clears all security-sensitive state from this block cipher.
size_t blockSize() const
Size of an AES block in bytes.