diff --git a/Makefile b/Makefile index f816daa..75b17aa 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,18 @@ +FLAGS = -Wall -Wextra + all: clean build_test build_debug build_profile build_release build_test: - g++ -g -pthread ./src/AES.cpp ./tests/tests.cpp /usr/lib/libgtest.a -o bin/test + g++ $(FLAGS) -g -pthread ./src/AES.cpp ./tests/tests.cpp /usr/lib/libgtest.a -o bin/test build_debug: - g++ -g ./src/AES.cpp ./dev/main.cpp -o bin/debug + g++ $(FLAGS) -g ./src/AES.cpp ./dev/main.cpp -o bin/debug build_profile: - g++ -pg ./src/AES.cpp ./dev/main.cpp -o bin/profile + g++ $(FLAGS) -pg ./src/AES.cpp ./dev/main.cpp -o bin/profile build_release: - g++ -O2 ./src/AES.cpp ./dev/main.cpp -o bin/release + g++ $(FLAGS) -O2 ./src/AES.cpp ./dev/main.cpp -o bin/release clean: rm -rf bin diff --git a/dev/main.cpp b/dev/main.cpp index 970c2bf..45603a1 100644 --- a/dev/main.cpp +++ b/dev/main.cpp @@ -1,7 +1,7 @@ #include #include "../src/AES.h" -int main(int argc, char *argv[]) +int main() { cout << "Aes dev" << endl; return 0; diff --git a/src/AES.cpp b/src/AES.cpp index 0e34eb9..346a02d 100644 --- a/src/AES.cpp +++ b/src/AES.cpp @@ -274,10 +274,8 @@ void AES::SubBytes(unsigned char **state) void AES::ShiftRow(unsigned char **state, int i, int n) // shift row i on n positions { - unsigned char t; - int k, j, index; unsigned char *tmp = new unsigned char[Nb]; - for (j = 0; j < Nb; j++) { + for (int j = 0; j < Nb; j++) { tmp[j] = state[i][(j + n) % Nb]; } memcpy(state[i], tmp, Nb * sizeof(unsigned char)); @@ -521,7 +519,7 @@ void AES::XorBlocks(unsigned char *a, unsigned char * b, unsigned char *c, unsig void AES::printHexArray (unsigned char a[], unsigned int n) { - for (int i = 0; i < n; i++) { + for (unsigned int i = 0; i < n; i++) { printf("%02x ", a[i]); } }