Implement AES algorithm
This commit is contained in:
parent
afe36cebe6
commit
4720e95cf2
1 changed files with 21 additions and 6 deletions
21
aes/aes.cpp
21
aes/aes.cpp
|
@ -191,10 +191,25 @@ void aes(uint8_t *in, uint8_t *out, uint8_t *skey)
|
||||||
addRoundKey(state, expKey, 0);
|
addRoundKey(state, expKey, 0);
|
||||||
printf("ARK: "); printstate(state);
|
printf("ARK: "); printstate(state);
|
||||||
|
|
||||||
/* ??? */
|
for (int i = 1; i <= 10; i++) {
|
||||||
/* ??? */
|
subBytes(state);
|
||||||
/* ??? */
|
printf("SB: ");
|
||||||
|
printstate(state);
|
||||||
|
|
||||||
|
shiftRows(state);
|
||||||
|
printf("SR: ");
|
||||||
|
printstate(state);
|
||||||
|
|
||||||
|
if (i < 10) {
|
||||||
|
mixColumns(state);
|
||||||
|
printf("MC: ");
|
||||||
|
printstate(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRoundKey(state, expKey, 4*i);
|
||||||
|
printf("ARK: ");
|
||||||
|
printstate(state);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (i < 4) out[i] = wbyte(state[0], i % 4);
|
if (i < 4) out[i] = wbyte(state[0], i % 4);
|
||||||
|
|
Loading…
Reference in a new issue